made 3+ plus collapse in notifications index
This commit is contained in:
parent
1666843aa9
commit
2e72fc09c6
3 changed files with 26 additions and 9 deletions
|
|
@ -44,10 +44,18 @@ module NotificationsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def notification_people_link(note)
|
def notification_people_link(note)
|
||||||
note.actors.collect{ |person| link_to("#{h(person.name.titlecase)}", person_path(person))}.join(", ").html_safe
|
actors = note.actors
|
||||||
|
number_of_actors = actors.count
|
||||||
|
actor_links = actors.collect{ |person| link_to("#{h(person.name.titlecase)}", person_path(person))}
|
||||||
|
if number_of_actors < 4
|
||||||
|
message = actor_links.join(',')
|
||||||
|
else
|
||||||
|
message = actor_links[0..2].join(', ') << "<a class='more' href='#'> #{t('.and_others', :number =>(number_of_actors - 3))}</a><span class='hidden'>, " << actor_links[3..(number_of_actors-2)].join(', ')<< " #{t('.and')} "<< actor_links.last << '</span>'
|
||||||
|
end
|
||||||
|
message.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def peoples_names(note)
|
def peoples_names(note)
|
||||||
note.actors.map{|p| p.name}.join(",")
|
note.actors.map{|p| p.name}.join(", ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,21 @@
|
||||||
type: 'PUT'
|
type: 'PUT'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if(nBadge.html() != null) {
|
||||||
nBadge.html().replace(/\d+/, function(num){
|
nBadge.html().replace(/\d+/, function(num){
|
||||||
num = parseInt(num);
|
num = parseInt(num);
|
||||||
nBadge.html(parseInt(num)-1);
|
nBadge.html(parseInt(num)-1);
|
||||||
if(num == 1) {
|
if(num == 1) {
|
||||||
nBadge.addClass("hidden");
|
nBadge.addClass("hidden");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('a.more').live('click', function(){
|
||||||
|
$(this).hide();
|
||||||
|
$(this).next('span').removeClass('hidden');
|
||||||
});
|
});
|
||||||
|
|
||||||
.span-1
|
.span-1
|
||||||
|
|
|
||||||
|
|
@ -274,6 +274,8 @@ en:
|
||||||
index:
|
index:
|
||||||
notifications: "Notifications"
|
notifications: "Notifications"
|
||||||
mark_all_as_read: "Mark All as Read"
|
mark_all_as_read: "Mark All as Read"
|
||||||
|
and_others: "and %{number} others"
|
||||||
|
and: 'and'
|
||||||
helper:
|
helper:
|
||||||
new_notifications:
|
new_notifications:
|
||||||
zero: "no new notifications"
|
zero: "no new notifications"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue