From 87330aee69afa49b9c1ecfc611148ee799564660 Mon Sep 17 00:00:00 2001 From: Toks Date: Mon, 8 Apr 2013 21:41:14 -0400 Subject: [PATCH 1/4] fixes #1233 --- app/views/posts/partials/show/_edit.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/partials/show/_edit.html.erb b/app/views/posts/partials/show/_edit.html.erb index cd0988009..cf6c87ee0 100644 --- a/app/views/posts/partials/show/_edit.html.erb +++ b/app/views/posts/partials/show/_edit.html.erb @@ -1,4 +1,4 @@ -<% unless CurrentUser.user.is_contributor? %> +<% unless CurrentUser.user.is_builder? %>

Before editing, read the <%= link_to "how to tag guide", wiki_page_path(:id => "howto:tag") %>.

From d3dbca4ccca2ae96900306502f9126e55d645ae9 Mon Sep 17 00:00:00 2001 From: Toks Date: Tue, 9 Apr 2013 13:48:47 -0400 Subject: [PATCH 2/4] fixes #1243 --- app/views/wiki_pages/new.html.erb | 8 ++++---- app/views/wiki_pages/show.html.erb | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/wiki_pages/new.html.erb b/app/views/wiki_pages/new.html.erb index f08708cfd..596544dcd 100644 --- a/app/views/wiki_pages/new.html.erb +++ b/app/views/wiki_pages/new.html.erb @@ -14,19 +14,19 @@ <%= render "form" %> <% if @wiki_page.presenter.antecedent_tag_alias %> -

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) %>.

+

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) %>.

<% end %> <% if @wiki_page.presenter.consequent_tag_aliases.any? %> -

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(", ") %>.

+

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(", ") %>.

<% end %> <% if @wiki_page.presenter.antecedent_tag_implications.any? %> -

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(", ") %>.

+

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(", ") %>.

<% end %> <% if @wiki_page.presenter.consequent_tag_implications.any? %> -

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(", ") %>.

+

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(", ") %>.

<% end %>
diff --git a/app/views/wiki_pages/show.html.erb b/app/views/wiki_pages/show.html.erb index 185f3c5ac..e12acd887 100644 --- a/app/views/wiki_pages/show.html.erb +++ b/app/views/wiki_pages/show.html.erb @@ -16,19 +16,19 @@ <%= format_text(@wiki_page.body) %> <% if @wiki_page.presenter.antecedent_tag_alias %> -

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) %>.

+

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) %>.

<% end %> <% if @wiki_page.presenter.consequent_tag_aliases.any? %> -

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(", ") %>.

+

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(", ") %>.

<% end %> <% if @wiki_page.presenter.antecedent_tag_implications.any? %> -

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(", ") %>.

+

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(", ") %>.

<% end %> <% if @wiki_page.presenter.consequent_tag_implications.any? %> -

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(", ") %>.

+

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(", ") %>.

<% end %>
From 4006c9243e25d0ded9b23d1f5455ff56740f8377 Mon Sep 17 00:00:00 2001 From: Toks Date: Tue, 9 Apr 2013 14:08:19 -0400 Subject: [PATCH 3/4] fixes #1062 --- app/models/post.rb | 4 ++++ app/presenters/post_presenter.rb | 22 ++++++++++++++++++++ app/views/posts/partials/show/_edit.html.erb | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/models/post.rb b/app/models/post.rb index 6934b5cc7..97bc25141 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -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 diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index b540346df..30bf50f38 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -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) diff --git a/app/views/posts/partials/show/_edit.html.erb b/app/views/posts/partials/show/_edit.html.erb index cf6c87ee0..1b19845ac 100644 --- a/app/views/posts/partials/show/_edit.html.erb +++ b/app/views/posts/partials/show/_edit.html.erb @@ -61,7 +61,7 @@
<%= 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 + " " %>
<%= button_tag "Related tags", :id => "related-tags-button", :type => "button" %> From 4531965721a57cb0338ba868ace391b4818e47db Mon Sep 17 00:00:00 2001 From: Toks Date: Tue, 9 Apr 2013 14:49:55 -0400 Subject: [PATCH 4/4] fixes #1061 --- app/views/posts/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index 0c8224863..ce84e3a7e 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -95,7 +95,7 @@
<% 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 %>