Class: Workarea::Admin::ContentAssetsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/workarea/admin/content_assets_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model

Methods included from Publishing

#allow_publishing!, #allow_publishing?, #set_publishing_options

Methods included from Visiting

#most_visited

Instance Method Details

#createObject



32
33
34
35
36
37
38
39
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 32

def create
  if @asset.save
    flash[:success] = t('workarea.admin.content_assets.flash_messages.created')
    redirect_to content_asset_path(@asset)
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



52
53
54
55
56
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 52

def destroy
  @asset.destroy
  flash[:success] = t('workarea.admin.content_assets.flash_messages.removed')
  redirect_to content_assets_path
end

#editObject



41
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 41

def edit; end

#indexObject Also known as: insert



9
10
11
12
13
14
15
16
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 9

def index
  if Configuration::S3.configured? && !request.xhr?
    DirectUpload.ensure_cors!(request.url)
  end

  search = Search::AdminAssets.new(params)
  @search = Admin::SearchViewModel.new(search, view_model_options)
end

#newObject



30
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 30

def new; end

#showObject



27
28
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 27

def show
end

#tagsObject



19
20
21
22
23
24
25
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 19

def tags
  @tags = if Content::Asset.empty?
            []
          else
            Content::Asset.all_tags(type: params[:type])
          end
end

#updateObject



43
44
45
46
47
48
49
50
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 43

def update
  if @asset.update_attributes(params[:asset])
    flash[:success] = t('workarea.admin.content_assets.flash_messages.saved')
    redirect_to content_asset_path(@asset)
  else
    render :edit, status: :unprocessable_entity
  end
end