Sha256: 4b49846ef8a89dcc801e4c5881e7e4603563cf1a5d67b843342dab93aa04fa68

Contents?: true

Size: 1.18 KB

Versions: 19

Compression:

Stored size: 1.18 KB

Contents

class Admin::CustomFieldsController < AdminController

  before_filter :load_custom_field, only: [:show, :edit, :update, :destroy]

  respond_to :html

  def index
    @custom_fields = CustomField.all
    respond_with @custom_fields
  end

  def edit
    respond_with @custom_field
  end

  def update
    if @custom_field.update_attributes(params[:custom_field])
      redirect_to admin_custom_fields_path, notice: t(:successfully_updated)
    else
      respond_with @custom_field
    end
  end

  def new
    @custom_field = CustomField.new
    respond_with @custom_field
  end

  def create
    @custom_field  = CustomField.new(params[:custom_field])
    if @custom_field.save
      redirect_to admin_custom_fields_url, notice: t(:successfully_added)
    else
      respond_with @custom_field
    end
  end

  def destroy
    respond_to do |format|
      format.html do
        if @custom_field.destroy
          redirect_to admin_custom_fields_path, notice: t(:successfully_deleted)
        else
          redirect_to admin_custom_fields_path, error: t(:could_not_delete)
        end
      end
    end
  end

  private

  def load_custom_field
    @custom_field = CustomField.find(params[:id])
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
nimbleshop_core-0.0.12 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.11 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.10 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.9 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.8 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.7 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.5 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.4.beta1 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.4 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.3 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.2 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.2.beta1 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.1 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.1.rc6 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.1.rc5 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.1.rc4 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.1.rc3 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.1.rc2 app/controllers/admin/custom_fields_controller.rb
nimbleshop_core-0.0.1.rc1 app/controllers/admin/custom_fields_controller.rb