Class: Workarea::Admin::ContentAssetsController
Instance Method Summary
collapse
#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
#create ⇒ Object
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
|
#destroy ⇒ Object
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
|
#edit ⇒ Object
41
|
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 41
def edit; end
|
#index ⇒ Object
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
|
#new ⇒ Object
30
|
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 30
def new; end
|
#show ⇒ Object
27
28
|
# File 'app/controllers/workarea/admin/content_assets_controller.rb', line 27
def show
end
|
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
|
#update ⇒ Object
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
|