Class: RubberRing::CmsController
Instance Method Summary
collapse
Methods included from Util
get_attachment_directories, get_options_from_params, load_attachments_page, move_file, save_file_to_fs, save_page_content
Methods included from Publish
assets!
Methods included from Build
assets!
#expire_and_respond, #load_page_content, #set_locale
Instance Method Details
#add_template ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/rubber_ring/cms_controller.rb', line 25
def add_template
page, new_pt = Page.add_template(@options)
key_prefix = view_context.build_key_prefix(new_pt, new_pt.key)
template = render_to_string :partial => "templates/#{new_pt.template}",
:layout => false,
:locals => {:page => page, :key_prefix => key_prefix}
content_tag_options = {
'class' => new_pt.tclass,
'data-template-index' => new_pt.id,
'data-template' => new_pt.template
}
response = view_context.content_tag(new_pt.element, view_context.raw(template), content_tag_options)
expire_page(params[:page_path])
render :json => {new_template: response}
end
|
#remove ⇒ Object
15
16
17
18
|
# File 'app/controllers/rubber_ring/cms_controller.rb', line 15
def remove
page = Page.remove(@options, params[:key])
expire_and_respond(page)
end
|
#remove_template ⇒ Object
45
46
47
48
|
# File 'app/controllers/rubber_ring/cms_controller.rb', line 45
def remove_template
page = Page.remove_template(@options)
expire_and_respond(page)
end
|
#save ⇒ Object
10
11
12
13
|
# File 'app/controllers/rubber_ring/cms_controller.rb', line 10
def save
page = Util.save_page_content(params)
expire_and_respond(page)
end
|
#save_template ⇒ Object
20
21
22
23
|
# File 'app/controllers/rubber_ring/cms_controller.rb', line 20
def save_template
page = Page.save_or_update_templates(@options)
expire_and_respond(page)
end
|