Class: EventsController
- Inherits:
-
ArtfullyOseController
- Object
- ActionController::Base
- ArtfullyOseController
- EventsController
- Defined in:
- app/controllers/events_controller.rb
Instance Method Summary collapse
- #assign ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #image ⇒ Object
- #index ⇒ Object
- #messages ⇒ Object
- #new ⇒ Object
- #prices ⇒ Object
- #resell ⇒ Object
- #show ⇒ Object
- #storefront_link ⇒ Object
- #temp_discount_form ⇒ Object
- #temp_discounts_index ⇒ Object
- #update ⇒ Object
- #widget ⇒ Object
- #wp_plugin ⇒ Object
Instance Method Details
#assign ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/events_controller.rb', line 59 def assign @event = Event.find(params[:event_id]) @chart = Chart.find(params[:chart][:id]) @event.assign_chart(@chart) flash[:error] = @event.errors..to_sentence unless @event.errors.empty? redirect_to event_url(@event) end |
#create ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/events_controller.rb', line 7 def create @event = Event.new(params[:event]) @templates = current_organization.charts.template @event.organization_id = current_organization.id @event.is_free = !(current_organization.can? :access, :paid_ticketing) @event.venue.organization_id = current_organization.id @event.venue.time_zone = current_organization.time_zone @event.contact_email = current_organization.try(:email) || current_user.email if @event.save redirect_to edit_event_url(@event) else render :new end end |
#destroy ⇒ Object
90 91 92 93 94 95 |
# File 'app/controllers/events_controller.rb', line 90 def destroy :destroy, @event @event.destroy flash[:notice] = "Your event has been deleted" redirect_to events_url end |
#edit ⇒ Object
51 52 53 |
# File 'app/controllers/events_controller.rb', line 51 def edit :edit, @event end |
#image ⇒ Object
55 56 57 |
# File 'app/controllers/events_controller.rb', line 55 def image :edit, @event end |
#index ⇒ Object
23 24 25 26 |
# File 'app/controllers/events_controller.rb', line 23 def index :view, Event @events = current_organization.events.includes(:shows, :venue).order('updated_at DESC') end |
#messages ⇒ Object
127 128 |
# File 'app/controllers/events_controller.rb', line 127 def end |
#new ⇒ Object
44 45 46 47 48 49 |
# File 'app/controllers/events_controller.rb', line 44 def new @event = current_organization.events.build(:producer => current_organization.name) @event.venue = Venue.new :new, @event @templates = current_organization.charts.template end |
#prices ⇒ Object
106 107 |
# File 'app/controllers/events_controller.rb', line 106 def prices end |
#resell ⇒ Object
130 131 132 133 |
# File 'app/controllers/events_controller.rb', line 130 def resell @organization = current_organization @reseller_profiles = ResellerProfile.includes(:organization).order("organizations.name").all end |
#show ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/events_controller.rb', line 28 def show :view, @event @shows = @event.shows.paginate(:page => params[:page], :per_page => 25) respond_to do |format| format.json do render :json => @event.as_full_calendar_json end format.html do render :show end end end |
#storefront_link ⇒ Object
100 101 |
# File 'app/controllers/events_controller.rb', line 100 def storefront_link end |
#temp_discount_form ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'app/controllers/events_controller.rb', line 113 def temp_discount_form find_event @discount = TempDiscount.new @discount.promotion_type = 'two-for-one' @event.charts.collect(&:sections).flatten.each do |section| @discount.discount_sections.new( :section => section, :price => section.price ) end end |
#temp_discounts_index ⇒ Object
109 110 111 |
# File 'app/controllers/events_controller.rb', line 109 def temp_discounts_index find_event end |
#update ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'app/controllers/events_controller.rb', line 69 def update :edit, @event if @event.update_attributes(params[:event]) if user_requesting_next_step? if user_just_uploaded_an_image? redirect_to (@event) elsif user_set_special_instructions? redirect_to event_shows_path(@event) else redirect_to edit_event_venue_path(@event) end else flash[:notice] = "Your event has been updated." redirect_to event_url(@event) end else render :edit end end |
#widget ⇒ Object
97 98 |
# File 'app/controllers/events_controller.rb', line 97 def end |
#wp_plugin ⇒ Object
103 104 |
# File 'app/controllers/events_controller.rb', line 103 def wp_plugin end |