Sha256: d43b709c63b8edb0768d9124d6cd4e8151bb6efa24d2c21de574864cd3820d3f

Contents?: true

Size: 1.5 KB

Versions: 19

Compression:

Stored size: 1.5 KB

Contents

module Pulitzer
  class CustomOptionListsController < ApplicationController
    before_action :get_custom_option_list, except: [:index,:new, :create]

    def index
      @custom_option_lists = CustomOptionList.all
      render_ajax
    end

    def new
      @custom_option_list = CustomOptionList.new(custom_option_list_params)
      render_ajax locals: { custom_option_list: @custom_option_list }
    end

    def edit
      render_ajax locals: { custom_option_list: @custom_option_list }
    end

    def show
      render_ajax locals: { custom_option_list: @custom_option_list }
    end

    def create
      @custom_option_list = CustomOptionList.new(custom_option_list_params)
      if @custom_option_list.save
        render partial: 'show_wrapper', locals: { custom_option_list: @custom_option_list }
      else
        render partial: 'new', locals: { custom_option_list: @custom_option_list }, status: 409
      end
    end

    def update
      if @custom_option_list.update_attributes(custom_option_list_params)
        render partial: 'show', locals: { custom_option_list: @custom_option_list }
      else
        render partial: 'edit', locals: { custom_option_list: @custom_option_list }, status: 409
      end
    end

    def destroy
      @custom_option_list.destroy
      head :ok and return
    end

    protected

    def custom_option_list_params
      params[:custom_option_list].permit!
    end

    def get_custom_option_list
      @custom_option_list = CustomOptionList.find(params[:id])
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pulitzer-0.15.31 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.30 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.29 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.28 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.27 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.26 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.25 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.24 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.23 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.22 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.21 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.20 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.19 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.18 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.17 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.16 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.15 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.14 app/controllers/pulitzer/custom_option_lists_controller.rb
pulitzer-0.15.13 app/controllers/pulitzer/custom_option_lists_controller.rb