Sha256: 27727018ef44d9265d766dd15a8040313c0ad1d2b810f524f03baf523253a39c

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

class Store::OrdersController < Store::StoreController
  include ActionView::Helpers::TextHelper
  include ArtfullyOseHelper
  
  def update
    handler = OrderHandler.new(current_cart)
    handler.handle_tickets(params)    
    handler.handle_donation(params, @store_organization)
    handler.handle_memberships(params)
    handler.handle_discount(params)

    flash[:alert] = handler.error unless handler.error.blank?

    redirect_to store_order_path
  end

  def show

    @special_instructions_hash = {}
    current_cart.tickets.each do |ticket|
      event = ticket.event
      if event.show_special_instructions?
        @special_instructions_hash[event.id] = event.special_instructions_caption
      end
    end
  end

  def destroy
    current_cart.clear!
    flash[:notice] = "Your cart is empty."
    redirect_to (session[:last_event_id].blank? ? store_order_path : store_old_storefront_event_url(session[:last_event_id]))
  end

  private

    #
    # The storefront javascript depends on this total_string to determine 
    # if this is a free order or not. Don't re-word this string without also
    # addressing the javascript in store.js
    #
    def total_string
      "#{pluralize(current_cart.items.length, 'item')}, #{number_as_cents current_cart.total}"
    end

    def event
      current_cart.tickets.first.event
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.3 app/controllers/store/orders_controller.rb
artfully_ose-1.2.0.pre.2 app/controllers/store/orders_controller.rb
artfully_ose-1.2.0.pre.1 app/controllers/store/orders_controller.rb
artfully_ose-1.2.0.pre app/controllers/store/orders_controller.rb