Class: Locomotive::ThemeAssetsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/locomotive/theme_assets_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



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

def create
  @theme_asset = current_site.theme_assets.create(params[:theme_asset])
  respond_with @theme_asset, location: edit_theme_asset_path(@theme_asset._id)
end

#destroyObject



44
45
46
47
48
# File 'app/controllers/locomotive/theme_assets_controller.rb', line 44

def destroy
  @theme_asset = current_site.theme_assets.find(params[:id])
  @theme_asset.destroy
  respond_with @theme_asset
end

#editObject



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

def edit
  @theme_asset = current_site.theme_assets.find(params[:id])
  @theme_asset.performing_plain_text = true if @theme_asset.stylesheet_or_javascript?
  respond_with @theme_asset
end

#indexObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/locomotive/theme_assets_controller.rb', line 8

def index
  respond_to do |format|
    format.html {
      @assets             = ThemeAsset.all_grouped_by_folder(current_site)
      @js_and_css_assets  = (@assets[:javascripts] || []) + (@assets[:stylesheets] || [])
      @snippets           = current_site.snippets.order_by(:name.asc).all.to_a
      render
    }
    format.json {
      render json: current_site.theme_assets.by_content_type(params[:content_type])
    }
  end
end

#newObject



22
23
24
25
# File 'app/controllers/locomotive/theme_assets_controller.rb', line 22

def new
  @theme_asset = current_site.theme_assets.build(params[:id])
  respond_with @theme_asset
end

#updateObject



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

def update
  @theme_asset = current_site.theme_assets.find(params[:id])
  @theme_asset.update_attributes(params[:theme_asset])
  respond_with @theme_asset, location: edit_theme_asset_path(@theme_asset._id)
end