Class: Lcms::Engine::Admin::AccessCodesController

Inherits:
AdminController show all
Defined in:
app/controllers/lcms/engine/admin/access_codes_controller.rb

Constant Summary

Constants inherited from AdminController

Lcms::Engine::Admin::AdminController::RE_GOOGLE_FOLDER

Instance Method Summary collapse

Methods inherited from AdminController

settings

Methods included from PathHelper

#dynamic_document_path, #dynamic_material_path, #dynamic_path

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
# File 'app/controllers/lcms/engine/admin/access_codes_controller.rb', line 9

def create
  @access_code = AccessCode.new(permitted_params)
  if @access_code.save
    redirect_to lcms_engine.admin_access_codes_path, notice: t('.success')
  else
    render :new
  end
end

#destroyObject



18
19
20
21
# File 'app/controllers/lcms/engine/admin/access_codes_controller.rb', line 18

def destroy
  @access_code.destroy
  redirect_to lcms_engine.admin_access_codes_path, notice: t('.success')
end

#editObject



23
24
25
# File 'app/controllers/lcms/engine/admin/access_codes_controller.rb', line 23

def edit
  @url = lcms_engine.admin_access_code_path(@access_code)
end

#indexObject



27
28
29
# File 'app/controllers/lcms/engine/admin/access_codes_controller.rb', line 27

def index
  @access_codes = AccessCode.order(code: :asc).paginate(page: params[:page])
end

#newObject



31
32
33
# File 'app/controllers/lcms/engine/admin/access_codes_controller.rb', line 31

def new
  @access_code = AccessCode.new
end

#updateObject



35
36
37
38
39
40
41
42
# File 'app/controllers/lcms/engine/admin/access_codes_controller.rb', line 35

def update
  if @access_code.update(permitted_params)
    redirect_to lcms_engine.admin_access_codes_path, notice: t('.success')
  else
    @url = lcms_engine.admin_access_code_path(@access_code)
    render :edit
  end
end