Class: DmCms::Admin::CmsContentitemsController
- Inherits:
-
AdminController
- Object
- AdminController
- DmCms::Admin::CmsContentitemsController
- Includes:
- PermittedParams, DmCore::LiquidHelper
- Defined in:
- app/controllers/dm_cms/admin/cms_contentitems_controller.rb
Instance Method Summary collapse
-
#create_content ⇒ Object
——————————————————————————.
-
#destroy ⇒ Object
——————————————————————————.
-
#edit ⇒ Object
——————————————————————————.
-
#markdown ⇒ Object
——————————————————————————.
-
#move_down ⇒ Object
——————————————————————————.
-
#move_up ⇒ Object
——————————————————————————.
-
#new_content ⇒ Object
——————————————————————————.
-
#update ⇒ Object
——————————————————————————.
-
#update_fragment ⇒ Object
——————————————————————————.
Methods included from PermittedParams
#cms_blog_params, #cms_contentitem_params, #cms_page_params, #cms_post_params, #cms_snippet_params, #media_file_params
Instance Method Details
#create_content ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/dm_cms/admin/cms_contentitems_controller.rb', line 17 def create_content :manage_content, @current_page @cms_contentitem = @current_page.cms_contentitems.new(cms_contentitem_params) if @cms_contentitem.save redirect_to admin_cms_page_url(@current_page), notice: 'Content successfully created.' else render action: "new_content", notice: 'Content successfully created.' end end |
#destroy ⇒ Object
43 44 45 46 47 |
# File 'app/controllers/dm_cms/admin/cms_contentitems_controller.rb', line 43 def destroy :manage_content, @current_page @cms_contentitem.destroy redirect_to(:controller => 'dm_cms/admin/cms_pages', :action => :show, :id => @cms_contentitem.cms_page_id) end |
#edit ⇒ Object
28 29 30 |
# File 'app/controllers/dm_cms/admin/cms_contentitems_controller.rb', line 28 def edit :manage_content, @current_page end |
#markdown ⇒ Object
75 76 77 78 79 80 |
# File 'app/controllers/dm_cms/admin/cms_contentitems_controller.rb', line 75 def markdown @text = '' if put_or_post? @text = params[:sample_text][:markdown] end end |
#move_down ⇒ Object
68 69 70 71 72 |
# File 'app/controllers/dm_cms/admin/cms_contentitems_controller.rb', line 68 def move_down :manage_content, @current_page @cms_contentitem.update_attributes(row_order_position: :down) redirect_to(:controller => 'dm_cms/admin/cms_pages', :action => :show, :id => @cms_contentitem.cms_page_id) end |
#move_up ⇒ Object
61 62 63 64 65 |
# File 'app/controllers/dm_cms/admin/cms_contentitems_controller.rb', line 61 def move_up :manage_content, @current_page @cms_contentitem.update_attributes(row_order_position: :up) redirect_to(:controller => 'dm_cms/admin/cms_pages', :action => :show, :id => @cms_contentitem.cms_page_id) end |
#new_content ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/dm_cms/admin/cms_contentitems_controller.rb', line 10 def new_content :manage_content, @current_page @cms_contentitem = CmsContentitem.new @cms_contentitem.container = 'body' end |
#update ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/controllers/dm_cms/admin/cms_contentitems_controller.rb', line 33 def update :manage_content, @current_page if @cms_contentitem.update_attributes(cms_contentitem_params) redirect_to edit_admin_cms_contentitem_url(@cms_contentitem), notice: 'Content updated' else render :action => :edit, alert: 'An error of some kind occurred' end end |
#update_fragment ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/dm_cms/admin/cms_contentitems_controller.rb', line 50 def update_fragment :manage_content, @current_page if @cms_contentitem.update_attributes(cms_contentitem_params) #@cms_page.merge!(@item.cms_page.get_page_render_values) #respond_to do |format| # format.js { render :action => :update_fragment } #end end end |