Sha256: 6a43aeb0bac2eb9ba0066f134b9c03da1a763a326be0fdc8d6b52040d9b2acb8

Contents?: true

Size: 1.31 KB

Versions: 33

Compression:

Stored size: 1.31 KB

Contents

class CompsController < ArtfullyOseController
  def new
    @show = Show.find(params[:show_id])
    @selected_tickets = params[:selected_tickets]

    @comp = Comp.new(@show, @selected_tickets, nil, current_user)
    render :new
  end

  def create
    @show = Show.find(params[:show_id])
    @selected_tickets = params[:selected_tickets]
    @comp = Comp.new(@show, @selected_tickets, params[:person_id], current_user)
    unless @comp.valid?
       flash[:alert] = @comp.errors.full_messages.to_sentence
       render :new and return
    end

    @comp.reason = params[:reason_for_comp]

    with_confirmation_comp do
      @comp.submit
      if @comp.uncomped_count > 0
        flash[:alert] = "Comped #{to_plural(@comp.comped_count, 'ticket')}. #{to_plural(@comp.uncomped_count, 'ticket')} could not be comped."
      else
        flash[:notice] = "Comped #{to_plural(@comp.comped_count, 'ticket')}."
      end

      redirect_to event_show_url(@show.event, @show)
    end
  end

  def with_confirmation_comp
    if params[:confirmed].blank?
      flash[:info] = "Please confirm your changes before we save them."
      render 'comp_confirm' and return
    else
      yield
    end
  end

  private

  def recipients
    Person.search_index(params[:terms].dup, current_user.current_organization) unless params[:terms].blank?
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
artfully_ose-1.2.0 app/controllers/comps_controller.rb
artfully_ose-1.2.0.beta.1 app/controllers/comps_controller.rb
artfully_ose-1.2.0.alpha.2 app/controllers/comps_controller.rb
artfully_ose-1.2.0.alpha.1 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.27 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.26 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.24 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.23 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.21 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.20 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.19 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.18 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.17 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.16 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.15 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.12 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.11 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.10 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.9 app/controllers/comps_controller.rb
artfully_ose-1.2.0.pre.8 app/controllers/comps_controller.rb