forked from External/greenlight
use rails action_name & controller_name methods (#2666)
Co-authored-by: Ahmad Farhat <ahmad.af.farhat@gmail.com>
This commit is contained in:
@ -58,18 +58,11 @@ module ApplicationHelper
|
||||
# Returns 'active' if the current page is the users home page (used to style header)
|
||||
def active_home
|
||||
home_actions = %w[show cant_create_rooms]
|
||||
return "active" if params[:controller] == "admins" && params[:action] == "index" && current_user.has_role?(:super_admin)
|
||||
return "active" if params[:controller] == "rooms" && home_actions.include?(params[:action])
|
||||
return "active" if controller_name == "admins" && action_name == "index" && current_user.has_role?(:super_admin)
|
||||
return "active" if controller_name == "rooms" && home_actions.include?(action_name)
|
||||
""
|
||||
end
|
||||
|
||||
# Returns the action method of the current page
|
||||
def active_page
|
||||
route = Rails.application.routes.recognize_path(request.env['PATH_INFO'])
|
||||
|
||||
route[:action]
|
||||
end
|
||||
|
||||
def role_colour(role)
|
||||
role.colour || Rails.configuration.primary_color_default
|
||||
end
|
||||
|
Reference in New Issue
Block a user