Class: Flms::BlocksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/flms/blocks_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#with_format

Instance Method Details

#createObject



31
32
33
34
35
36
37
38
39
# File 'app/controllers/flms/blocks_controller.rb', line 31

def create
  @block = Block.new(params[:block])

  if @block.save
    redirect_to blocks_path, notice: 'Block created.'
  else
    render action: "new"
  end
end

#destroyObject



49
50
51
52
# File 'app/controllers/flms/blocks_controller.rb', line 49

def destroy
  @block.destroy
  redirect_to blocks_path, notice: 'Block deleted'
end

#editObject



28
29
# File 'app/controllers/flms/blocks_controller.rb', line 28

def edit
end

#indexObject



10
11
12
# File 'app/controllers/flms/blocks_controller.rb', line 10

def index
  @blocks = Block.all
end

#newObject



24
25
26
# File 'app/controllers/flms/blocks_controller.rb', line 24

def new
  @block = Block.new
end

#showObject



14
15
16
17
18
19
20
21
22
# File 'app/controllers/flms/blocks_controller.rb', line 14

def show
  respond_to do |format|
    format.plain_html { with_format('html') { render partial: 'flms/elements/block',
                                                     layout: 'flms/plain_styling',
                                                     locals: { block: @block, scroll_offset: 0 } } }
    format.html
    format.json { render json: @page }
  end
end

#updateObject



41
42
43
44
45
46
47
# File 'app/controllers/flms/blocks_controller.rb', line 41

def update
  if @block.update_attributes(params[:block])
    redirect_to blocks_path, notice: 'Block was successfully updated.'
  else
    render action: "edit"
  end
end