Class: Workarea::Admin::HelpAssetsController

Inherits:
ApplicationController show all
Includes:
HelpAuthorization
Defined in:
app/controllers/workarea/admin/help_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



14
15
16
17
18
# File 'app/controllers/workarea/admin/help_assets_controller.rb', line 14

def create
  Help::Asset.create!(params[:help_asset])
  flash[:success] = t('workarea.admin.help_assets.flash_messages.created')
  redirect_back fallback_location: help_assets_path
end

#destroyObject



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

def destroy
  Help::Asset.find(params[:id]).destroy
  flash[:success] = t('workarea.admin.help_assets.flash_messages.removed')
  redirect_back fallback_location: help_assets_path
end

#indexObject



6
7
8
9
10
11
12
# File 'app/controllers/workarea/admin/help_assets_controller.rb', line 6

def index
  @help_assets =
    Help::Asset
      .desc(:created_at)
      .page(params[:page] || 1)
      .per(Workarea.config.per_page)
end