Class: Backend::Content::RowsController
- Inherits:
-
BaseController
- Object
- BaseController
- Backend::Content::RowsController
- Defined in:
- app/controllers/backend/content/rows_controller.rb
Instance Method Summary collapse
- #destroy ⇒ Object
- #horizontal_alignment ⇒ Object
- #new ⇒ Object
- #toggle_full_width ⇒ Object
- #update ⇒ Object
- #vertical_alignment ⇒ Object
Methods included from Concerns::Backend::PositionableController
Instance Method Details
#destroy ⇒ Object
46 47 48 49 |
# File 'app/controllers/backend/content/rows_controller.rb', line 46 def destroy @row.destroy redirect_back_to_content('content-rows') end |
#horizontal_alignment ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/controllers/backend/content/rows_controller.rb', line 25 def horizontal_alignment align = params[:align].to_s align = 'left' unless %w(left center right).include?(align) @row.update_attribute :horizontal_alignment, align redirect_back_to_content end |
#new ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/backend/content/rows_controller.rb', line 6 def new if params[:klass] && params[:id] && params[:locale] instance = params[:klass].constantize.find params[:id] row = instance.content_rows.create!(locale: params[:locale]) redirect_to content_path(instance, params[:locale], "content-row-#{row.id}") else render text: 'Insufficient params. Please provide klass, id and locale.' end end |
#toggle_full_width ⇒ Object
41 42 43 44 |
# File 'app/controllers/backend/content/rows_controller.rb', line 41 def toggle_full_width @row.update_attribute :full_width, !@row.full_width? redirect_back_to_content end |
#update ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/controllers/backend/content/rows_controller.rb', line 17 def update if @row.update_attributes allowed_params render 'backend/lightbox_saved' else render :edit end end |
#vertical_alignment ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/controllers/backend/content/rows_controller.rb', line 33 def vertical_alignment align = params[:align].to_s align = 'top' unless %w(top center bottom).include?(align) @row.update_attribute :vertical_alignment, align redirect_back_to_content end |