Class: Locomotive::SnippetsController

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

Instance Method Summary collapse

Methods included from ActionController::UrlHelpers

#current_site_public_url, #public_page_url, #switch_to_site_url

Methods included from ActionController::SectionHelpers

#sections

Methods included from ActionController::LocaleHelpers

#back_to_default_site_locale, #current_content_locale, #localized?, #set_back_office_locale, #set_current_content_locale, #setup_i18n_fallbacks

Instance Method Details

#createObject



22
23
24
25
26
27
# File 'app/controllers/locomotive/snippets_controller.rb', line 22

def create
  @snippet = current_site.snippets.new
  @snippet_presenter = @snippet.to_presenter
  @snippet_presenter.update_attributes(params[:snippet])
  respond_with @snippet, :location => edit_snippet_url(@snippet._id)
end

#destroyObject



40
41
42
43
44
# File 'app/controllers/locomotive/snippets_controller.rb', line 40

def destroy
  @snippet = current_site.snippets.find(params[:id])
  @snippet.destroy
  respond_with @snippet, :location => theme_assets_url
end

#editObject



29
30
31
32
# File 'app/controllers/locomotive/snippets_controller.rb', line 29

def edit
  @snippet = current_site.snippets.find(params[:id])
  respond_with @snippet
end

#newObject



12
13
14
15
# File 'app/controllers/locomotive/snippets_controller.rb', line 12

def new
  @snippet = current_site.snippets.new
  respond_with @snippet
end

#showObject



17
18
19
20
# File 'app/controllers/locomotive/snippets_controller.rb', line 17

def show
  @snippet = current_site.snippets.find(params[:id])
  respond_with @snippet
end

#updateObject



34
35
36
37
38
# File 'app/controllers/locomotive/snippets_controller.rb', line 34

def update
  @snippet = current_site.snippets.find(params[:id])
  @snippet.update_attributes(params[:snippet])
  respond_with @snippet, :location => edit_snippet_url(@snippet._id)
end