Class: Backend::Content::Rows::ColumnsController

Inherits:
BaseController
  • Object
show all
Includes:
Concerns::Backend::PositionableController
Defined in:
app/controllers/backend/content/rows/columns_controller.rb

Instance Method Summary collapse

Methods included from Concerns::Backend::PositionableController

#update_position

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/backend/content/rows/columns_controller.rb', line 12

def create
  @column = @row.columns.new allowed_params

  if @column.save
    @column.content = @column.content_type.constantize.create!
    @column.save!

    redirect_to_edit @column
  else
    render :new
  end
end

#destroyObject



33
34
35
36
37
38
# File 'app/controllers/backend/content/rows/columns_controller.rb', line 33

def destroy
  @column.destroy

  path = "edit_translation_backend_#{@column.row.rowable.class.to_s.underscore}_path"
  redirect_to send(path, @column.row.rowable, @column.row.locale, anchor: "content-row-#{@column.row.id}")
end

#newObject



8
9
10
# File 'app/controllers/backend/content/rows/columns_controller.rb', line 8

def new
  @column = @row.columns.new(@row.column_width_calculator.hashed_values)
end

#updateObject



25
26
27
28
29
30
31
# File 'app/controllers/backend/content/rows/columns_controller.rb', line 25

def update
  if @column.update_attributes allowed_params
    render 'backend/lightbox_saved'
  else
    render :edit
  end
end