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



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

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



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

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

#editObject



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

def edit; end

#indexObject Also known as: insert



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

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

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

#newObject



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

def new; end

#showObject



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

def show
end

#tagsObject



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

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

#updateObject



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

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