summaryrefslogtreecommitdiff
path: root/app/helpers/nav_helper.rb
blob: 75f2ed5e0541fb2b37e709ee932ab37d2cba19a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module NavHelper
  def nav_menu_collapsed?
    cookies[:collapsed_nav] == 'true'
  end

  def sidebar_gutter_collapsed_class
    if cookies[:collapsed_gutter] == 'true'
      "right-sidebar-collapsed"
    else
      "right-sidebar-expanded"
    end
  end

  def sidebar_gutter_collapsed?
    cookies[:collapsed_gutter] == 'true'
  end

  def nav_sidebar_class
    if nav_menu_collapsed?
      "sidebar-collapsed"
    else
      "sidebar-expanded"
    end
  end

  def page_sidebar_class
    if nav_menu_collapsed?
      "page-sidebar-collapsed"
    else
      "page-sidebar-expanded"
    end
  end

  def page_gutter_class
    if current_path?('merge_requests#show') || 
      current_path?('merge_requests#diffs') || 
      current_path?('merge_requests#commits') || 
      current_path?('issues#show')
      if cookies[:collapsed_gutter] == 'true'
        "page-gutter right-sidebar-collapsed"
      else
        "page-gutter right-sidebar-expanded"
      end
    end
  end

  def nav_header_class
    if nav_menu_collapsed?
      "header-collapsed"
    else
      "header-expanded"
    end
  end
end