* [gentoo-commits] proj/council-webapp:master commit in: site/app/controllers/
@ 2011-08-01 14:38 Petteri Räty
0 siblings, 0 replies; only message in thread
From: Petteri Räty @ 2011-08-01 14:38 UTC (permalink / raw
To: gentoo-commits
commit: 7b3f49a25aecef13a7b20ba7014c7432318bbd26
Author: Joachim Filip Ignacy Bartosik <jbartosik <AT> gmail <DOT> com>
AuthorDate: Tue Jul 26 14:15:36 2011 +0000
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 14:15:36 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=7b3f49a2
Improve controller readability
---
site/app/controllers/agendas_controller.rb | 2 +-
site/app/controllers/voting_options_controller.rb | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/site/app/controllers/agendas_controller.rb b/site/app/controllers/agendas_controller.rb
index 669f364..f94d96c 100644
--- a/site/app/controllers/agendas_controller.rb
+++ b/site/app/controllers/agendas_controller.rb
@@ -14,7 +14,7 @@ class AgendasController < ApplicationController
end
def results
- data = JSON.parse(request.env["rack.input"].read)
+ data = JSON.parse(request.env['rack.input'].read)
Agenda.update_voting_options data['agenda']
Agenda.process_results data data['votes']
agenda = Agenda.current
diff --git a/site/app/controllers/voting_options_controller.rb b/site/app/controllers/voting_options_controller.rb
index 14ec89f..73a0dfb 100644
--- a/site/app/controllers/voting_options_controller.rb
+++ b/site/app/controllers/voting_options_controller.rb
@@ -6,7 +6,10 @@ class VotingOptionsController < ApplicationController
def community_vote
option = VotingOption.find(params[:id])
- unless option.nil?
+ if option.nil?
+ flash[:notice] = "No such voting option"
+ redirect_to :controller => :agendas, :action => :index
+ else
if current_user.signed_up?
Vote.vote_for_option(current_user, option, false)
flash[:notice] = "You voted for #{option.description}"
@@ -14,9 +17,6 @@ class VotingOptionsController < ApplicationController
flash[:notice] = "You must be logged in to vote"
end
redirect_to :controller => :agenda_items, :action => :show, :id => option.agenda_item_id
- else
- flash[:notice] = "No such voting option"
- redirect_to :controller => :agendas, :action => :index
end
end
end
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-08-01 14:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01 14:38 [gentoo-commits] proj/council-webapp:master commit in: site/app/controllers/ Petteri Räty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox