Sha256: c3cad36b7d9763be38e979f912f663f72b9ea33ffc75955e0aa59ecea4624fde
Contents?: true
Size: 1.22 KB
Versions: 45
Compression:
Stored size: 1.22 KB
Contents
class Pulitzer::FreeFormSectionTypesController < Pulitzer::ApplicationController before_filter :get_ffst, only: [:show, :edit, :update, :destroy] def new @post_type = Pulitzer::PostType.find(params[:post_type_id]) @ffst = @post_type.free_form_section_types.build render partial: 'new', locals: {ffst: @ffst} end def create @post_type = Pulitzer::PostType.find(ffst_params[:post_type_id]) @ffst = @post_type.free_form_section_types.create(ffst_params) Pulitzer::CreatePostTypeFreeFormSections.new(@ffst).call render partial: 'show_wrapper', locals: {ffst: @ffst} end def show render partial: 'show', locals: {ffst: @ffst} end def edit render partial: 'form', locals: {ffst: @ffst} end def update old_label = @ffst.name @ffst.update_attributes(ffst_params) Pulitzer::UpdatePostTypeFreeFormSections.new(@ffst, old_label).call render partial: 'show', locals: {ffst: @ffst} end def destroy @ffst.destroy Pulitzer::DestroyPostTypeFreeFormSections.new(@ffst).call render nothing: true end protected def get_ffst @ffst = Pulitzer::FreeFormSectionType.find(params[:id]) end def ffst_params params[:free_form_section_type].permit! end end
Version data entries
45 entries across 45 versions & 1 rubygems