Class: Hyrax::Admin::AdminSetsController

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CollectionsControllerBehavior

#after_create, #after_create_error, #after_destroy, #after_destroy_error, #after_update, #after_update_error, #collection, #deny_collection_access

Class Method Details

.local_prefixesObject

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



82
83
84
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 82

def self.local_prefixes
  ["hyrax/admin/admin_sets", "hyrax/collections", 'catalog']
end

Instance Method Details

#createObject



59
60
61
62
63
64
65
66
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 59

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

#destroyObject



68
69
70
71
72
73
74
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 68

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.full_messages.to_sentence
  end
end

#editObject



46
47
48
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 46

def edit
  setup_form
end

#indexObject



35
36
37
38
39
40
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 35

def index
  add_breadcrumb t(:'hyrax.controls.home'), root_path
  add_breadcrumb t(:'hyrax.toolbar.admin.menu'), hyrax.admin_path
  add_breadcrumb t(:'hyrax.admin.sidebar.admin_sets'), hyrax.admin_admin_sets_path
  @admin_sets = Hyrax::AdminSetService.new(self).search_results(:read)
end

#newObject



42
43
44
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 42

def new
  setup_form
end

#repositoryObject

for the AdminSetService



77
78
79
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 77

def repository
  repository_class.new(blacklight_config)
end

#showObject



27
28
29
30
31
32
33
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 27

def show
  add_breadcrumb t(:'hyrax.controls.home'), root_path
  add_breadcrumb t(:'hyrax.toolbar.admin.menu'), hyrax.admin_path
  add_breadcrumb t(:'hyrax.admin.sidebar.admin_sets'), hyrax.admin_admin_sets_path
  add_breadcrumb t(:'hyrax.admin.admin_sets.show.breadcrumb'), request.path
  super
end

#updateObject



50
51
52
53
54
55
56
57
# File 'app/controllers/hyrax/admin/admin_sets_controller.rb', line 50

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