Class: Kuhsaft::Cms::BricksController
Instance Method Summary
collapse
#set_content_locale, #url_options
Instance Method Details
#create ⇒ Object
7
8
9
10
11
|
# File 'app/controllers/kuhsaft/cms/bricks_controller.rb', line 7
def create
@brick = params[:brick][:type].constantize.new(params[:brick])
@brick.image_size = ImageSize.all.first.name.to_s
@brick.save(:validate => false)
end
|
#destroy ⇒ Object
28
29
30
31
32
|
# File 'app/controllers/kuhsaft/cms/bricks_controller.rb', line 28
def destroy
@brick = Kuhsaft::Brick.find(params[:id])
@parent_brick = @brick.brick_list
@brick.destroy
end
|
#sort ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'app/controllers/kuhsaft/cms/bricks_controller.rb', line 34
def sort
if params[:bricks].present?
params[:bricks][:ids].split(',').each_with_index do |id, idx|
Kuhsaft::Brick.find(id).update_attribute(:position, idx.to_i + 1)
end
end
render :nothing => true
end
|
#update ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/kuhsaft/cms/bricks_controller.rb', line 13
def update
@brick = Kuhsaft::Brick.find(params[:id])
@brick.update_attributes(params[:brick])
respond_with @brick do |format|
format.js
format.html { redirect_to edit_cms_page_path(@brick.parents.first) }
end
end
|