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
- #passes ⇒ Object
- #prices ⇒ Object
- #resell ⇒ Object
- #show ⇒ Object
- #storefront_link ⇒ Object
- #update ⇒ Object
- #widget ⇒ Object
- #wp_plugin ⇒ Object
Instance Method Details
#assign ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/events_controller.rb', line 69 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
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/events_controller.rb', line 8 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
61 62 63 |
# File 'app/controllers/events_controller.rb', line 61 def edit :edit, @event end |
#image ⇒ Object
65 66 67 |
# File 'app/controllers/events_controller.rb', line 65 def image :edit, @event end |
#index ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/events_controller.rb', line 24 def index :view, Event scope = Event.unscoped.where(:deleted_at => nil).where(:organization_id => current_organization.id).includes(:shows).order('name ASC') scope = if params[:range].present? && params[:range] == 'all' @all = scope else @upcoming = scope.where :id => current_organization.shows.unplayed.pluck(:event_id).uniq end scope = scope.where('LOWER(name) LIKE ?', "%#{params[:query].downcase}%") unless params[:query].blank? @events = scope end |
#messages ⇒ Object
113 114 |
# File 'app/controllers/events_controller.rb', line 113 def end |
#new ⇒ Object
54 55 56 57 58 59 |
# File 'app/controllers/events_controller.rb', line 54 def new @event = current_organization.events.build(:producer => current_organization.name) @event.venue = Venue.new :new, @event @templates = current_organization.charts.template end |
#passes ⇒ Object
110 111 |
# File 'app/controllers/events_controller.rb', line 110 def passes end |
#prices ⇒ Object
107 108 |
# File 'app/controllers/events_controller.rb', line 107 def prices end |
#resell ⇒ Object
116 117 118 119 |
# File 'app/controllers/events_controller.rb', line 116 def resell @organization = current_organization @reseller_profiles = ResellerProfile.includes(:organization).order("organizations.name").all end |
#show ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/events_controller.rb', line 38 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
101 102 |
# File 'app/controllers/events_controller.rb', line 101 def storefront_link end |
#update ⇒ Object
79 80 81 82 83 84 85 86 87 88 |
# File 'app/controllers/events_controller.rb', line 79 def update :edit, @event if @event.update_attributes(params[:event]) redirect_to redirect_path and return else render :edit end end |
#widget ⇒ Object
97 98 99 |
# File 'app/controllers/events_controller.rb', line 97 def @donation_kit = current_user.current_organization.kit(:regular_donation) end |
#wp_plugin ⇒ Object
104 105 |
# File 'app/controllers/events_controller.rb', line 104 def wp_plugin end |