class Hyku::MenuPresenter

view-model for the admin menu

Public Instance Methods

cdm_migrator_section?() click to toggle source
# 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?() click to toggle source

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.

# 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?() click to toggle source

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.

# File lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb, line 16
def roles_and_permissions_section?
  # 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?() click to toggle source

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.

# 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?() click to toggle source

Returns true if we ought to show the user Admin-only areas of the menu

# File lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb, line 43
def show_admin_menu_items?
  can?(:read, :admin_dashboard)
end
show_configuration?() click to toggle source

Returns true if we ought to show the user the 'Configuration' section of the menu

# 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