Class: Cmsimple::SnippetsController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/cmsimple/snippets_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
# File 'app/controllers/cmsimple/snippets_controller.rb', line 4

def index
  render :index, layout: false
end

#optionsObject



13
14
15
16
17
18
19
20
# File 'app/controllers/cmsimple/snippets_controller.rb', line 13

def options
  # the options prefix is to handle legacy snippets mercury
  # changed how it serializes snippets
  @options = params[:options][:snippet] if params[:options]
  @options ||= params[:snippet]
  @snippet = Cmsimple::Snippet.new params[:name], options: @options
  render text: render_cell(params[:name], :options, @snippet)
end

#previewObject



8
9
10
11
# File 'app/controllers/cmsimple/snippets_controller.rb', line 8

def preview
  @snippet = Cmsimple::Snippet.new params[:name], options: params[:snippet]
  render text: render_cell(params[:name], :preview, @snippet)
end