aboutsummaryrefslogtreecommitdiff
blob: 14ec89f9a452cb3028f229d14c3a1157f42eef90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class VotingOptionsController < ApplicationController

  hobo_model_controller

  auto_actions :all

  def community_vote
    option = VotingOption.find(params[:id])
    unless option.nil?
      if current_user.signed_up?
        Vote.vote_for_option(current_user, option, false)
        flash[:notice] = "You voted for #{option.description}"
      else
        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