Class: SimpleBlocksController

Inherits:
AdminController show all
Defined in:
app/controllers/simple_blocks_controller.rb

Overview

Managing simple_blocks

Instance Method Summary collapse

Instance Method Details

#checkObject

post /simple_blocks/check



8
9
10
11
12
# File 'app/controllers/simple_blocks_controller.rb', line 8

def check
  @entity = SimpleBlock.instance_for_check(params[:entity_id], entity_parameters)

  render 'shared/forms/check'
end

#createObject

post /simple_blocks



20
21
22
23
24
25
26
27
# File 'app/controllers/simple_blocks_controller.rb', line 20

def create
  @entity = SimpleBlock.new(entity_parameters)
  if @entity.save
    form_processed_ok(admin_simple_block_path(id: @entity.id))
  else
    form_processed_with_error(:new)
  end
end

#destroyObject

delete /simple_blocks/:id



43
44
45
46
47
# File 'app/controllers/simple_blocks_controller.rb', line 43

def destroy
  flash[:notice] = t('simple_blocks.destroy.success') if @entity.destroy

  redirect_to(admin_simple_blocks_path)
end

#editObject

get /simple_blocks/:id/edit



30
31
# File 'app/controllers/simple_blocks_controller.rb', line 30

def edit
end

#newObject

get /simple_blocks/new



15
16
17
# File 'app/controllers/simple_blocks_controller.rb', line 15

def new
  @entity = SimpleBlock.new
end

#updateObject

patch /simple_blocks/:id



34
35
36
37
38
39
40
# File 'app/controllers/simple_blocks_controller.rb', line 34

def update
  if @entity.update(entity_parameters)
    form_processed_ok(admin_simple_block_path(id: @entity.id))
  else
    form_processed_with_error(:edit)
  end
end