Class: OaiConfigController

Inherits:
ApplicationController show all
Defined in:
frontend/app/controllers/oai_config_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#archivesspace, can_access?, permission_mappings, set_access_control

Instance Method Details

#current_recordObject



25
26
27
# File 'frontend/app/controllers/oai_config_controller.rb', line 25

def current_record
  @oai_config
end

#editObject



5
6
7
8
# File 'frontend/app/controllers/oai_config_controller.rb', line 5

def edit
  @oai_config = JSONModel(:oai_config).all.first
  @repositories = JSONModel(:repository).all
end

#updateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'frontend/app/controllers/oai_config_controller.rb', line 10

def update
  handle_oai_config_params(params)
  @oai_config = JSONModel(:oai_config).all.first

  handle_crud(:instance => :oai_config,
              :model => JSONModel(:oai_config),
              :replace => false,
              :obj => @oai_config,
              :on_invalid => ->() { return render :action => :edit },
              :on_valid => ->(id) {
                flash[:success] = t("oai_config._frontend.action.updated")
                redirect_to :controller => :oai_config, :action => :edit
              })
end