Class: Droom::EventsController

Inherits:
EngineController show all
Defined in:
app/controllers/droom/events_controller.rb

Instance Method Summary collapse

Methods inherited from EngineController

#current_ability

Instance Method Details

#calendarObject



21
22
23
# File 'app/controllers/droom/events_controller.rb', line 21

def calendar
  respond_with @events
end

#createObject



37
38
39
40
41
42
43
# File 'app/controllers/droom/events_controller.rb', line 37

def create
  if @event.save
    render :partial => "event"
  else
    respond_with @event
  end
end

#destroyObject



53
54
55
56
# File 'app/controllers/droom/events_controller.rb', line 53

def destroy
  @event.destroy
  head :ok
end

#indexObject



15
16
17
18
19
# File 'app/controllers/droom/events_controller.rb', line 15

def index
  respond_with @events do |format|
    format.js { render :partial => 'droom/events/events' }
  end
end

#newObject



32
33
34
35
# File 'app/controllers/droom/events_controller.rb', line 32

def new
  @event.start = Time.zone.now.change(hour: 10)
  respond_with @event
end

#showObject



25
26
27
28
29
30
# File 'app/controllers/droom/events_controller.rb', line 25

def show
  respond_with @event do |format|
    format.js { render :partial => 'droom/events/event' }
    format.zip { send_file @event.documents_zipped.path, :type => 'application/zip', :disposition => 'attachment', :filename => "#{@event.slug}.zip" }
  end
end

#updateObject



45
46
47
48
49
50
51
# File 'app/controllers/droom/events_controller.rb', line 45

def update
  if @event.update_attributes(event_params)
    render :partial => "event"
  else
    respond_with @event
  end
end