debian-mirror-gitlab/app/helpers/dashboard_helper.rb

66 lines
1.5 KiB
Ruby
Raw Normal View History

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-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
2019-10-12 21:52:04 +05:30
concat(tag.span(class: ['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?
link_to_doc = link_to(sprite_icon('question', size: 16), doc_href,
class: 'prepend-left-5', title: _('Documentation'),
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')