Class: Hyku::MenuPresenter
- Inherits:
-
Hyrax::MenuPresenter
- Object
- Hyrax::MenuPresenter
- Hyku::MenuPresenter
- Defined in:
- lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb
Overview
view-model for the admin menu
Instance Attribute Summary
Attributes inherited from Hyrax::MenuPresenter
Instance Method Summary collapse
- #cdm_migrator_section? ⇒ Boolean
-
#repository_activity_section? ⇒ Boolean
Returns true if the current controller happens to be one of the controllers that deals with repository activity This is used to keep the parent section on the sidebar open.
-
#roles_and_permissions_section? ⇒ Boolean
Returns true if the current controller happens to be one of the controllers that deals with roles and permissions.
-
#settings_section? ⇒ Boolean
Returns true if the current controller happens to be one of the controllers that deals with settings.
-
#show_admin_menu_items? ⇒ Boolean
Returns true if we ought to show the user Admin-only areas of the menu.
-
#show_configuration? ⇒ Boolean
Returns true if we ought to show the user the ‘Configuration’ section of the menu.
Methods inherited from Hyrax::MenuPresenter
#collapsable_section, #initialize, #nav_link, #user_activity_section?
Constructor Details
This class inherits a constructor from Hyrax::MenuPresenter
Instance Method Details
#cdm_migrator_section? ⇒ Boolean
10 11 12 |
# File 'lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb', line 10 def cdm_migrator_section? %w[cdm csv].include?(controller_name) end |
#repository_activity_section? ⇒ Boolean
Returns true if the current controller happens to be one of the controllers that deals with repository activity This is used to keep the parent section on the sidebar open.
29 30 31 |
# File 'lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb', line 29 def repository_activity_section? %w[admin dashboard status].include?(controller_name) end |
#roles_and_permissions_section? ⇒ Boolean
Returns true if the current controller happens to be one of the controllers that deals with roles and permissions. This is used to keep the parent section on the sidebar open.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb', line 16 def # we're using a case here because we need to differentiate UsersControllers # in different namespaces (Hyrax & Admin) case controller when Hyrax::Admin::UsersController, ::Admin::GroupsController true else false end end |
#settings_section? ⇒ Boolean
Returns true if the current controller happens to be one of the controllers that deals with settings. This is used to keep the parent section on the sidebar open.
6 7 8 |
# File 'lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb', line 6 def settings_section? %w[appearances content_blocks labels features pages].include?(controller_name) end |
#show_admin_menu_items? ⇒ Boolean
Returns true if we ought to show the user Admin-only areas of the menu
43 44 45 |
# File 'lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb', line 43 def can?(:read, :admin_dashboard) end |
#show_configuration? ⇒ Boolean
Returns true if we ought to show the user the ‘Configuration’ section of the menu
35 36 37 38 39 40 |
# File 'lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb', line 35 def show_configuration? super || can?(:manage, Site) || can?(:manage, User) || can?(:manage, Hyku::Group) end |