BigW Consortium Gitlab

nav_helper.rb 1.38 KB
Newer Older
1
module NavHelper
2
  def page_sidebar_class
3 4
    if pinned_nav?
      "page-sidebar-expanded page-sidebar-pinned"
5 6 7
    end
  end

8
  def page_gutter_class
9
    if current_path?('merge_requests#show') ||
10 11 12 13 14 15
        current_path?('merge_requests#diffs') ||
        current_path?('merge_requests#commits') ||
        current_path?('merge_requests#builds') ||
        current_path?('merge_requests#conflicts') ||
        current_path?('merge_requests#pipelines') ||
        current_path?('issues#show')
16 17 18 19 20
      if cookies[:collapsed_gutter] == 'true'
        "page-gutter right-sidebar-collapsed"
      else
        "page-gutter right-sidebar-expanded"
      end
Phil Hughes committed
21 22
    elsif current_path?('builds#show')
      "page-gutter build-sidebar right-sidebar-expanded"
23
    elsif current_path?('wikis#show') ||
24 25 26
        current_path?('wikis#edit') ||
        current_path?('wikis#history') ||
        current_path?('wikis#git_access')
27
      "page-gutter wiki-sidebar right-sidebar-expanded"
28 29 30
    end
  end

31
  def nav_header_class
Phil Hughes committed
32 33
    class_name = ''
    class_name << " with-horizontal-nav" if defined?(nav) && nav
34 35

    if pinned_nav?
36
      class_name << " header-sidebar-expanded header-sidebar-pinned"
37 38
    end

39
    class_name
40
  end
41 42 43 44 45

  def layout_nav_class
    "page-with-layout-nav" if defined?(nav) && nav
  end

46 47 48
  def nav_control_class
    "nav-control" if current_user
  end
49 50 51 52

  def pinned_nav?
    cookies[:pin_nav] == 'true'
  end
53
end