diff options
author | Jack Davison <jack.davison@student.manchester.ac.uk> | 2016-06-20 00:06:57 +0100 |
---|---|---|
committer | Jack Davison <jack.davison@student.manchester.ac.uk> | 2016-08-17 13:33:50 +0100 |
commit | bcdc3694919f6cc9777dd982325469fb87468835 (patch) | |
tree | 14d67ec8ed6cd1a0fdb8a4baf8740d97102aca5c /app/helpers/issues_helper.rb | |
parent | d1da2e8180d92e5f4a8b5ebb36b0f4e4d0618bf8 (diff) | |
download | gitlab-ce-bcdc3694919f6cc9777dd982325469fb87468835.tar.gz |
Truncated user list in award emoji tooltips
* Only the first 10 names are displayed
* Further users are indicated by "and X more."
* String "and X more" is appended to the array THEN join is called
* An oxford comma seperates the last name from "and X more"
* In coffeescript "me" is now always prepended
* Tests included
Diffstat (limited to 'app/helpers/issues_helper.rb')
-rw-r--r-- | app/helpers/issues_helper.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 2e82b44437b..15f08fd5918 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -114,9 +114,13 @@ module IssuesHelper end def award_user_list(awards, current_user) - awards.map do |award| + names = awards.first(10).map do |award| award.user == current_user ? 'me' : award.user.name - end.join(', ') + end + + names << "and #{awards.size - names.size} more." if awards.size > names.size + + names.join(', ') end def award_active_class(awards, current_user) |