Class: Admin::EventsController

Inherits:
ResourcesController
  • Object
show all
Defined in:
app/controllers/admin/events_controller.rb

Instance Method Summary collapse

Instance Method Details

#duplicateObject


2
3
4
5
# File 'app/controllers/admin/events_controller.rb', line 2

def duplicate
  event = Event.duplicate!
  redirect_to url_for(controller: "/admin/events", action: :edit, id: event.id)
end

#publishObject


7
8
9
10
11
12
13
# File 'app/controllers/admin/events_controller.rb', line 7

def publish
  event = Event.find(params[:id])
  UsergroupMailer.invitation_mail(event).deliver_now!
  event.update_attributes! published: true

  redirect_to url_for(controller: "/admin/events", action: :edit, id: event.id), notice: "Published!"
end

#send_ios_push_notificationObject


15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/admin/events_controller.rb', line 15

def send_ios_push_notification
  event = Event.find(params[:id])

  options = {
    channel:           Whitelabel[:label_id],
    alert:             "#{I18n.tw('name')}: new event at #{I18n.l(event.date)}",
    content_available: true
  }

  ZeroPush.broadcast(options)

  redirect_to url_for(controller: "/admin/events", action: :show, id: event.id), alert: "iOS Push Notification sent!"
end