Merge branch 'master' of github.com:r888888888/danbooru
This commit is contained in:
@@ -459,6 +459,10 @@ class Post < ActiveRecord::Base
|
||||
typed_tags("artist")
|
||||
end
|
||||
|
||||
def general_tags
|
||||
typed_tags("general")
|
||||
end
|
||||
|
||||
def typed_tags(name)
|
||||
@typed_tags ||= {}
|
||||
@typed_tags[name] ||= begin
|
||||
|
||||
@@ -67,6 +67,28 @@ class PostPresenter < Presenter
|
||||
string.join(" ").tr("_", " ")
|
||||
end
|
||||
|
||||
def categorized_tag_string
|
||||
string = []
|
||||
|
||||
if @post.copyright_tags.any?
|
||||
string << @post.copyright_tags.join(" ")
|
||||
end
|
||||
|
||||
if @post.character_tags.any?
|
||||
string << @post.character_tags.join(" ")
|
||||
end
|
||||
|
||||
if @post.artist_tags.any?
|
||||
string << @post.artist_tags.join(" ")
|
||||
end
|
||||
|
||||
if @post.general_tags.any?
|
||||
string << @post.general_tags.join(" ")
|
||||
end
|
||||
|
||||
string.join("\n")
|
||||
end
|
||||
|
||||
def image_html(template)
|
||||
return template.content_tag("p", "The artist requested removal of this image") if @post.is_banned? && !CurrentUser.user.is_privileged?
|
||||
return template.content_tag("p", template.link_to("You need a privileged account to see this image.", template.upgrade_information_users_path)) if !Danbooru.config.can_user_see_post?(CurrentUser.user, @post)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<% unless CurrentUser.user.is_contributor? %>
|
||||
<% unless CurrentUser.user.is_builder? %>
|
||||
<div style="margin-bottom: 1em;">
|
||||
<p>Before editing, read the <%= link_to "how to tag guide", wiki_page_path(:id => "howto:tag") %>.</p>
|
||||
</div>
|
||||
@@ -61,7 +61,7 @@
|
||||
<div class="input">
|
||||
<div>
|
||||
<%= f.label :tag_string, "Tags" %>
|
||||
<%= f.text_area :tag_string , :size => "50x3", :value => post.tag_string + " " %>
|
||||
<%= f.text_area :tag_string , :size => "50x3", :value => post.presenter.categorized_tag_string + " " %>
|
||||
</div>
|
||||
|
||||
<%= button_tag "Related tags", :id => "related-tags-button", :type => "button" %>
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
<%= @post.presenter.humanized_tag_string %> - <%= Danbooru.config.app_name %>
|
||||
<%= @post.presenter.humanized_essential_tag_string %> - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
|
||||
<% content_for(:html_header) do %>
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
<%= render "form" %>
|
||||
|
||||
<% if @wiki_page.presenter.antecedent_tag_alias %>
|
||||
<p class="hint">This tag has been aliased to <%= link_to @wiki_page.presenter.antecedent_tag_alias.consequent_name, posts_path(:tags => @wiki_page.presenter.antecedent_tag_alias.consequent_name) %>.</p>
|
||||
<p class="hint">This tag has been aliased to <%= link_to @wiki_page.presenter.antecedent_tag_alias.consequent_name, show_or_new_wiki_pages_path(:title => @wiki_page.presenter.antecedent_tag_alias.consequent_name) %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.consequent_tag_aliases.any? %>
|
||||
<p class="hint">The following tags are aliased to this tag: <%= raw @wiki_page.presenter.consequent_tag_aliases.map {|x| link_to(x.antecedent_name, posts_path(:tags => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<p class="hint">The following tags are aliased to this tag: <%= raw @wiki_page.presenter.consequent_tag_aliases.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.antecedent_tag_implications.any? %>
|
||||
<p class="hint">This tag has been implicated to <%= raw @wiki_page.presenter.antecedent_tag_implications.map {|x| link_to(x.consequent_name, posts_path(:tags => x.consequent_name))}.join(", ") %>.</p>
|
||||
<p class="hint">This tag has been implicated to <%= raw @wiki_page.presenter.antecedent_tag_implications.map {|x| link_to(x.consequent_name, show_or_new_wiki_pages_path(:title => x.consequent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.consequent_tag_implications.any? %>
|
||||
<p class="hint">The following tags are implicated to this tag: <%= raw @wiki_page.presenter.consequent_tag_implications.map {|x| link_to(x.antecedent_name, posts_path(:tags => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<p class="hint">The following tags are implicated to this tag: <%= raw @wiki_page.presenter.consequent_tag_implications.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
|
||||
<div id="wiki-page-posts">
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
<%= format_text(@wiki_page.body) %>
|
||||
|
||||
<% if @wiki_page.presenter.antecedent_tag_alias %>
|
||||
<p class="hint">This tag has been aliased to <%= link_to @wiki_page.presenter.antecedent_tag_alias.consequent_name, posts_path(:tags => @wiki_page.presenter.antecedent_tag_alias.consequent_name) %>.</p>
|
||||
<p class="hint">This tag has been aliased to <%= link_to @wiki_page.presenter.antecedent_tag_alias.consequent_name, show_or_new_wiki_pages_path(:title => @wiki_page.presenter.antecedent_tag_alias.consequent_name) %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.consequent_tag_aliases.any? %>
|
||||
<p class="hint">The following tags are aliased to this tag: <%= raw @wiki_page.presenter.consequent_tag_aliases.map {|x| link_to(x.antecedent_name, posts_path(:tags => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<p class="hint">The following tags are aliased to this tag: <%= raw @wiki_page.presenter.consequent_tag_aliases.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.antecedent_tag_implications.any? %>
|
||||
<p class="hint">This tag has been implicated to <%= raw @wiki_page.presenter.antecedent_tag_implications.map {|x| link_to(x.consequent_name, posts_path(:tags => x.consequent_name))}.join(", ") %>.</p>
|
||||
<p class="hint">This tag has been implicated to <%= raw @wiki_page.presenter.antecedent_tag_implications.map {|x| link_to(x.consequent_name, show_or_new_wiki_pages_path(:title => x.consequent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.consequent_tag_implications.any? %>
|
||||
<p class="hint">The following tags are implicated to this tag: <%= raw @wiki_page.presenter.consequent_tag_implications.map {|x| link_to(x.antecedent_name, posts_path(:tags => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<p class="hint">The following tags are implicated to this tag: <%= raw @wiki_page.presenter.consequent_tag_implications.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user