Skip to content

Commit

Permalink
rails 3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
opencongress committed Feb 25, 2011
1 parent f0e2bdb commit 2bc3b93
Show file tree
Hide file tree
Showing 674 changed files with 39,380 additions and 46,422 deletions.
6 changes: 4 additions & 2 deletions .rvmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash

rvm --create ree-1.8.7@oc
rvm use ree-1.8.7@oc
rvm --create ree-1.8.7@oc-rails3
rvm ree-1.8.7@oc-rails3


18 changes: 16 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
source 'http://rubygems.org'

gem 'rails', '3.0.0.rc2'
gem 'rails', '3.0.4'

# database gems -- need both pg and mysql for app and wiki
gem 'pg'
gem 'mysql'

gem "settingslogic"

# HAML support
gem "haml"

# RMagick
gem 'rmagick', '2.13.1'
gem 'simple_captcha', :git => 'git://github.com/galetahub/simple-captcha.git'

# GovKit
gem "govkit"
Expand Down Expand Up @@ -44,6 +47,17 @@ gem 'newrelic_rpm'
# oauth
gem 'oauth'

gem 'will_paginate'
gem 'will_paginate', '~> 3.0.pre2'

gem "acts_as_solr"
gem "validates_captcha"
gem "okkez-open_id_authentication"
gem "devise"

gem "acts-as-taggable-on", :git => 'http://github.com/mbleigh/acts-as-taggable-on.git'

group :development do
# bundler requires these gems in development
# gem "rails-footnotes"
end

109 changes: 70 additions & 39 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,36 +1,49 @@
GIT
remote: git://github.com/galetahub/simple-captcha.git
revision: b8493942e9a9bb58c58712fa21d41963330da6aa
specs:
simple_captcha (0.1.1)

GIT
remote: http://github.com/mbleigh/acts-as-taggable-on.git
revision: 3d707c25d45b5cc680cf3623d15ff59856457ea9
specs:
acts-as-taggable-on (2.0.6)

GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.7)
abstract (1.0.0)
actionmailer (3.0.0.rc2)
actionpack (= 3.0.0.rc2)
mail (~> 2.2.5)
actionpack (3.0.0.rc2)
activemodel (= 3.0.0.rc2)
activesupport (= 3.0.0.rc2)
actionmailer (3.0.4)
actionpack (= 3.0.4)
mail (~> 2.2.15)
actionpack (3.0.4)
activemodel (= 3.0.4)
activesupport (= 3.0.4)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4.1)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.12)
rack-test (~> 0.5.4)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.0.rc2)
activesupport (= 3.0.0.rc2)
activemodel (3.0.4)
activesupport (= 3.0.4)
builder (~> 2.1.2)
i18n (~> 0.4.1)
activerecord (3.0.0.rc2)
activemodel (= 3.0.0.rc2)
activesupport (= 3.0.0.rc2)
arel (~> 1.0.0.rc1)
i18n (~> 0.4)
activerecord (3.0.4)
activemodel (= 3.0.4)
activesupport (= 3.0.4)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.0.rc2)
activemodel (= 3.0.0.rc2)
activesupport (= 3.0.0.rc2)
activesupport (3.0.0.rc2)
arel (1.0.1)
activesupport (~> 3.0.0)
activeresource (3.0.4)
activemodel (= 3.0.4)
activesupport (= 3.0.4)
activesupport (3.0.4)
acts_as_solr (1.3.3)
arel (2.0.8)
bcrypt-ruby (2.1.4)
bluecloth (2.0.11)
builder (2.1.2)
capistrano (2.5.19)
Expand All @@ -43,6 +56,9 @@ GEM
capistrano (>= 1.0.0)
closure-compiler (1.0.0)
crack (0.1.8)
devise (1.1.7)
bcrypt-ruby (~> 2.1.2)
warden (~> 1.0.2)
erubis (2.6.6)
abstract (>= 1.0.0)
fastercsv (1.5.4)
Expand All @@ -60,7 +76,7 @@ GEM
htmlentities (4.2.4)
httparty (0.7.4)
crack (= 0.1.8)
i18n (0.4.2)
i18n (0.5.0)
jammit (0.6.0)
closure-compiler (>= 0.1.0)
yui-compressor (>= 0.9.1)
Expand All @@ -83,6 +99,8 @@ GEM
newrelic_rpm (2.13.4)
nokogiri (1.4.4)
oauth (0.4.4)
okkez-open_id_authentication (1.0.1)
ruby-openid (>= 2.0.4)
pg (0.10.1)
polyglot (0.3.1)
rack (1.2.1)
Expand All @@ -93,38 +111,47 @@ GEM
ruby-openid (>= 2.1.8)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.0.rc2)
actionmailer (= 3.0.0.rc2)
actionpack (= 3.0.0.rc2)
activerecord (= 3.0.0.rc2)
activeresource (= 3.0.0.rc2)
activesupport (= 3.0.0.rc2)
bundler (>= 1.0.0.rc.6)
railties (= 3.0.0.rc2)
railties (3.0.0.rc2)
actionpack (= 3.0.0.rc2)
activesupport (= 3.0.0.rc2)
rake (>= 0.8.3)
thor (~> 0.14.0)
rails (3.0.4)
actionmailer (= 3.0.4)
actionpack (= 3.0.4)
activerecord (= 3.0.4)
activeresource (= 3.0.4)
activesupport (= 3.0.4)
bundler (~> 1.0)
railties (= 3.0.4)
railties (3.0.4)
actionpack (= 3.0.4)
activesupport (= 3.0.4)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
rmagick (2.13.1)
ruby-openid (2.1.8)
settingslogic (2.0.6)
simple-rss (1.2.3)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.24)
will_paginate (2.3.15)
validates_captcha (0.9.7)
actionpack (>= 2.3.2)
activerecord (>= 2.3.2)
warden (1.0.3)
rack (>= 1.0.0)
will_paginate (3.0.pre2)
yui-compressor (0.9.4)

PLATFORMS
ruby

DEPENDENCIES
RedCloth
acts-as-taggable-on!
acts_as_solr
bluecloth
capistrano
capistrano-ext
devise
govkit
haml
hoptoad_notifier
Expand All @@ -136,10 +163,14 @@ DEPENDENCIES
mysql
newrelic_rpm
oauth
okkez-open_id_authentication
pg
rack-openid
rails (= 3.0.0.rc2)
rails (= 3.0.4)
rmagick (= 2.13.1)
ruby-openid
settingslogic
simple-rss
will_paginate
simple_captcha!
validates_captcha
will_paginate (~> 3.0.pre2)
7 changes: 2 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'tasks/rails'
OpenCongress::Application.load_tasks
17 changes: 9 additions & 8 deletions app/controllers/account_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AccountController < ApplicationController
before_filter :login_from_cookie, :except => [:reset_password]
#before_filter :login_from_cookie, :except => [:reset_password]
before_filter :login_required, :only => [:welcome, :accept_tos]
after_filter :check_wiki, :only => [:login, :activate]

Expand All @@ -11,7 +11,7 @@ class AccountController < ApplicationController
# observer :user_observer

def index
unless logged_in?
unless user_signed_in?
redirect_to(login_path)
else
redirect_to(user_profile_path(:login => current_user.login))
Expand Down Expand Up @@ -51,7 +51,7 @@ def login
end

if params[:wiki_return_page]
session[:return_to] = "#{WIKI_BASE_URL}/#{params[:wiki_return_page]}"
session[:return_to] = "#{Settings.wiki_base_url}/#{params[:wiki_return_page]}"
end

if using_open_id?
Expand All @@ -65,7 +65,7 @@ def login
return unless request.post?
end

if logged_in?
if user_signed_in?
self.current_user.update_attribute(:previous_login_date, self.current_user.last_login ? self.current_user.last_login : Time.now)
self.current_user.update_attribute(:last_login, Time.now)
ip = self.current_user.user_ip_addresses.find_or_create_by_addr(UserIpAddress.int_form(request.remote_ip))
Expand Down Expand Up @@ -142,7 +142,7 @@ def logout
session[:return_to] = "http://www.opencongress.org/wiki/#{params[:wiki_return_page]}"
end
redirect_loc = session[:return_to]
self.current_user.forget_me if logged_in?
self.current_user.forget_me if user_signed_in?
cookies.delete :auth_token
cookies.delete '_session_id'
cookies.delete 'ocloggedin'
Expand Down Expand Up @@ -178,8 +178,9 @@ def activate
def welcome
@user = current_user
@show_tracked_list = true
@most_viewed_bills = ObjectAggregate.popular('Bill', DEFAULT_COUNT_TIME, 5)
@senators, @reps = Person.find_current_congresspeople_by_zipcode(@user.zipcode, @user.zip_four) if ( logged_in? && @user == current_user && !(@user.zipcode.nil? || @user.zipcode.empty?))

@most_viewed_bills = ObjectAggregate.popular('Bill', Settings.default_count_time, 5)
@senators, @reps = Person.find_current_congresspeople_by_zipcode(@user.zipcode, @user.zip_four) if ( user_signed_in? && @user == current_user && !(@user.zipcode.nil? || @user.zipcode.empty?))
end

def forgot_password
Expand Down Expand Up @@ -306,7 +307,7 @@ def new_openid
end

def check_wiki
if logged_in? and (RAILS_ENV == 'production')
if user_signed_in? and (Rails.env == 'production')
begin
require 'net/http'
require 'uri'
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/stats_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def users

def bills
@page_title = "Bill Stats"
@session = params[:session].blank? ? DEFAULT_CONGRESS : params[:session]
@session = params[:session].blank? ? Settings.default_congress : params[:session]
if params[:format] == 'csv'
@bills = Bill.find(:all, :conditions => ["session = ?", @session],
:order => 'bills.page_views_count DESC')
Expand Down
23 changes: 12 additions & 11 deletions app/controllers/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ApiController < ApplicationController
def index
@page_title = "OC API Documentation"
@api_key = ""
if logged_in?
if user_signed_in?
@api_key = current_user.feed_key
end

Expand Down Expand Up @@ -68,25 +68,25 @@ def people


end
# Person.find_by_most_commentary(type = 'news', person_type = 'rep', num = 5, since = DEFAULT_COUNT_TIME)
# Person.find_by_most_commentary(type = 'news', person_type = 'rep', num = 5, since = Settings.default_count_time)

def most_blogged_representatives_this_week
people = Person.find_by_most_commentary('blog', 'rep', @per_page, DEFAULT_COUNT_TIME)
people = Person.find_by_most_commentary('blog', 'rep', @per_page, Settings.default_count_time)
do_render(people, {:methods => [:oc_user_comments, :oc_users_tracking], :include => [:recent_news, :recent_blogs]})
end

def most_blogged_senators_this_week
people = Person.find_by_most_commentary('blog', 'sen', @per_page, DEFAULT_COUNT_TIME)
people = Person.find_by_most_commentary('blog', 'sen', @per_page, Settings.default_count_time)
do_render(people, {:methods => [:oc_user_comments, :oc_users_tracking], :include => [:recent_news, :recent_blogs]})
end

def representatives_most_in_the_news_this_week
people = Person.find_by_most_commentary('news', 'rep', @per_page, DEFAULT_COUNT_TIME)
people = Person.find_by_most_commentary('news', 'rep', @per_page, Settings.default_count_time)
do_render(people, {:methods => [:oc_user_comments, :oc_users_tracking], :include => [:recent_news, :recent_blogs]})
end

def senators_most_in_the_news_this_week
people = Person.find_by_most_commentary('news', 'sen', @per_page, DEFAULT_COUNT_TIME)
people = Person.find_by_most_commentary('news', 'sen', @per_page, Settings.default_count_time)
do_render(people, {:methods => [:oc_user_comments, :oc_users_tracking], :include => [:recent_news, :recent_blogs]})
end

Expand Down Expand Up @@ -238,7 +238,7 @@ def bills_introduced_since

def bills_by_query
query_stripped = prepare_tsearch_query(params[:q])
bills = Bill.full_text_search(query_stripped, {:congresses => [DEFAULT_CONGRESS,DEFAULT_CONGRESS - 1,DEFAULT_CONGRESS - 2,DEFAULT_CONGRESS - 3], :page => 1})
bills = Bill.full_text_search(query_stripped, {:congresses => [Settings.default_congress,Settings.default_congress - 1,Settings.default_congress - 2,Settings.default_congress - 3], :page => 1})
do_render(bills, {:except => [:rolls, :hot_bill_category_id],
:methods => [:title_full_common, :status],
:include => {:co_sponsors => {:methods => [:oc_user_comments, :oc_users_tracking]},
Expand All @@ -255,24 +255,25 @@ def hot_bills

def stalled_bills
original_chamber = (params[:passing_chamber] == 's') ? 's' : 'h'
session = (AVAILABLE_CONGRESSES.include?(params[:session])) ? params[:session] : DEFAULT_CONGRESS
session = (AVAILABLE_CONGRESSES.include?(params[:session])) ? params[:session] : Settings.default_congress

bills = Bill.find_stalled_in_second_chamber(original_chamber, session)
do_render(bills, {:except => [:rolls, :hot_bill_category_id]})
end

def most_blogged_bills_this_week
bills = Bill.find_by_most_commentary('blog', 10, DEFAULT_COUNT_TIME)
bills = Bill.find_by_most_commentary('blog', 10, Settings.default_count_time)
do_render(bills, {:except => [:rolls, :hot_bill_category_id]})
end

def bills_in_the_news_this_week
bills = Bill.find_by_most_commentary('news', 10, DEFAULT_COUNT_TIME)
bills = Bill.find_by_most_commentary('news', 10, Settings.default_count_time)
do_render(bills, {:except => [:rolls, :hot_bill_category_id]})
end

def most_viewed_bills_this_week
bills = ObjectAggregate.popular('Bill', DEFAULT_COUNT_TIME + 30.days, 10) || Bill.find(:first)
bills = ObjectAggregate.popular('Bill', Settings.default_count_time + 30.days, 10) || Bill.find(:first)

do_render(bills, {:except => [:rolls, :hot_bill_category_id]})
end

Expand Down
Loading

0 comments on commit 2bc3b93

Please sign in to comment.