Class: Renalware::System::AdminMenuComponent
Overview
Experimental ActionView component
Instance Method Summary
collapse
#current_user_is_admin?, #current_user_is_developer?, #current_user_is_super_admin?
#policy, #renalware
Instance Method Details
11
12
13
14
15
16
17
18
|
# File 'app/components/renalware/system/admin_menu_component.rb', line 11
def (*args)
return unless
current_user_is_admin? ||
current_user_is_super_admin? ||
current_user_is_developer?
(*args)
end
|
#current_controller_matches(regex) ⇒ Object
44
45
46
|
# File 'app/components/renalware/system/admin_menu_component.rb', line 44
def current_controller_matches(regex)
regex.match(params[:controller]).present?
end
|
26
27
28
29
30
|
# File 'app/components/renalware/system/admin_menu_component.rb', line 26
def (*args)
return unless current_user_is_developer?
(*args)
end
|
32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/components/renalware/system/admin_menu_component.rb', line 32
def (title, path, active_when_controller_matches, enabled = true)
klasses = %w(link)
klasses << "active" if current_controller_matches(active_when_controller_matches)
tag.li class: klasses.join(" ") do
if enabled
link_to(title, path)
else
tag.span title
end
end
end
|
20
21
22
23
24
|
# File 'app/components/renalware/system/admin_menu_component.rb', line 20
def (*args)
return unless current_user_is_super_admin? || current_user_is_developer?
(*args)
end
|