diff options
author | Clement Ho <ClemMakesApps@gmail.com> | 2018-04-19 21:43:06 +0300 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2018-04-19 21:43:06 +0300 |
commit | cefeeaea3364c52afc8077c6eaa8914a4bb27852 (patch) | |
tree | 03c1100e2636510f89982b4a3473e868a3745eab /app/helpers/issuables_helper.rb | |
parent | 59d6161e1ea5f4650fe45a0f6bd2e45bb061f6e1 (diff) | |
parent | b1e9d98a29605daf7ccdd0e324dd399fdebfee41 (diff) |
Merge branch 'master' into bootstrap4
Diffstat (limited to 'app/helpers/issuables_helper.rb')
-rw-r--r-- | app/helpers/issuables_helper.rb | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index bfe5c0a6114..757c854406c 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -9,6 +9,32 @@ module IssuablesHelper "right-sidebar-#{sidebar_gutter_collapsed? ? 'collapsed' : 'expanded'}" end + def sidebar_gutter_tooltip_text + sidebar_gutter_collapsed? ? _('Expand sidebar') : _('Collapse sidebar') + end + + def sidebar_assignee_tooltip_label(issuable) + if issuable.assignee + issuable.assignee.name + else + issuable.allows_multiple_assignees? ? _('Assignee(s)') : _('Assignee') + end + end + + def sidebar_due_date_tooltip_label(issuable) + if issuable.due_date + "#{_('Due date')}<br />#{due_date_remaining_days(issuable)}" + else + _('Due date') + end + end + + def due_date_remaining_days(issuable) + remaining_days_in_words = remaining_days_in_words(issuable) + + "#{issuable.due_date.to_s(:medium)} (#{remaining_days_in_words})" + end + def multi_label_name(current_labels, default_label) if current_labels && current_labels.any? title = current_labels.first.try(:title) @@ -153,10 +179,14 @@ module IssuablesHelper def issuable_labels_tooltip(labels, limit: 5) first, last = labels.partition.with_index { |_, i| i < limit } - label_names = first.collect(&:name) - label_names << "and #{last.size} more" unless last.empty? + if labels && labels.any? + label_names = first.collect(&:name) + label_names << "and #{last.size} more" unless last.empty? - label_names.join(', ') + label_names.join(', ') + else + _("Labels") + end end def issuables_state_counter_text(issuable_type, state, display_count) @@ -321,7 +351,7 @@ module IssuablesHelper def issuable_todo_button_data(issuable, todo, is_collapsed) { todo_text: "Add todo", - mark_text: "Mark done", + mark_text: "Mark todo as done", todo_icon: (is_collapsed ? icon('plus-square') : nil), mark_icon: (is_collapsed ? icon('check-square', class: 'todo-undone') : nil), issuable_id: issuable.id, |