Class: Hyrax::Admin::AdminSetsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Hyrax::Admin::AdminSetsController
- Includes:
- CollectionsControllerBehavior
- Defined in:
- app/controllers/hyrax/admin/admin_sets_controller.rb
Class Method Summary collapse
-
.local_prefixes ⇒ Object
Override the default prefixes so that we use the collection partals.
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
-
#files ⇒ Object
Renders a JSON response with a list of files in this admin set.
- #index ⇒ Object
- #new ⇒ Object
-
#repository ⇒ Object
for the AdminSetService.
- #show ⇒ Object
- #update ⇒ Object
Methods included from CollectionsControllerBehavior
Class Method Details
.local_prefixes ⇒ Object
Override the default prefixes so that we use the collection partals.
88 89 90 |
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 88 def self.local_prefixes ["hyrax/admin/admin_sets", "hyrax/collections", 'catalog'] end |
Instance Method Details
#create ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 65 def create if create_admin_set redirect_to hyrax.edit_admin_admin_set_path(@admin_set), notice: I18n.t('new_admin_set', scope: 'hyrax.admin.admin_sets.form.permission_update_notices', name: @admin_set.title.first) else setup_form render :new end end |
#destroy ⇒ Object
74 75 76 77 78 79 80 |
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 74 def destroy if @admin_set.destroy redirect_to hyrax.admin_admin_sets_path, notice: t(:'hyrax.admin.admin_sets.delete.notification') else redirect_to hyrax.admin_admin_set_path(@admin_set), alert: @admin_set.errors..to_sentence end end |
#edit ⇒ Object
43 44 45 |
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 43 def edit setup_form end |
#files ⇒ Object
Renders a JSON response with a list of files in this admin set. This is used by the edit form to populate the thumbnail_id dropdown
49 50 51 52 53 54 |
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 49 def files result = form.select_files.map do |label, id| { id: id, text: label } end render json: result end |
#index ⇒ Object
32 33 34 35 36 37 |
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 32 def index t(:'hyrax.controls.home'), root_path t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path t(:'hyrax.admin.sidebar.admin_sets'), hyrax.admin_admin_sets_path @admin_sets = Hyrax::AdminSetService.new(self).search_results(:edit) end |
#new ⇒ Object
39 40 41 |
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 39 def new setup_form end |
#repository ⇒ Object
for the AdminSetService
83 84 85 |
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 83 def repository repository_class.new(blacklight_config) end |
#show ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 24 def show t(:'hyrax.controls.home'), root_path t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path t(:'hyrax.admin.sidebar.admin_sets'), hyrax.admin_admin_sets_path t(:'hyrax.admin.admin_sets.show.breadcrumb'), request.path super end |
#update ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 56 def update if @admin_set.update(admin_set_params) redirect_to hyrax.edit_admin_admin_set_path(@admin_set), notice: I18n.t('updated_admin_set', scope: 'hyrax.admin.admin_sets.form.permission_update_notices', name: @admin_set.title.first) else setup_form render :edit end end |