diff options
Diffstat (limited to 'app/helpers/milestones_helper.rb')
-rw-r--r-- | app/helpers/milestones_helper.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index da6a0e38c44..2f5aac892ab 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -26,7 +26,7 @@ module MilestonesHelper end end - def milestones_label_path(opts = {}) + def milestones_issues_path(opts = {}) if @project project_issues_path(@project, opts) elsif @group @@ -283,6 +283,27 @@ module MilestonesHelper can?(current_user, :admin_milestone, @project.group) end end + + def display_issues_count_warning?(milestone) + milestone_visible_issues_count(milestone) > Milestone::DISPLAY_ISSUES_LIMIT + end + + def milestone_issues_count_message(milestone) + total_count = milestone_visible_issues_count(milestone) + limit = Milestone::DISPLAY_ISSUES_LIMIT + link_options = { milestone_title: @milestone.title } + + message = _('Showing %{limit} of %{total_count} issues. ') % { limit: limit, total_count: total_count } + message += link_to(_('View all issues'), milestones_issues_path(link_options)) + + message.html_safe + end + + private + + def milestone_visible_issues_count(milestone) + @milestone_visible_issues_count ||= milestone.issues_visible_to_user(current_user).size + end end MilestonesHelper.prepend_if_ee('EE::MilestonesHelper') |