diff options
Diffstat (limited to 'app/controllers/alerts_controller.rb')
-rw-r--r-- | app/controllers/alerts_controller.rb | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/app/controllers/alerts_controller.rb b/app/controllers/alerts_controller.rb index a3cb8f9..1da2c9b 100644 --- a/app/controllers/alerts_controller.rb +++ b/app/controllers/alerts_controller.rb @@ -1,6 +1,26 @@ -class AlertsController < ApplicationController - before_action :set_alert, only: [:show, :edit, :update, :destroy] +# Copyright (C) 2014 Andrew Murrell +# Copyright (C) 2014 Davis Webb +# Copyright (C) 2014 Guntas Grewal +# Copyright (C) 2014 Luke Shumaker +# Copyright (C) 2014 Nathaniel Foy +# Copyright (C) 2014 Tomer Kimia +# +# This file is part of Leaguer. +# +# Leaguer is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Leaguer is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the Affero GNU General Public License +# along with Leaguer. If not, see <http://www.gnu.org/licenses/>. +class AlertsController < ApplicationController # GET /alerts # GET /alerts.json def index @@ -25,6 +45,13 @@ class AlertsController < ApplicationController # POST /alerts.json def create @alert = Alert.new(alert_params) + @alert.author = current_user + users = {} + users = User.all + + for i in 0..users.length + current_user.send_message(users[i], @alert.message, "Pay Attention!") + end respond_to do |format| if @alert.save @@ -62,6 +89,7 @@ class AlertsController < ApplicationController end private + # Use callbacks to share common setup or constraints between actions. def set_alert @alert = Alert.find(params[:id]) |