disclose per-tag hotness modifiers

This commit is contained in:
joshua stein 2015-01-05 12:18:42 -06:00
parent db411ff112
commit 2c3b155862
2 changed files with 18 additions and 7 deletions

View file

@ -29,7 +29,12 @@
<td><%= check_box_tag "tags[]", tag.tag,
@filtered_tags.include?(tag) %></td>
<td><%= link_to tag.tag, tag_path(tag), :class => tag.css_class %></td>
<td><%= tag.description %></td>
<td><%= tag.description %>
<% if tag.hotness_mod != 0 %>
&nbsp;
<em>(hotness mod <%= tag.hotness_mod > 0 ? "+" : ""%><%=
tag.hotness_mod %>)</em>
<% end %></td>
<td style="text-align: right; padding-right: 1em;"><%=
tag.stories_count %></td>
</tr>

View file

@ -49,12 +49,18 @@
:style => "line-height: 2.3em;" %>
<%= f.select "tags_a", options_for_select(
Tag.all_with_filtered_counts_for(@user).map{|t|
[ "#{t.tag} - #{t.description}", t.tag, { "data-html" => raw("<strong>") +
t.tag + raw("</strong> - ") + t.description.to_s +
(t.filtered_count == 0 ? "" :
raw(" <em>") + "#{t.filtered_count} user" +
(t.filtered_count == 1 ? "" : "s") + " filtering" +
raw("</em>")) } ]}, f.object.tags_a), {}, { :multiple => true } %>
html = "<strong>#{h(t.tag)}</strong> - #{h(t.description.to_s)}"
if t.hotness_mod != 0
html << " (hotness mod #{t.hotness_mod > 0 ? "+" : ""}#{t.hotness_mod})"
end
if t.filtered_count > 0
html << " <em>#{t.filtered_count} user" <<
(t.filtered_count == 1 ? "" : "s") << " filtering</em>"
end
[ "#{t.tag} - #{t.description}", t.tag, { "data-html" => raw(html) } ]},
f.object.tags_a), {}, { :multiple => true } %>
</div>
<div class="boxline">