Class: Alchemy::Admin::ContentsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- BaseController
- Alchemy::Admin::ContentsController
- Defined in:
- app/controllers/alchemy/admin/contents_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods included from Modules
included, #module_definition_for, register_module
Methods included from Alchemy::AbilityHelper
Methods included from ConfigurationMethods
#configuration, #multi_language?, #multi_site?, #prefix_locale?
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/alchemy/admin/contents_controller.rb', line 10 def create @element = Element.find(params[:content][:element_id]) @content = Content.create_from_scratch(@element, content_params) @html_options = params[:html_options] || {} if picture_gallery_editor? @content.update_essence(picture_id: params[:picture_id]) @gallery_pictures = @element.contents.gallery_pictures [:sortable] = @gallery_pictures.size > 1 @content_dom_id = "#add_picture_#{@element.id}" else @content_dom_id = "#add_content_for_element_#{@element.id}" end end |
#order ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/controllers/alchemy/admin/contents_controller.rb', line 24 def order Content.transaction do params[:content_ids].each_with_index do |id, idx| Content.where(id: id).update_all(position: idx + 1) end end @notice = Alchemy.t("Successfully saved content position") end |