Skip to content

Commit

Permalink
Merge pull request #2141 from sarken/issue_4308
Browse files Browse the repository at this point in the history
4308 Clicking formerly collapsed names in kudos list doesn't open user page
  • Loading branch information
LadyOscar committed Jul 16, 2015
2 parents aa353b7 + f1d5d29 commit cea8d57
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/sweepers/kudos_sweeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def after_create(kudo)

# expire the cache for the kudos section in the view
# and for the full-page, expanded list
expire_fragment "#{kudo.commentable.cache_key}/kudos"
expire_fragment "#{kudo.commentable.cache_key}/kudos-v1"
expire_fragment "#{kudo.commentable.cache_key}/kudos/full"
end
end
20 changes: 10 additions & 10 deletions app/views/kudos/_kudos.html.erb
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<% # expects local variables kudos, guest_kudos_count, commentable %>
<div id="kudos">
<% if kudos.length > 0 || guest_kudos_count > 0 %>
<% cache "#{commentable.cache_key}/kudos" do %>
<% cache "#{commentable.cache_key}/kudos-v1" do %>
<p class="kudos">
<% if kudos.length <= ArchiveConfig.MAX_KUDOS_TO_SHOW %>
<%= kudos.map {|kudo| link_to kudo.pseud.byline, kudo.pseud.user}.
to_sentence.
html_safe %>
<% else %>
<%= kudos[0,ArchiveConfig.MAX_KUDOS_TO_SHOW].map {|kudo| link_to kudo.pseud.byline, kudo.pseud.user}.
to_sentence(:last_word_connector => ', ').
html_safe + ', ' %>
<%= link_to work_kudos_path(commentable), :id => "kudos_summary" do %>
to_sentence(last_word_connector: ", ").
html_safe + ", " %>
<%= link_to work_kudos_path(commentable), id: "kudos_summary" do %>
<% collapsed_count = kudos.length - ArchiveConfig.MAX_KUDOS_TO_SHOW %>
<% if collapsed_count == 1 %>
<%= ts(' and 1 more user') %>
<%= ts(" and 1 more user") %>
<% else %>
<%= ts(' and %{collapsed_count} more users', collapsed_count: collapsed_count) %>
<%= ts(" and %{collapsed_count} more users", collapsed_count: collapsed_count) %>
<% end %>
<% end %>
<span class="kudos_expanded hidden">
<%= kudos[ArchiveConfig.MAX_KUDOS_TO_SHOW..-1].map {|kudo| link_to kudo.pseud.byline, kudo.pseud.user}.
to_sentence(:two_words_connector => ts(" and "), :last_word_connector => ts(" and ")).
to_sentence(two_words_connector: ts(" and "), last_word_connector: ts(" and ")).
html_safe %>
</span>
<% end %>
<% if guest_kudos_count > 0 %>
<% if kudos.length > 0 %>
<%= ts(" as well as ") %>
<% end %>
<%= ts(pluralize(guest_kudos_count, 'guest')) %>
<%= ts(pluralize(guest_kudos_count, "guest")) %>
<% end %>
<%= ts(" left kudos on this work!") %>
<span class='kudos_expanded hidden'>
<%= link_to ts('(collapse)'), '#' %>
<span class="kudos_expanded hidden">
<%= link_to ts("(collapse)"), "#", id: "kudos_collapser" %>
</span>
</p>
<% end %>
Expand Down
8 changes: 4 additions & 4 deletions public/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,15 @@ function prepareDeleteLinks() {

/// Kudos
$j(document).ready(function() {
$j('a#kudos_summary').click(function(e) {
$j('#kudos_summary').click(function(e) {
e.preventDefault();
$j('a#kudos_summary').hide();
$j(this).hide();
$j('.kudos_expanded').show();
});

$j('.kudos_expanded a').click(function(e) {
$j('#kudos_collapser').click(function(e) {
e.preventDefault();
$j('a#kudos_summary').show();
$j('#kudos_summary').show();
$j('.kudos_expanded').hide();
});

Expand Down

0 comments on commit cea8d57

Please sign in to comment.