Class: Hyrax::Admin::PermissionTemplatesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/hyrax/admin/permission_templates_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.local_prefixesObject

Override the default prefixes so that we use the collection partals.



9
10
11
# File 'app/controllers/hyrax/admin/permission_templates_controller.rb', line 9

def self.local_prefixes
  ["hyrax/admin/admin_sets"]
end

Instance Method Details

#updateObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/hyrax/admin/permission_templates_controller.rb', line 13

def update
  update_info = form.update(update_params)
  if update_info[:updated] == true # Ensure we redirect to currently active tab with the appropriate notice
    redirect_to(edit_admin_admin_set_path(params[:admin_set_id], anchor: current_tab),
                notice: translate(update_info[:content_tab], scope: 'hyrax.admin.admin_sets.form.permission_update_notices'))
  else
    # When we have invalid data, we are redirecting because to render, we need to set an AdminSetForm
    # (because we are rendering admin set forms)
    # TODO: [Jeremy Friesen says: We need to better consolidate the form logic of admin sets and permission templates
    redirect_to(edit_admin_admin_set_path(params[:admin_set_id], anchor: current_tab),
                alert: translate(update_info[:error_code], scope: 'hyrax.admin.admin_sets.form.permission_update_errors'))
  end
end