2018-08-18 07:19:57 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2012-11-21 00:24:05 -05:00
|
|
|
module DashboardHelper
|
2019-04-19 05:44:21 -04:00
|
|
|
include IconsHelper
|
|
|
|
|
2014-12-26 11:33:53 -05:00
|
|
|
def assigned_issues_dashboard_path
|
2018-10-27 13:24:30 -04:00
|
|
|
issues_dashboard_path(assignee_username: current_user.username)
|
2014-07-10 10:54:31 -04:00
|
|
|
end
|
|
|
|
|
2014-12-26 11:33:53 -05:00
|
|
|
def assigned_mrs_dashboard_path
|
2018-10-27 13:24:30 -04:00
|
|
|
merge_requests_dashboard_path(assignee_username: current_user.username)
|
2014-07-10 10:54:31 -04:00
|
|
|
end
|
2017-12-11 09:21:06 -05:00
|
|
|
|
|
|
|
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-05-11 00:16:19 -04:00
|
|
|
def has_start_trial?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2019-04-19 05:44:21 -04:00
|
|
|
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
|
|
|
|
|
2017-12-11 09:21:06 -05:00
|
|
|
private
|
|
|
|
|
|
|
|
def get_dashboard_nav_links
|
|
|
|
links = [:projects, :groups, :snippets]
|
|
|
|
|
|
|
|
if can?(current_user, :read_cross_project)
|
|
|
|
links += [:activity, :milestones]
|
|
|
|
end
|
|
|
|
|
|
|
|
links
|
|
|
|
end
|
2012-11-21 00:24:05 -05:00
|
|
|
end
|