add humanized tag string for posts

This commit is contained in:
albert
2012-11-02 18:22:08 -04:00
parent ca280ce218
commit 8da4eabb96
6 changed files with 15 additions and 3 deletions

View File

@@ -15,6 +15,10 @@ module PostSets
tag_array.uniq.join(" ") tag_array.uniq.join(" ")
end end
def humanized_tag_string
"fav:#{user.pretty_name}"
end
def posts def posts
favorites.order("favorites.id desc").includes(:post).map(&:post) favorites.order("favorites.id desc").includes(:post).map(&:post)
end end

View File

@@ -37,6 +37,10 @@ module PostSets
tag_array.join("") tag_array.join("")
end end
def humanized_tag_string
"pool:#{pool.pretty_name}"
end
def presenter def presenter
@presenter ||= PostSetPresenters::Pool.new(self) @presenter ||= PostSetPresenters::Pool.new(self)
end end

View File

@@ -11,6 +11,10 @@ module PostSets
@tag_string ||= tag_array.uniq.join(" ") @tag_string ||= tag_array.uniq.join(" ")
end end
def humanized_tag_string
tag_array.slice(0, 25).join(" ").tr("_", " ")
end
def has_wiki? def has_wiki?
tag_array.any? && ::WikiPage.titled(tag_string).exists? tag_array.any? && ::WikiPage.titled(tag_string).exists?
end end

View File

@@ -28,7 +28,7 @@ class PostPresenter < Presenter
end end
def humanized_tag_string def humanized_tag_string
@post.tag_string.split(/ /).join(", ").tr("_", " ") @post.tag_string.split(/ /).slice(0, 25).join(", ").tr("_", " ")
end end
def humanized_essential_tag_string def humanized_essential_tag_string

View File

@@ -29,7 +29,7 @@
<% content_for(:page_title) do %> <% content_for(:page_title) do %>
<% if @post_set.tag_string.present? %> <% if @post_set.tag_string.present? %>
<%= @post_set.tag_string %> - <%= Danbooru.config.app_name %> <%= @post_set.humanized_tag_string %> - <%= Danbooru.config.app_name %>
<% else %> <% else %>
<%= Danbooru.config.app_name %> <%= Danbooru.config.app_name %>
<% end %> <% end %>

View File

@@ -80,7 +80,7 @@
</div> </div>
<% content_for(:page_title) do %> <% content_for(:page_title) do %>
<%= @post.tag_string %> - <%= Danbooru.config.app_name %> <%= @post.presenter.humanized_tag_string %> - <%= Danbooru.config.app_name %>
<% end %> <% end %>
<% content_for(:html_header) do %> <% content_for(:html_header) do %>