#############################################################
def create
- if params[:quickvote]
+ if params[:quickvote]
@quickvote = QuickVote.new(params[:quickvote])
# store the candidate grabbed through ajax and stored in flash
@quickvote.candidate_names = flash[:candidate_names]
@quickvote.description=@quickvote.description
+ #record who created the quickvote so that person can monitor it easily
+ @quickvote.quickuser = session.session_id
# try to save, if it fails, show the page again (the flash should
# still be intact
if @quickvote.save
@election.candidates.each {|c| @candidates[c.id] = c}
end
+ def my_quickvotes
+ @myqvs = QuickVote.find(:all, :conditions => ["quickuser = ?",
+ session.session_id])
+ end
end
--- /dev/null
+<table class="voterbox">
+ <tr>
+ <% ["Name", "Start Date", "End Date", "Description"].each do |column| %>
+ <th><%= column %></th>
+ <% end -%>
+ </tr>
+
+ <% @myqvs.each do |quickvote| %>
+ <tr>
+ <td>
+ <%= link_to "#{quickvote.name}",
+ quickaction_url( :ident => quickvote.name, :action => 'results' ) %>
+ </td>
+ <td><%= quickvote.startdate.strftime("%x") %></td>
+ <td><%= quickvote.enddate.strftime("%x") %></td>
+ <td><%= quickvote.description %>
+ </tr>
+<% end %>
+</table>
\ No newline at end of file
map.connect 'quickvote/:action/:id',
:controller => 'quickvote',
- :requirements => { :action => /(create|add_candidate|sort_candidates)/ }
+ :requirements => { :action => /(create|add_candidate|sort_candidates|my_quickvotes)/ }
map.quickaction 'quickvote/:ident/:action',
:controller => 'quickvote',
drop table if exists elections;
create table elections (
- id int NOT NULL auto_increment,
+ id int NOT NULL auto_increment,
name varchar(100) NOT NULL,
description TEXT NOT NULL,
anonymous tinyint NOT NULL DEFAULT 1,
enddate datetime NOT NULL,
active tinyint NOT NULL DEFAULT 0,
user_id int NULL,
+ quickuser varchar(255) NULL, #stores session_id for quickvote creators
election_method varchar(100) DEFAULT 'ssd',
`type` varchar(100) NOT NULL,
primary key (id),