Sha256: 48422322a5bcba56a2b10f5fd994f9f5d4502ef7474fdf988db6161d7bb54ae1

Contents?: true

Size: 1.53 KB

Versions: 9

Compression:

Stored size: 1.53 KB

Contents

module KktShoppe
  class DeliveryServicePricesController < KktShoppe::ApplicationController

    before_filter { @active_nav = :delivery_services }
    before_filter { @delivery_service = KktShoppe::DeliveryService.find(params[:delivery_service_id])}
    before_filter { params[:id] && @delivery_service_price = @delivery_service.delivery_service_prices.find(params[:id])}

    def index
      @delivery_service_prices = @delivery_service.delivery_service_prices.ordered
    end

    def new
      @delivery_service_price = @delivery_service.delivery_service_prices.build
    end

    def create
      @delivery_service_price = @delivery_service.delivery_service_prices.build(safe_params)
      if @delivery_service_price.save
        redirect_to [@delivery_service, :delivery_service_prices], :notice => t('kkt_shoppe.delivery_service_prices.create_notice')
      else
        render :action => "new"
      end
    end

    def update
      if @delivery_service_price.update(safe_params)
        redirect_to [@delivery_service, :delivery_service_prices], :notice => t('kkt_shoppe.delivery_service_prices.update_notice')
      else
        render :action => "edit"
      end
    end

    def destroy
      @delivery_service_price.destroy
      redirect_to [@delivery_service, :delivery_service_prices], :notice => t('kkt_shoppe.delivery_service_prices.destroy_notice')
    end

    private

    def safe_params
      params[:delivery_service_price].permit(:price, :cost_price, :tax_rate_id, :min_weight, :max_weight, :code, :country_ids => [])
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kkt_shoppe-2.0.2 app/controllers/kkt_shoppe/delivery_service_prices_controller.rb
kkt_shoppe-2.0.1 app/controllers/kkt_shoppe/delivery_service_prices_controller.rb
kkt_shoppe-2.0.0 app/controllers/kkt_shoppe/delivery_service_prices_controller.rb
kkt_shoppe-1.3.0 app/controllers/kkt_shoppe/delivery_service_prices_controller.rb
kkt_shoppe-1.2.1 app/controllers/kkt_shoppe/delivery_service_prices_controller.rb
kkt_shoppe-1.2.0 app/controllers/kkt_shoppe/delivery_service_prices_controller.rb
kkt_shoppe-1.1.2 app/controllers/kkt_shoppe/delivery_service_prices_controller.rb
kkt_shoppe-1.1.1 app/controllers/kkt_shoppe/delivery_service_prices_controller.rb
kkt_shoppe-1.1.0 app/controllers/kkt_shoppe/delivery_service_prices_controller.rb