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
|
|
|
|
|
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?
|
2023-05-27 22:25:52 +05:30
|
|
|
link_to_doc = link_to(
|
2023-06-20 00:43:36 +05:30
|
|
|
sprite_icon('question-o'),
|
2023-05-27 22:25:52 +05:30
|
|
|
doc_href,
|
|
|
|
class: 'gl-ml-2',
|
|
|
|
title: _('Documentation'),
|
|
|
|
target: '_blank',
|
|
|
|
rel: 'noopener noreferrer'
|
|
|
|
)
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
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
|
2023-05-27 22:25:52 +05:30
|
|
|
links = [:projects, :groups, :snippets, :your_work, :explore]
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
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
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
DashboardHelper.prepend_mod_with('DashboardHelper')
|