Class: DmCms::Admin::CmsSnippetsController

Inherits:
AdminController
  • Object
show all
Includes:
PermittedParams, DmCore::LiquidHelper
Defined in:
app/controllers/dm_cms/admin/cms_snippets_controller.rb

Instance Method Summary collapse

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

#createObject




20
21
22
23
24
25
26
27
# File 'app/controllers/dm_cms/admin/cms_snippets_controller.rb', line 20

def create
  @cms_snippet = CmsSnippet.new(cms_snippet_params)
  if @cms_snippet.save
    redirect_to admin_cms_snippets_url, notice: 'Snippet successfully created.'
  else
    render action: :new
  end
end

#destroyObject




43
44
45
46
# File 'app/controllers/dm_cms/admin/cms_snippets_controller.rb', line 43

def destroy
  @cms_snippet.destroy
  redirect_to admin_cms_snippets_url
end

#editObject




30
31
# File 'app/controllers/dm_cms/admin/cms_snippets_controller.rb', line 30

def edit
end

#indexObject




10
11
12
# File 'app/controllers/dm_cms/admin/cms_snippets_controller.rb', line 10

def index
  @cms_snippets = CmsSnippet.order('slug ASC')
end

#newObject




15
16
17
# File 'app/controllers/dm_cms/admin/cms_snippets_controller.rb', line 15

def new
  @cms_snippet = CmsSnippet.new
end

#updateObject




34
35
36
37
38
39
40
# File 'app/controllers/dm_cms/admin/cms_snippets_controller.rb', line 34

def update
  if @cms_snippet.update_attributes(cms_snippet_params)
    redirect_to admin_cms_snippets_url, notice: 'Content updated'
   else
    render :action => :edit, alert: 'An error of some kind occurred'
   end
end

#update_fragmentObject

todo



50
51
52
53
54
55
56
57
# File 'app/controllers/dm_cms/admin/cms_snippets_controller.rb', line 50

def update_fragment
  if @cms_snippet.update_attributes(cms_snippet_params)
    #@cms_page.merge!(@item.cms_page.get_page_render_values)
    #respond_to do |format| 
    #  format.js { render :action => :update_fragment } 
    #end
  end
end