debian-mirror-gitlab/app/helpers/nav_helper.rb

64 lines
1.4 KiB
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
module NavHelper
def nav_menu_collapsed?
cookies[:collapsed_nav] == 'true'
end
2015-09-11 14:41:01 +05:30
def nav_sidebar_class
2015-12-23 02:04:40 +05:30
if nav_menu_collapsed?
"sidebar-collapsed"
else
"sidebar-expanded"
end
end
def page_sidebar_class
2016-06-22 15:30:34 +05:30
if pinned_nav?
"page-sidebar-expanded page-sidebar-pinned"
2015-09-11 14:41:01 +05:30
else
2016-06-22 15:30:34 +05:30
"page-sidebar-collapsed"
2015-09-11 14:41:01 +05:30
end
end
2016-04-02 18:10:28 +05:30
def page_gutter_class
if current_path?('merge_requests#show') ||
current_path?('merge_requests#diffs') ||
current_path?('merge_requests#commits') ||
current_path?('merge_requests#builds') ||
2016-09-13 17:45:13 +05:30
current_path?('merge_requests#conflicts') ||
2016-04-02 18:10:28 +05:30
current_path?('issues#show')
if cookies[:collapsed_gutter] == 'true'
"page-gutter right-sidebar-collapsed"
else
"page-gutter right-sidebar-expanded"
end
elsif current_path?('builds#show')
"page-gutter build-sidebar right-sidebar-expanded"
2016-04-02 18:10:28 +05:30
end
end
2015-09-11 14:41:01 +05:30
def nav_header_class
2016-06-22 15:30:34 +05:30
class_name = ''
class_name << " with-horizontal-nav" if defined?(nav) && nav
if pinned_nav?
class_name << " header-expanded header-pinned-nav"
else
class_name << " header-collapsed"
end
2016-06-02 11:05:42 +05:30
class_name
end
def layout_nav_class
"page-with-layout-nav" if defined?(nav) && nav
end
def nav_control_class
"nav-control" if current_user
2015-09-11 14:41:01 +05:30
end
2016-06-22 15:30:34 +05:30
def pinned_nav?
cookies[:pin_nav] == 'true'
end
2015-04-26 12:48:37 +05:30
end