Module: NavHelper

Extended by:
NavHelper
Included in:
NavHelper
Defined in:
app/helpers/nav_helper.rb

Instance Method Summary collapse

Instance Method Details



55
56
57
# File 'app/helpers/nav_helper.rb', line 55

def admin_monitoring_nav_links
  %w[system_info background_migrations background_jobs health_check]
end

#header_link?(link) ⇒ Boolean

Returns:

  • (Boolean)


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

def header_link?(link)
  header_links.include?(link)
end


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

def header_links
  @header_links ||= get_header_links
end

#page_gutter_classObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/helpers/nav_helper.rb', line 29

def page_gutter_class
  if (page_has_markdown? || current_path?('projects/merge_requests#diffs')) && !current_controller?('conflicts')
    if cookies[:collapsed_gutter] == 'true'
      ["page-gutter", ('right-sidebar-collapsed' unless skip_right_sidebar_classes?).to_s]
    else
      ["page-gutter", ('right-sidebar-expanded' unless skip_right_sidebar_classes?).to_s]
    end
  elsif current_path?('jobs#show')
    %w[page-gutter build-sidebar right-sidebar-expanded]
  elsif current_controller?('wikis') &&
      current_action?('show', 'create', 'edit', 'update', 'history', 'git_access', 'destroy', 'diff')
    %w[page-gutter has-wiki-sidebar]
  else
    []
  end
end

#page_has_markdown?Boolean

Returns:

  • (Boolean)


46
47
48
49
50
51
52
53
# File 'app/helpers/nav_helper.rb', line 46

def page_has_markdown?
  current_path?('projects/merge_requests#show') ||
    current_path?('projects/merge_requests/conflicts#show') ||
    current_path?('issues#show') ||
    current_path?('milestones#show') ||
    current_path?('issues#designs') ||
    current_path?('incidents#show')
end

#page_with_sidebar_classObject



14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/nav_helper.rb', line 14

def page_with_sidebar_class
  class_name = page_gutter_class

  class_name << 'page-with-super-sidebar'
  class_name << 'page-with-super-sidebar-collapsed' if collapsed_super_sidebar?

  class_name -= ['right-sidebar-expanded'] if defined?(@right_sidebar) && !@right_sidebar

  class_name
end

#super_sidebar_loading_state_classObject



25
26
27
# File 'app/helpers/nav_helper.rb', line 25

def super_sidebar_loading_state_class
  cookies['super_sidebar_collapsed'] == 'true' ? 'super-sidebar-is-icon-only' : ''
end