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
|
|
|
|
|
|
|
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-10-12 21:52:04 +05:30
|
|
|
def feature_entry(title, href: nil, enabled: true)
|
|
|
|
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)
|
|
|
|
concat(tag.span(class: ['light', 'float-right']) do
|
|
|
|
concat(boolean_to_icon(enabled))
|
|
|
|
end)
|
|
|
|
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
|