2015-01-30 19:23:35 +00:00
|
|
|
module NavHelper
|
|
|
|
def nav_menu_collapsed?
|
|
|
|
cookies[:collapsed_nav] == 'true'
|
|
|
|
end
|
2015-04-22 13:48:39 +00:00
|
|
|
|
|
|
|
def nav_sidebar_class
|
2015-12-02 13:05:10 +00:00
|
|
|
if nav_menu_collapsed?
|
|
|
|
"sidebar-collapsed"
|
|
|
|
else
|
|
|
|
"sidebar-expanded"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def page_sidebar_class
|
2016-06-15 16:23:49 +00:00
|
|
|
if pinned_nav?
|
|
|
|
"page-sidebar-expanded page-sidebar-pinned"
|
2015-04-22 13:48:39 +00:00
|
|
|
else
|
2016-06-15 16:23:49 +00:00
|
|
|
"page-sidebar-collapsed"
|
2015-04-22 13:48:39 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-01-27 22:38:19 +00:00
|
|
|
def page_gutter_class
|
2016-02-15 14:19:23 +00:00
|
|
|
if current_path?('merge_requests#show') ||
|
|
|
|
current_path?('merge_requests#diffs') ||
|
|
|
|
current_path?('merge_requests#commits') ||
|
2016-02-18 21:16:32 +00:00
|
|
|
current_path?('merge_requests#builds') ||
|
2016-07-11 16:16:42 +00:00
|
|
|
current_path?('merge_requests#conflicts') ||
|
2016-08-23 08:39:31 +00:00
|
|
|
current_path?('merge_requests#pipelines') ||
|
|
|
|
|
2016-02-04 19:56:25 +00:00
|
|
|
current_path?('issues#show')
|
2016-01-28 23:26:47 +00:00
|
|
|
if cookies[:collapsed_gutter] == 'true'
|
|
|
|
"page-gutter right-sidebar-collapsed"
|
|
|
|
else
|
|
|
|
"page-gutter right-sidebar-expanded"
|
|
|
|
end
|
2016-04-20 09:11:22 +00:00
|
|
|
elsif current_path?('builds#show')
|
|
|
|
"page-gutter build-sidebar right-sidebar-expanded"
|
2016-01-27 22:38:19 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-22 13:48:39 +00:00
|
|
|
def nav_header_class
|
2016-06-15 17:33:18 +00:00
|
|
|
class_name = ''
|
|
|
|
class_name << " with-horizontal-nav" if defined?(nav) && nav
|
2016-06-15 16:23:49 +00:00
|
|
|
|
|
|
|
if pinned_nav?
|
|
|
|
class_name << " header-expanded header-pinned-nav"
|
|
|
|
else
|
|
|
|
class_name << " header-collapsed"
|
|
|
|
end
|
|
|
|
|
2016-05-03 16:44:55 +00:00
|
|
|
class_name
|
2015-04-22 13:48:39 +00:00
|
|
|
end
|
2016-05-13 16:12:49 +00:00
|
|
|
|
|
|
|
def layout_nav_class
|
|
|
|
"page-with-layout-nav" if defined?(nav) && nav
|
|
|
|
end
|
|
|
|
|
2016-05-16 19:58:15 +00:00
|
|
|
def nav_control_class
|
|
|
|
"nav-control" if current_user
|
|
|
|
end
|
2016-06-15 16:23:49 +00:00
|
|
|
|
|
|
|
def pinned_nav?
|
|
|
|
cookies[:pin_nav] == 'true'
|
|
|
|
end
|
2015-01-30 19:23:35 +00:00
|
|
|
end
|