2015-01-30 19:23:35 +00:00
|
|
|
module NavHelper
|
2017-07-31 08:07:51 +00:00
|
|
|
def page_with_sidebar_class
|
|
|
|
class_name = page_gutter_class
|
|
|
|
class_name << 'page-with-new-sidebar' if defined?(@new_sidebar) && @new_sidebar
|
2017-08-07 17:28:24 +00:00
|
|
|
class_name << 'page-with-icon-sidebar' if collapsed_sidebar? && @new_sidebar
|
2017-07-31 08:07:51 +00:00
|
|
|
|
|
|
|
class_name
|
|
|
|
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') ||
|
2017-06-13 22:12:31 +00:00
|
|
|
current_path?('projects/merge_requests/conflicts#show') ||
|
2017-03-23 20:53:51 +00:00
|
|
|
current_path?('issues#show') ||
|
|
|
|
current_path?('milestones#show')
|
2016-01-28 23:26:47 +00:00
|
|
|
if cookies[:collapsed_gutter] == 'true'
|
2017-07-31 08:07:51 +00:00
|
|
|
%w[page-gutter right-sidebar-collapsed]
|
2016-01-28 23:26:47 +00:00
|
|
|
else
|
2017-07-31 08:07:51 +00:00
|
|
|
%w[page-gutter right-sidebar-expanded]
|
2016-01-28 23:26:47 +00:00
|
|
|
end
|
2017-06-08 12:21:03 +00:00
|
|
|
elsif current_path?('jobs#show')
|
2017-07-31 08:07:51 +00:00
|
|
|
%w[page-gutter build-sidebar right-sidebar-expanded]
|
2016-11-14 21:33:21 +00:00
|
|
|
elsif current_path?('wikis#show') ||
|
2016-12-15 22:14:20 +00:00
|
|
|
current_path?('wikis#edit') ||
|
2017-03-20 13:53:23 +00:00
|
|
|
current_path?('wikis#update') ||
|
2016-12-15 22:14:20 +00:00
|
|
|
current_path?('wikis#history') ||
|
|
|
|
current_path?('wikis#git_access')
|
2017-07-31 08:07:51 +00:00
|
|
|
%w[page-gutter wiki-sidebar right-sidebar-expanded]
|
|
|
|
else
|
|
|
|
[]
|
2016-01-27 22:38:19 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-22 13:48:39 +00:00
|
|
|
def nav_header_class
|
2017-07-31 08:07:51 +00:00
|
|
|
class_names = []
|
|
|
|
class_names << 'with-horizontal-nav' if defined?(nav) && nav
|
2016-06-15 16:23:49 +00:00
|
|
|
|
2017-07-31 08:07:51 +00:00
|
|
|
class_names
|
2015-04-22 13:48:39 +00:00
|
|
|
end
|
2016-05-13 16:12:49 +00:00
|
|
|
|
|
|
|
def layout_nav_class
|
2017-08-10 20:13:38 +00:00
|
|
|
return 'page-with-new-nav' if show_new_nav?
|
2017-03-22 23:01:28 +00:00
|
|
|
|
2017-07-31 08:07:51 +00:00
|
|
|
class_names = []
|
|
|
|
class_names << 'page-with-layout-nav' if defined?(nav) && nav
|
|
|
|
class_names << 'page-with-sub-nav' if content_for?(:sub_nav)
|
|
|
|
|
|
|
|
class_names
|
2016-05-13 16:12:49 +00:00
|
|
|
end
|
|
|
|
|
2016-05-16 19:58:15 +00:00
|
|
|
def nav_control_class
|
|
|
|
"nav-control" if current_user
|
|
|
|
end
|
2017-08-10 20:13:38 +00:00
|
|
|
|
|
|
|
def user_dropdown_class
|
|
|
|
class_names = []
|
|
|
|
class_names << 'header-user-dropdown-toggle'
|
|
|
|
class_names << 'impersonated-user' if session[:impersonator_id]
|
|
|
|
|
|
|
|
class_names
|
|
|
|
end
|
2015-01-30 19:23:35 +00:00
|
|
|
end
|