2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
module DashboardHelper
|
2019-10-12 21:52:04 +05:30
|
|
|
include IconsHelper
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
def assigned_issues_dashboard_path
|
2019-02-15 15:39:39 +05:30
|
|
|
issues_dashboard_path(assignee_username: current_user.username)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
def assigned_mrs_dashboard_path
|
2019-02-15 15:39:39 +05:30
|
|
|
merge_requests_dashboard_path(assignee_username: current_user.username)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
def reviewer_mrs_dashboard_path
|
|
|
|
merge_requests_dashboard_path(reviewer_username: current_user.username)
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
def dashboard_nav_links
|
|
|
|
@dashboard_nav_links ||= get_dashboard_nav_links
|
|
|
|
end
|
|
|
|
|
|
|
|
def dashboard_nav_link?(link)
|
|
|
|
dashboard_nav_links.include?(link)
|
|
|
|
end
|
|
|
|
|
|
|
|
def any_dashboard_nav_link?(links)
|
|
|
|
links.any? { |link| dashboard_nav_link?(link) }
|
|
|
|
end
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
def has_start_trial?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
def feature_entry(title, href: nil, enabled: true, doc_href: nil)
|
2019-10-12 21:52:04 +05:30
|
|
|
enabled_text = enabled ? 'on' : 'off'
|
|
|
|
label = "#{title}: status #{enabled_text}"
|
|
|
|
link_or_title = href && enabled ? tag.a(title, href: href) : title
|
|
|
|
|
|
|
|
tag.p(aria: { label: label }) do
|
|
|
|
concat(link_or_title)
|
2019-12-26 22:10:19 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
concat(tag.span(class: %w[light float-right]) do
|
2019-12-26 22:10:19 +05:30
|
|
|
boolean_to_icon(enabled)
|
2019-10-12 21:52:04 +05:30
|
|
|
end)
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
if doc_href.present?
|
2020-10-24 23:57:45 +05:30
|
|
|
link_to_doc = link_to(sprite_icon('question'), doc_href,
|
2020-07-28 23:09:34 +05:30
|
|
|
class: 'gl-ml-2', title: _('Documentation'),
|
2019-12-26 22:10:19 +05:30
|
|
|
target: '_blank', rel: 'noopener noreferrer')
|
|
|
|
|
|
|
|
concat(link_to_doc)
|
|
|
|
end
|
2019-10-12 21:52:04 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
private
|
|
|
|
|
|
|
|
def get_dashboard_nav_links
|
|
|
|
links = [:projects, :groups, :snippets]
|
|
|
|
|
|
|
|
if can?(current_user, :read_cross_project)
|
|
|
|
links += [:activity, :milestones]
|
|
|
|
end
|
|
|
|
|
|
|
|
links
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
DashboardHelper.prepend_if_ee('EE::DashboardHelper')
|