BigW Consortium Gitlab

nav_helper.rb 1.13 KB
Newer Older
1 2 3 4
module NavHelper
  def nav_menu_collapsed?
    cookies[:collapsed_nav] == 'true'
  end
5 6

  def nav_sidebar_class
7 8 9 10 11 12 13 14
    if nav_menu_collapsed?
      "sidebar-collapsed"
    else
      "sidebar-expanded"
    end
  end

  def page_sidebar_class
15 16 17 18 19 20 21
    if nav_menu_collapsed?
      "page-sidebar-collapsed"
    else
      "page-sidebar-expanded"
    end
  end

22
  def page_gutter_class
23 24 25
    if current_path?('merge_requests#show') ||
      current_path?('merge_requests#diffs') ||
      current_path?('merge_requests#commits') ||
26
      current_path?('merge_requests#builds') ||
27
      current_path?('issues#show')
28 29 30 31 32
      if cookies[:collapsed_gutter] == 'true'
        "page-gutter right-sidebar-collapsed"
      else
        "page-gutter right-sidebar-expanded"
      end
33 34 35
    end
  end

36
  def nav_header_class
37 38 39 40 41 42 43 44
    class_name =
      if nav_menu_collapsed?
        "header-collapsed"
      else
        "header-expanded"
      end
    class_name += " with-horizontal-nav" if defined?(nav) && nav
    class_name
45
  end
46 47 48 49 50

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

51 52 53
  def nav_control_class
    "nav-control" if current_user
  end
54
end