Class: Nuntius::Admin::TemplatesController

Inherits:
Nuntius::ApplicationAdminController show all
Defined in:
app/controllers/nuntius/admin/templates_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
# File 'app/controllers/nuntius/admin/templates_controller.rb', line 19

def create
  @template = Nuntius::Template.new(template_params)
  @template.save
  respond_with :admin, @template, action: :edit
end

#destroyObject



39
40
41
42
43
# File 'app/controllers/nuntius/admin/templates_controller.rb', line 39

def destroy
  @template = Nuntius::Template.visible.find(params[:id])
  @template.destroy
  respond_with :admin, @template
end

#editObject



25
26
27
# File 'app/controllers/nuntius/admin/templates_controller.rb', line 25

def edit
  @template = Nuntius::Template.visible.find(params[:id])
end

#indexObject



10
11
12
# File 'app/controllers/nuntius/admin/templates_controller.rb', line 10

def index
  @templates = Nuntius::Template.visible.order(:description)
end

#newObject



14
15
16
17
# File 'app/controllers/nuntius/admin/templates_controller.rb', line 14

def new
  @template = Nuntius::Template.new
  render :edit
end

#showObject



29
30
31
# File 'app/controllers/nuntius/admin/templates_controller.rb', line 29

def show
  redirect_to :edit_admin_template, status: :see_other
end

#updateObject



33
34
35
36
37
# File 'app/controllers/nuntius/admin/templates_controller.rb', line 33

def update
  @template = Nuntius::Template.visible.find(params[:id])
  @template.update(template_params)
  respond_with :admin, @template
end