Sha256: 308cd5373f685bd6216188e532ccf6a25ee593d403ce24e50be30802b91a550c

Contents?: true

Size: 1.42 KB

Versions: 6

Compression:

Stored size: 1.42 KB

Contents

class Plugins::Ecommerce::Admin::ShippingMethodsController < Plugins::Ecommerce::AdminController
  before_action :set_order, only: ['show','edit','update','destroy']

  def index
    @shipping_methods = current_site.shipping_methods.paginate(:page => params[:page], :per_page => current_site.admin_per_page)
  end

  def new
    @shipping_method = current_site.shipping_methods.new
    add_breadcrumb("#{t('plugins.ecommerce.new')}")
    render 'form'
  end

  def show
    add_breadcrumb("#{t('plugins.ecommerce.table.details')}")
  end

  def edit
    add_breadcrumb("#{t('camaleon_cms.admin.button.edit')}")
    render 'form'
  end

  def create
    @shipping_method = current_site.shipping_methods.new(shipping_permit_data)
    if @shipping_method.save
      @shipping_method.set_meta('_default',params[:options])
      flash[:notice] = t('camaleon_cms.admin.post_type.message.created')
      redirect_to action: :index
    else
      render 'form'
    end
  end

  def update
    if @shipping_method.update(shipping_permit_data)
      @shipping_method.set_meta('_default',params[:options])
      flash[:notice] = t('camaleon_cms.admin.post_type.message.updated')
      redirect_to action: :index
    else
      render 'form'
    end
  end


  private
  def set_order
    @shipping_method = current_site.shipping_methods.find(params[:id])
  end

  def shipping_permit_data
    params.require(:plugins_ecommerce_shipping_method).permit!
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
camaleon_ecommerce-2.0.4 app/controllers/plugins/ecommerce/admin/shipping_methods_controller.rb
camaleon_ecommerce-2.0.3 app/controllers/plugins/ecommerce/admin/shipping_methods_controller.rb
camaleon_ecommerce-2.0.2 app/controllers/plugins/ecommerce/admin/shipping_methods_controller.rb
camaleon_ecommerce-2.0.1 app/controllers/plugins/ecommerce/admin/shipping_methods_controller.rb
camaleon_ecommerce-2.0.0 app/controllers/plugins/ecommerce/admin/shipping_methods_controller.rb
camaleon_ecommerce-1.2.1 app/controllers/plugins/ecommerce/admin/shipping_methods_controller.rb