]> projects.mako.cc - selectricity/blob - app/controllers/application.rb
Omit numbering on ol to suppress IE6 dragdrop list numbering bug
[selectricity] / app / controllers / application.rb
1 # Filters added to this controller will be run for all controllers in the application.
2 # Likewise, all the methods added will be available for all controllers.
3
4 class ApplicationController < ActionController::Base
5   include AuthenticatedSystem
6   helper :user
7   require_dependency "user"
8
9   before_filter :add_stylesheets
10    
11   def initialize
12     @stylesheets = []
13   end
14             
15   def add_stylesheets
16     file = "#{Dir.pwd}/public/stylesheets/#{controller_name}.css"
17     if File.exists? file
18       @stylesheets << controller_name
19     end
20   end
21
22   #both election_controller and quickvote_controller need this method
23   def sort_candidates
24     @vote = Vote.find(params[:id])
25
26     @vote.rankings.each do |ranking|
27       ranking.rank = params['rankings-list'].index(ranking.candidate.id.to_s) + 1
28       ranking.save
29     end
30     render :nothing => true
31   end
32 end

Benjamin Mako Hill || Want to submit a patch?