Class: Workarea::Admin::ContentPresetsController

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



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/workarea/admin/content_presets_controller.rb', line 9

def create
  @preset = Content::Preset.new(params[:content_preset])
  @preset.apply_block(@block) if @block.present?

  if @preset.save
    flash[:success] = t('workarea.admin.content_presets.flash_messages.saved')

    if request.xhr?
      head :created
    else
      redirect_to return_to || edit_content_path(@content)
    end
  else
    flash[:error] = t('workarea.admin.content_presets.flash_messages.preset_error')
    head :unprocessable_entity
  end
end

#destroyObject



27
28
29
30
31
# File 'app/controllers/workarea/admin/content_presets_controller.rb', line 27

def destroy
  preset = Content::Preset.find(params[:id])
  preset.destroy
  head :no_content
end

#newObject



6
7
# File 'app/controllers/workarea/admin/content_presets_controller.rb', line 6

def new
end