Module: DashboardHelper

Includes:
IconsHelper
Defined in:
app/helpers/dashboard_helper.rb

Constant Summary

Constants included from IconsHelper

IconsHelper::DEFAULT_ICON_SIZE

Instance Method Summary collapse

Methods included from IconsHelper

#audit_icon, #boolean_to_icon, #custom_icon, #external_snippet_icon, #file_type_icon_class, #icon, #loading_icon, #spinner, #sprite_file_icons_path, #sprite_icon, #sprite_icon_path, #visibility_level_icon

Instance Method Details

#any_dashboard_nav_link?(links) ⇒ Boolean

Returns:

  • (Boolean)

22
23
24
# File 'app/helpers/dashboard_helper.rb', line 22

def any_dashboard_nav_link?(links)
  links.any? { |link| dashboard_nav_link?(link) }
end

#assigned_issues_dashboard_pathObject


6
7
8
# File 'app/helpers/dashboard_helper.rb', line 6

def assigned_issues_dashboard_path
  issues_dashboard_path(assignee_username: current_user.username)
end

#assigned_mrs_dashboard_pathObject


10
11
12
# File 'app/helpers/dashboard_helper.rb', line 10

def assigned_mrs_dashboard_path
  merge_requests_dashboard_path(assignee_username: current_user.username)
end

#dashboard_nav_link?(link) ⇒ Boolean

Returns:

  • (Boolean)

18
19
20
# File 'app/helpers/dashboard_helper.rb', line 18

def dashboard_nav_link?(link)
  dashboard_nav_links.include?(link)
end

14
15
16
# File 'app/helpers/dashboard_helper.rb', line 14

def dashboard_nav_links
  @dashboard_nav_links ||= get_dashboard_nav_links
end

#feature_entry(title, href: nil, enabled: true, doc_href: nil) ⇒ Object


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/helpers/dashboard_helper.rb', line 30

def feature_entry(title, href: nil, enabled: true, doc_href: nil)
  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: %w[light float-right]) do
      boolean_to_icon(enabled)
    end)

    if doc_href.present?
      link_to_doc = link_to(sprite_icon('question'), doc_href,
                            class: 'gl-ml-2', title: _('Documentation'),
                            target: '_blank', rel: 'noopener noreferrer')

      concat(link_to_doc)
    end
  end
end

#has_start_trial?Boolean

Returns:

  • (Boolean)

26
27
28
# File 'app/helpers/dashboard_helper.rb', line 26

def has_start_trial?
  false
end