Class: Locomotive::SnippetsController

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

Instance Method Summary collapse

Methods included from ActionController::Ssl

#require_ssl

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
# File 'app/controllers/locomotive/snippets_controller.rb', line 22

def create
  @snippet = current_site.snippets.create(params[:snippet])
  respond_with @snippet, location: edit_snippet_path(@snippet._id)
end

#destroyObject



38
39
40
41
42
# File 'app/controllers/locomotive/snippets_controller.rb', line 38

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

#editObject



27
28
29
30
# File 'app/controllers/locomotive/snippets_controller.rb', line 27

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



32
33
34
35
36
# File 'app/controllers/locomotive/snippets_controller.rb', line 32

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