Class: RubberRing::CmsController

Inherits:
RubberRingController show all
Includes:
Build, Publish, Util
Defined in:
app/controllers/rubber_ring/cms_controller.rb

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

run!

Methods inherited from RubberRingController

#build, #load_page_content, #publish, #respond, #set_locale

Instance Method Details

#add_templateObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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}

   = {
    'class'               => new_pt.tclass,
    'data-template-index' => new_pt.id,
    'data-template'       => new_pt.template
  }

  response = view_context.(new_pt.element, view_context.raw(template), )

  render :json => {new_template: response}
end

#removeObject



15
16
17
18
# File 'app/controllers/rubber_ring/cms_controller.rb', line 15

def remove
  page = Page.remove(@options, params[:key])
  respond(page)
end

#remove_templateObject



44
45
46
47
# File 'app/controllers/rubber_ring/cms_controller.rb', line 44

def remove_template
  page = Page.remove_template(@options)
  respond(page)
end

#saveObject



10
11
12
13
# File 'app/controllers/rubber_ring/cms_controller.rb', line 10

def save
  page = Util.save_page_content(params)
  respond(page)
end

#save_templateObject



20
21
22
23
# File 'app/controllers/rubber_ring/cms_controller.rb', line 20

def save_template
  page = Page.save_or_update_templates(@options)
  respond(page)
end