cirandas.net

ref: master

plugins/push_notification/controllers/push_notification_plugin_admin_controller.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
require_relative "../lib/notification_settings"

class PushNotificationPluginAdminController < PluginAdminController
  append_view_path File.join(File.dirname(__FILE__) + '/../views')

  def index
    @server_settings = Noosfero::Plugin::Settings.new(environment, PushNotificationPlugin)
    @settings = @server_settings.notifications || PushNotificationPlugin::NotificationSettings.default_hash_flags
  end

  def update
    data = params[:server_settings]
    data[:notifications] = params[:settings]
    @server_settings = Noosfero::Plugin::Settings.new(environment, PushNotificationPlugin, data)
    @server_settings.save!
    redirect_to :action => "index"
  end

end