Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rails 3 changes

  • Loading branch information...
commit 2bc3b934c4311f6684ce67ea23c2b08f1fcc4a5b 1 parent f0e2bdb
@opencongress authored
Showing with 34,457 additions and 19,082 deletions.
  1. +4 −2 .rvmrc
  2. +16 −2 Gemfile
  3. +70 −39 Gemfile.lock
  4. +2 −5 Rakefile
  5. +9 −8 app/controllers/account_controller.rb
  6. +1 −1  app/controllers/admin/stats_controller.rb
  7. +12 −11 app/controllers/api_controller.rb
  8. +20 −13 app/controllers/application_controller.rb
  9. +1 −1  app/controllers/articles_controller.rb
  10. +4 −4 app/controllers/battle_royale_controller.rb
  11. +22 −22 app/controllers/bill_controller.rb
  12. +1 −1  app/controllers/commentary_controller.rb
  13. +2 −2 app/controllers/comments_controller.rb
  14. +2 −2 app/controllers/committee_controller.rb
  15. +3 −2 app/controllers/facebook_controller.rb
  16. +8 −8 app/controllers/friends_controller.rb
  17. +1 −1  app/controllers/gossip_controller.rb
  18. +6 −6 app/controllers/index_controller.rb
  19. +3 −4 app/controllers/issue_controller.rb
  20. +1 −2  app/controllers/money_trail_controller.rb
  21. +13 −13 app/controllers/people_controller.rb
  22. +3 −3 app/controllers/political_notebooks_controller.rb
  23. +6 −6 app/controllers/profile_controller.rb
  24. +10 −9 app/controllers/resources_controller.rb
  25. +14 −19 app/controllers/roll_call_controller.rb
  26. +3 −3 app/controllers/search_controller.rb
  27. +30 −30 app/helpers/application_helper.rb
  28. +24 −24 app/helpers/bill_helper.rb
  29. +1 −0  app/helpers/index_helper.rb
  30. +6 −6 app/helpers/people_helper.rb
  31. +1 −1  app/helpers/profile_helper.rb
  32. +5 −5 app/helpers/roll_call_helper.rb
  33. +2 −2 app/helpers/search_helper.rb
  34. +29 −9 app/helpers/span_link_renderer.rb
  35. +5 −4 app/models/article.rb
  36. +19 −18 app/models/bill.rb
  37. +1 −1  app/models/commentary.rb
  38. +9 −9 app/models/committee.rb
  39. +1 −1  app/models/crp_industry.rb
  40. +2 −2 app/models/crp_interest_group.rb
  41. +1 −0  app/models/gossip.rb
  42. +1 −1  app/models/object_aggregate.rb
  43. +0 −35 app/models/page_view.rb
  44. +40 −39 app/models/person.rb
  45. +4 −4 app/models/roll_call.rb
  46. +1 −1  app/models/roll_call_vote.rb
  47. +1 −1  app/models/search.rb
  48. +7 −7 app/models/subject.rb
  49. +2 −0  app/models/user.rb
  50. +3 −3 app/models/user_notifier.rb
  51. +1 −1  app/views/about/_learn.html.erb
  52. +1 −1  app/views/about/beta_feedback.html.erb
  53. +2 −2 app/views/about/political_notebooks.html.erb
  54. +4 −4 app/views/about/uses.html.erb
  55. +1 −1  app/views/admin/bill_summaries/_new_bill_form.html.erb
  56. +2 −2 app/views/admin/bill_summaries/index.html.erb
  57. +1 −1  app/views/admin/stats/bills.html.erb
  58. +5 −5 app/views/api/index.html.erb
  59. +1 −1  app/views/articles/_archives.html.erb
  60. +2 −2 app/views/articles/_article.html.erb
  61. +4 −4 app/views/articles/_frontpage.html.erb
  62. +5 −5 app/views/articles/_summary.html.erb
  63. +1 −1  app/views/battle_royale/index.html.erb
  64. +6 −6 app/views/bill/_bills_by_type.html.erb
  65. +1 −1  app/views/bill/_carousel.html.erb
  66. +2 −2 app/views/bill/_header.html.erb
  67. +3 −2 app/views/bill/_hot_bill_category.html.erb
  68. +3 −3 app/views/bill/_related_bills_list.html.erb
  69. +1 −1  app/views/bill/_related_bills_panel.html.erb
  70. +1 −1  app/views/bill/_related_oc_blog_articles.html.erb
  71. +10 −10 app/views/bill/_sort_bills.html.erb
  72. +2 −2 app/views/bill/_topic.html.erb
  73. +2 −0  app/views/bill/news_blogs.html.erb
  74. +14 −14 app/views/bill/show.html.erb
  75. +2 −2 app/views/bill/text.html.erb
  76. +1 −1  app/views/commentary/pn_ajax_multiple.js.rjs
  77. +2 −2 app/views/committee/_carousel.html.erb
  78. +1 −1  app/views/committee/_committees_list_most_viewed.html.erb
  79. +1 −1  app/views/committee/_related_committees_panel.html.erb
  80. +2 −2 app/views/committee/_sort_committees.html.erb
  81. +1 −1  app/views/districts/show.html.erb
  82. +1 −1  app/views/facebook/_learn.fbml.erb
  83. +1 −1  app/views/facebook/_learn.html.erb
  84. +1 −1  app/views/friends/_tracking_table.html.erb
  85. +1 −1  app/views/friends/edit.html.erb
  86. +1 −1  app/views/friends/show.html.erb
  87. +3 −4 ...generators/facebook_scaffold/templates/layout.html.erb → app/views/friends/user_mailing_lists.html.erb
  88. +5 −3 app/views/gossip/_related_gossip_panel.html.erb
  89. +8 −8 app/views/index/index.html.erb
  90. +2 −2 app/views/issue/_issue_list.html.erb
  91. +1 −1  app/views/issue/_related_issues_panel.html.erb
  92. +3 −3 app/views/issue/_sort_issues.html.erb
  93. +1 −1  app/views/layouts/_footer.html.erb
  94. +16 −16 app/views/layouts/_header.html.erb
  95. +7 −7 app/views/layouts/_user_nav.html.erb
  96. +4 −12 app/views/layouts/application.html.erb
  97. +1 −1  app/views/layouts/frontpage.html.erb
  98. +1 −1  app/views/mailing_list_items/_add_to_alerts.html.erb
  99. +1 −1  app/views/money_trail/_related_industries_panel.html.erb
  100. +1 −1  app/views/money_trail/show.html.erb
  101. +1 −1  app/views/notebook_items/_add_to_mypn.html.erb
  102. +1 −1  app/views/people/_approval.html.erb
  103. +3 −3 app/views/people/_people_list.html.erb
  104. +2 −2 app/views/people/_people_list_special.html.erb
  105. +1 −1  app/views/people/_related_people_panel.html.erb
  106. +3 −3 app/views/people/compare.html.erb
  107. +1 −1  app/views/people/money.html.erb
  108. +1 −1  app/views/people/votes_with_party.html.erb
  109. +2 −2 app/views/person/_topic.html.erb
  110. +1 −1  app/views/profile/_bill_main_detail.html.erb
  111. +1 −1  app/views/profile/_person_main_detail.html.erb
  112. +3 −3 app/views/profile/_profile_nav.html.erb
  113. +1 −1  app/views/profile/actions.html.erb
  114. +1 −1  app/views/profile/bills.html.erb
  115. +1 −1  app/views/profile/person.html.erb
  116. +3 −3 app/views/profile/pn_ajax.html.erb
  117. +2 −2 app/views/profile/show.html.erb
  118. +1 −1  app/views/resources/bill_status.html.erb
  119. +4 −9 app/views/roll_call/_make_hot.html.erb
  120. +3 −3 app/views/roll_call/_roll_call_details_header.html.erb
  121. +8 −8 app/views/roll_call/show.html.erb
  122. +1 −1  app/views/search/_autocomplete_link.html.erb
  123. +2 −2 app/views/search/_big_search_form.html.erb
  124. +1 −1  app/views/search/_search_form.html.erb
  125. +2 −2 app/views/search/result.html.erb
  126. +3 −3 app/views/shared/_blogs.html.erb
  127. +3 −3 app/views/shared/_carousel.html.erb
  128. +3 −3 app/views/shared/_comment_form2.html.erb
  129. +3 −3 app/views/shared/_comment_form_recursive.html.erb
  130. +1 −1  app/views/shared/_commentary.html.erb
  131. +4 −4 app/views/shared/_comments2.html.erb
  132. +2 −1  app/views/shared/_comments3.html.erb
  133. +9 −8 app/views/shared/_comments_recursive.html.erb
  134. +4 −4 app/views/shared/_custom_sidebar_item.html.erb
  135. +3 −3 app/views/shared/_news.html.erb
  136. +4 −4 app/views/shared/_single_comment_out_of_context.html.erb
  137. +3 −3 app/views/shared/_sort_commentary.html.erb
  138. +3 −3 app/views/shared/_sort_comments.html.erb
  139. +1 −1  app/views/shared/_timeframe_select.html.erb
  140. +16 −16 app/views/shared/_track_link.html.erb
  141. +4 −4 app/views/shared/_user_add.html.erb
  142. +9 −9 app/views/shared/_user_content.html.erb
  143. +1 −1  app/views/shared/_video.html.erb
  144. +1 −1  app/views/shared/_videos.html.erb
  145. +7 −5 app/views/simple_captcha/_simple_captcha.erb
  146. +2 −2 app/views/states/show.html.erb
  147. +1 −1  bin/commentary_cleanup.rb
  148. +1 −1  bin/crp/maplight_bill_positions.rb
  149. +1 −1  bin/daily/daily_gpo_billtext_timestamps.rb
  150. +2 −2 bin/daily/daily_parse_amendments.rb
  151. +11 −11 bin/daily/daily_parse_bill_text.rb
  152. +3 −3 bin/daily/daily_parse_bills.rb
  153. +4 −4 bin/daily/daily_parse_opensecrets.rb
  154. +2 −2 bin/daily/daily_parse_people.rb
  155. +1 −1  bin/daily/daily_parse_rolls.rb
  156. +1 −1  bin/daily/project_vote_smart.rb
  157. +1 −1  bin/daily/sponsored_bill_stats.rb
  158. +2 −2 bin/dump_committee_names.rb
  159. +1 −1  bin/fix_bill_subject.rb
  160. +1 −1  bin/govtrack_parse_bills.rb
  161. +1 −1  bin/govtrack_parse_committee_schedules.rb
  162. +1 −1  bin/govtrack_parse_people.rb
  163. +1 −1  bin/load_district_centers.rb
  164. +1 −1  bin/parse_individual_bills.rb
  165. +1 −2  bin/parse_today_in_congress.rb
  166. +2 −2 bin/thomas_fetch_committee_reports.rb
  167. +1 −1  bin/thomas_parse_committee_reports.rb
  168. +1 −1  config.ru
  169. +3 −41 config/application.rb
  170. +60 −0 config/application_settings.yml
  171. +13 −125 config/boot.rb
  172. +4 −132 config/environment.rb
  173. +20 −20 config/environments/development.rb
  174. +1 −1  config/environments/drm.rb
  175. +17 −43 config/environments/production.rb
  176. +0 −13 config/environments/staging.rb
  177. +30 −17 config/environments/test.rb
  178. +67 −0 config/initializers/acts_as_taggable_fix.rb
  179. +5 −0 config/initializers/api_keys.rb
  180. +22 −22 config/initializers/detect_named_route_clashes.rb
  181. +142 −0 config/initializers/devise.rb
  182. +12 −0 config/initializers/devise_oc_overrides.rb
  183. +1 −1  config/initializers/govkit.rb
  184. +1 −1  config/initializers/hoptoad.rb
  185. +24 −0 config/initializers/money_precision_monkeypatch.rb
  186. +1 −1  config/initializers/secret_token.rb
  187. +2 −2 config/initializers/session_store.rb
  188. +5 −0 config/initializers/settings.rb
  189. +3 −0  config/initializers/will_paginate.rb
  190. +39 −0 config/locales/devise.en.yml
  191. +65 −1 config/routes.rb
  192. +6 −17 config/solr.yml
  193. +13,536 −13,536 db/articles.yml
  194. +1 −1  db/migrate/20101001114446_materialized_views.rb
  195. +15,139 −0 db/people.yml
  196. +3 −3 lib/apache_ban.rb
  197. +5 −5 lib/authenticated_system.rb
  198. +4 −2 lib/commentary_parser.rb
  199. +2 −2 lib/memcache_expiration.rb
  200. 0  vendor/plugins/acts_as_solr/solr/tmp/.gitignore → lib/tasks/.gitkeep
  201. +4 −4 lib/tasks/daily.rake
  202. +2 −2 lib/tasks/fixtures.rake
  203. +1 −1  lib/tasks/rails.rake
  204. +8 −8 lib/tasks/rspec.rake
  205. +1 −1  lib/tasks/validate_model.rake
  206. +2 −2 lib/tasks/validate_models.rake
  207. +1 −1  lib/yahoo_geocoder.rb
  208. BIN  public/favicon.ico
  209. BIN  public/images/rails.png
  210. +1 −1  public/javascripts/effects.js
  211. +3,381 −1,700 public/javascripts/prototype.js
  212. 0  vendor/plugins/acts_as_solr/solr/logs/.gitignore → public/stylesheets/.gitkeep
  213. +5 −4 public/stylesheets/master.css
  214. +2 −2 spec/models/article_spec.rb
  215. +9 −0 test/performance/browsing_test.rb
  216. +7 −22 test/test_helper.rb
  217. 0  vendor/plugins/.gitkeep
  218. +0 −2  vendor/plugins/acts-as-taggable-on/.gitignore
  219. +0 −18 vendor/plugins/acts-as-taggable-on/CHANGELOG
  220. +0 −20 vendor/plugins/acts-as-taggable-on/MIT-LICENSE
  221. +0 −196 vendor/plugins/acts-as-taggable-on/README
  222. +0 −7 vendor/plugins/acts-as-taggable-on/Rakefile
  223. +0 −42 vendor/plugins/acts-as-taggable-on/acts-as-taggable-on.gemspec
  224. +0 −7 ...ins/acts-as-taggable-on/generators/acts_as_taggable_on_migration/acts_as_taggable_on_migration_generator.rb
  225. +0 −29 vendor/plugins/acts-as-taggable-on/generators/acts_as_taggable_on_migration/templates/migration.rb
  226. +0 −1  vendor/plugins/acts-as-taggable-on/init.rb
  227. +0 −6 vendor/plugins/acts-as-taggable-on/lib/acts-as-taggable-on.rb
  228. +0 −326 vendor/plugins/acts-as-taggable-on/lib/acts_as_taggable_on/acts_as_taggable_on.rb
  229. +0 −52 vendor/plugins/acts-as-taggable-on/lib/acts_as_taggable_on/acts_as_tagger.rb
  230. +0 −23 vendor/plugins/acts-as-taggable-on/lib/acts_as_taggable_on/tag.rb
  231. +0 −93 vendor/plugins/acts-as-taggable-on/lib/acts_as_taggable_on/tag_list.rb
  232. +0 −6 vendor/plugins/acts-as-taggable-on/lib/acts_as_taggable_on/tagging.rb
  233. +0 −11 vendor/plugins/acts-as-taggable-on/lib/acts_as_taggable_on/tags_helper.rb
  234. +0 −6 vendor/plugins/acts-as-taggable-on/rails/init.rb
  235. +0 −165 vendor/plugins/acts-as-taggable-on/spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb
  236. +0 −72 vendor/plugins/acts-as-taggable-on/spec/acts_as_taggable_on/acts_as_tagger_spec.rb
  237. +0 −41 vendor/plugins/acts-as-taggable-on/spec/acts_as_taggable_on/tag_list_spec.rb
  238. +0 −27 vendor/plugins/acts-as-taggable-on/spec/acts_as_taggable_on/tag_spec.rb
  239. +0 −147 vendor/plugins/acts-as-taggable-on/spec/acts_as_taggable_on/taggable_spec.rb
  240. +0 −23 vendor/plugins/acts-as-taggable-on/spec/acts_as_taggable_on/tagger_spec.rb
  241. +0 −7 vendor/plugins/acts-as-taggable-on/spec/acts_as_taggable_on/tagging_spec.rb
  242. +0 −32 vendor/plugins/acts-as-taggable-on/spec/schema.rb
  243. +0 −7 vendor/plugins/acts-as-taggable-on/spec/spec.opts
  244. +0 −46 vendor/plugins/acts-as-taggable-on/spec/spec_helper.rb
  245. +0 −86 vendor/plugins/acts_as_authenticated/CHANGELOG
  246. +0 −22 vendor/plugins/acts_as_authenticated/README
  247. +0 −1  vendor/plugins/acts_as_authenticated/generators/authenticated/USAGE
  248. +0 −102 vendor/plugins/acts_as_authenticated/generators/authenticated/authenticated_generator.rb
  249. +0 −120 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_system.rb
  250. +0 −113 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_test_helper.rb
  251. +0 −43 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/controller.rb
  252. +0 −17 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/fixtures.yml
  253. +0 −129 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/functional_test.rb
  254. +0 −2  vendor/plugins/acts_as_authenticated/generators/authenticated/templates/helper.rb
  255. +0 −56 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/index.rhtml
  256. +0 −14 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/login.rhtml
  257. +0 −18 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/migration.rb
  258. +0 −64 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/model.rb
  259. +0 −16 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/signup.rhtml
  260. +0 −75 vendor/plugins/acts_as_authenticated/generators/authenticated/templates/unit_test.rb
  261. +0 −1  vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/USAGE
  262. +0 −27 vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/authenticated_mailer_generator.rb
  263. +0 −3  vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/activation.rhtml
  264. +0 −22 vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier.rb
  265. +0 −27 vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier_test.rb
  266. +0 −9 vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/observer.rb
  267. +0 −8 vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/signup_notification.rhtml
  268. +0 −1  vendor/plugins/acts_as_authenticated/install.rb
  269. +19 −0 vendor/plugins/acts_as_solr/CHANGE_LOG
  270. +8 −0 vendor/plugins/acts_as_solr/FORKED_CHANGES
  271. +0 −44 vendor/plugins/acts_as_solr/README
  272. +5 −0 vendor/plugins/acts_as_solr/README.markdown
  273. +57 −13 vendor/plugins/acts_as_solr/Rakefile
  274. +20 −3 vendor/plugins/acts_as_solr/TESTING_THE_PLUGIN
  275. +1 −0  vendor/plugins/acts_as_solr/VERSION
  276. +242 −0 vendor/plugins/acts_as_solr/acts_as_solr.gemspec
  277. +11 −0 vendor/plugins/acts_as_solr/bin/acts_as_solr
  278. +0 −16 vendor/plugins/acts_as_solr/config/environment.rb
  279. +7 −2 vendor/plugins/acts_as_solr/config/solr.yml
  280. +33 −0 vendor/plugins/acts_as_solr/config/solr_environment.rb
  281. +2 −0  vendor/plugins/acts_as_solr/lib/aas_tasks.rb
  282. +4 −2 vendor/plugins/acts_as_solr/lib/acts_as_solr.rb
  283. +130 −12 vendor/plugins/acts_as_solr/lib/acts_methods.rb
  284. +107 −25 vendor/plugins/acts_as_solr/lib/class_methods.rb
  285. +26 −13 vendor/plugins/acts_as_solr/lib/common_methods.rb
  286. +88 −38 vendor/plugins/acts_as_solr/lib/instance_methods.rb
  287. +18 −0 vendor/plugins/acts_as_solr/lib/lazy_document.rb
  288. +151 −44 vendor/plugins/acts_as_solr/lib/parser_methods.rb
  289. +5 −0 vendor/plugins/acts_as_solr/lib/search_results.rb
  290. +31 −2 vendor/plugins/acts_as_solr/lib/solr/connection.rb
  291. +5 −0 vendor/plugins/acts_as_solr/lib/solr/document.rb
  292. +1 −1  vendor/plugins/acts_as_solr/lib/solr/importer/mapper.rb
  293. +1 −1  vendor/plugins/acts_as_solr/lib/solr/importer/solr_source.rb
  294. +2 −0  vendor/plugins/acts_as_solr/lib/solr/request.rb
  295. +1 −1  vendor/plugins/acts_as_solr/lib/solr/request/add_document.rb
  296. +1 −1  vendor/plugins/acts_as_solr/lib/solr/request/base.rb
  297. +1 −1  vendor/plugins/acts_as_solr/lib/solr/request/dismax.rb
  298. +51 −0 vendor/plugins/acts_as_solr/lib/solr/request/modify_document.rb
  299. +3 −5 vendor/plugins/acts_as_solr/lib/solr/request/select.rb
  300. +16 −17 vendor/plugins/acts_as_solr/{solr/solr/conf/synonyms.txt → lib/solr/request/spellcheck.rb}
Sorry, we could not display the entire diff because too many files (683) changed.
View
6 .rvmrc
@@ -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
+
+
View
18 Gemfile
@@ -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"
@@ -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
View
109 Gemfile.lock
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -93,28 +111,34 @@ 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
@@ -122,9 +146,12 @@ PLATFORMS
DEPENDENCIES
RedCloth
+ acts-as-taggable-on!
+ acts_as_solr
bluecloth
capistrano
capistrano-ext
+ devise
govkit
haml
hoptoad_notifier
@@ -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)
View
7 Rakefile
@@ -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
View
17 app/controllers/account_controller.rb
@@ -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]
@@ -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))
@@ -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?
@@ -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))
@@ -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'
@@ -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
@@ -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'
View
2  app/controllers/admin/stats_controller.rb
@@ -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')
View
23 app/controllers/api_controller.rb
@@ -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
@@ -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
@@ -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]},
@@ -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
View
33 app/controllers/application_controller.rb
@@ -1,7 +1,7 @@
-# Filters added to this controller will be run for all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
- include AuthenticatedSystem
+ protect_from_forgery
+
+ #include AuthenticatedSystem
include SimpleCaptcha::ControllerHelpers
before_filter :store_location, :except => ["rescue_action_in_public"]
@@ -29,7 +29,7 @@ def paginate_collection(collection, options = {})
# this is only used for search results
# CLEANUP TASK: combine this and the above pagintor
def pages_for(size, options = {})
- default_options = {:per_page => DEFAULT_SEARCH_PAGE_SIZE }
+ default_options = {:per_page => Settings.default_search_page_size }
options = default_options.merge options
pages = Paginator.new self, size, options[:per_page], (params[:page]||1)
pages
@@ -51,7 +51,7 @@ def is_valid_email?(e, with_headers = false)
def days_from_params(days)
days = days.to_i if (days && !days.kind_of?(Integer))
- return (days && ((days == 7) || (days == 14) || (days == 30) || (days == 365))) ? days.days : DEFAULT_COUNT_TIME
+ return (days && ((days == 7) || (days == 14) || (days == 30) || (days == 365))) ? days.days : Settings.default_count_time
end
def rescue_action_in_public(exception)
@@ -77,7 +77,8 @@ def comment_redirect(comment_id)
private
def has_accepted_tos?
- if logged_in?
+ if user_signed_in?
+ logger.info "USER APP TOS: #{current_user.accepted_tos}"
unless current_user.accepted_tos == true
redirect_to :controller => 'account', :action => 'accept_tos'
end
@@ -85,7 +86,7 @@ def has_accepted_tos?
end
def is_banned?
- if logged_in?
+ if user_signed_in?
if current_user.is_banned == true
redirect_to logout_url
end
@@ -101,32 +102,32 @@ def show_comments?
end
end
def admin_login_required
- if !(logged_in? && current_user.user_role.can_administer_users)
+ if !(user_signed_in? && current_user.user_role.can_administer_users)
redirect_to :controller => 'admin', :action => 'index'
end
end
def can_text
- if !(logged_in? && current_user.user_role.can_manage_text)
+ if !(user_signed_in? && current_user.user_role.can_manage_text)
redirect_to :controller => 'admin', :action => 'index'
end
end
def can_moderate
- if !(logged_in? && current_user.user_role.can_moderate_articles)
+ if !(user_signed_in? && current_user.user_role.can_moderate_articles)
redirect_to :controller => 'admin', :action => 'index'
end
end
def can_blog
- unless (logged_in? && current_user.user_role.can_blog)
+ unless (user_signed_in? && current_user.user_role.can_blog)
redirect_to :controller => 'admin', :action => 'index'
end
end
def can_stats
- unless (logged_in? && current_user.user_role.can_see_stats)
+ unless (user_signed_in? && current_user.user_role.can_see_stats)
redirect_to :controller => 'admin', :action => 'index'
end
end
def no_users
- unless (logged_in? && current_user.user_role.name != "User")
+ unless (user_signed_in? && current_user.user_role.name != "User")
flash[:notice] = "Permission Denied"
redirect_to login_url
end
@@ -157,6 +158,12 @@ def get_site_text_page
@site_text_page = SiteTextPage.find_by_page_params(page_params)
@site_text_page = OpenStruct.new if @site_text_page.nil?
end
+
+ def store_location
+ unless request.fullpath =~ /^\/stylesheets/ || request.fullpath =~ /^\/images/ || request.xhr?
+ session[:return_to] = request.fullpath
+ end
+ end
protected
def dump_session
View
2  app/controllers/articles_controller.rb
@@ -19,7 +19,7 @@ def show
def list
if params[:tag] && @tag = CGI.unescape(params[:tag])
- @articles = Article.find_tagged_with(@tag).paginate(:page => params[:page], :per_page => 15)
+ @articles = Article.tagged_with(@tag, :any => true).paginate(:page => params[:page], :per_page => 15)
@page_title = "Blog - Articles Tagged '#{@tag}'"
elsif @month = params[:month]
month, year = @month.split(/-/)
View
8 app/controllers/battle_royale_controller.rb
@@ -27,7 +27,7 @@ def index
end
page = params[:page] ||= 1
-# @cache_key = "br-bill-#{page}-#{sort}-#{order}-#{logged_in? ? current_user.login : nil}-#{@range}-#{params[:q].blank? ? nil : Digest::SHA1.hexdigest(params[:q])}"
+# @cache_key = "br-bill-#{page}-#{sort}-#{order}-#{user_signed_in? ? current_user.login : nil}-#{@range}-#{params[:q].blank? ? nil : Digest::SHA1.hexdigest(params[:q])}"
# unless read_fragment(@cache_key)
unless params[:q].blank?
@r_count = Bill.count_all_by_most_user_votes_for_range(@range, :search => prepare_tsearch_query(params[:q]), :order => sort + " " + order, :per_page => 20, :page => page)
@@ -77,7 +77,7 @@ def senators
end
page = params[:page] ||= 1
-# @cache_key = "br-sens-#{page}-#{sort}-#{order}-#{logged_in? ? current_user.login : nil}-#{@range}-#{params[:q].blank? ? nil : Digest::SHA1.hexdigest(params[:q])}"
+# @cache_key = "br-sens-#{page}-#{sort}-#{order}-#{user_signed_in? ? current_user.login : nil}-#{@range}-#{params[:q].blank? ? nil : Digest::SHA1.hexdigest(params[:q])}"
# unless read_fragment(@cache_key)
unless params[:q].blank?
@r_count = Person.count_all_by_most_tracked_for_range(@range, :search => prepare_tsearch_query(params[:q]), :order => sort + " " + order, :per_page => 20, :page => page)
@@ -126,7 +126,7 @@ def representatives
@p_subtitle << "Comments"
end
page = params[:page] ||= 1
-# @cache_key = "br-reps-#{page}-#{sort}-#{order}-#{logged_in? ? current_user.login : nil}-#{@range}-#{params[:q].blank? ? nil : Digest::SHA1.hexdigest(params[:q])}"
+# @cache_key = "br-reps-#{page}-#{sort}-#{order}-#{user_signed_in? ? current_user.login : nil}-#{@range}-#{params[:q].blank? ? nil : Digest::SHA1.hexdigest(params[:q])}"
# unless read_fragment(@cache_key)
unless params[:q].blank?
@r_count = Person.count_all_by_most_tracked_for_range(@range, :search => prepare_tsearch_query(params[:q]), :order => sort + " " + order, :per_page => 20, :page => page, :person_type => "Rep.")
@@ -171,7 +171,7 @@ def issues
@p_subtitle << "Comments"
end
page = params[:page] ||= 1
-# @cache_key = "br-issues-#{page}-#{sort}-#{order}-#{logged_in? ? current_user.login : nil}-#{@range}-#{params[:q].blank? ? nil : Digest::SHA1.hexdigest(params[:q])}"
+# @cache_key = "br-issues-#{page}-#{sort}-#{order}-#{user_signed_in? ? current_user.login : nil}-#{@range}-#{params[:q].blank? ? nil : Digest::SHA1.hexdigest(params[:q])}"
# unless read_fragment(@cache_key)
unless params[:q].blank?
@r_count = Subject.count_all_by_most_tracked_for_range(@range, :search => prepare_tsearch_query(params[:q]), :order => sort + " " + order, :per_page => 20, :page => page)
View
44 app/controllers/bill_controller.rb
@@ -54,7 +54,7 @@ def index
def all
# disabled caching for
#expires_in 20.minutes, :public => true
- @congress = params[:congress] ? params[:congress] : DEFAULT_CONGRESS
+ @congress = params[:congress] ? params[:congress] : Settings.default_congress
# the following is temporary until a better way is figured out!
unless read_fragment("bill_#{@types}_index_#{@congress}")
@@ -69,7 +69,7 @@ def all
@page_title = "#{@types.capitalize} Bills: #{@congress}th Congress"
@title_desc = SiteText.find_title_desc('bill_all')
@sort = 'all'
- #@related_bills = ObjectAggregate.popular('Bill', DEFAULT_COUNT_TIME, 5) unless @custom_sidebar
+
respond_to do |format|
format.html {}
format.js { render :action => 'update'}
@@ -78,8 +78,8 @@ def all
def popular
@days = days_from_params(params[:days])
- @congress = params[:congress].blank? ? DEFAULT_CONGRESS : params[:congress]
- if @congress != DEFAULT_CONGRESS
+ @congress = params[:congress].blank? ? Settings.default_congress : params[:congress]
+ if @congress != Settings.default_congress
@bills = Bill.find(:all, :select => "bills.*, bills.page_views_count AS view_count",
:conditions => ["session = ?", params[:congress]],
:order => 'page_views_count DESC', :limit => 100)
@@ -101,7 +101,7 @@ def popular
def pending
@bills = Bill.find(:all, :include => [:bill_titles, :actions],
- :conditions => ["actions.datetime > ? AND bills.session = ? AND bills.bill_type IN (?)", 3.months.ago, DEFAULT_CONGRESS, @types_from_params],
+ :conditions => ["actions.datetime > ? AND bills.session = ? AND bills.bill_type IN (?)", 3.months.ago, Settings.default_congress, @types_from_params],
:order => "actions.date DESC", :limit => 30)
@page_title = 'Pending Bills in Congress'
@@ -121,7 +121,7 @@ def hot
@types = 'all'
@hot_bill_categories = PvsCategory.find(:all, :order => :name)
@atom = {'link' => "/bill/hot.rss", 'title' => "Hot Bills"}
- @congress = params[:congress].blank? ? DEFAULT_CONGRESS : params[:congress]
+ @congress = params[:congress].blank? ? Settings.default_congress : params[:congress]
respond_to do |format|
format.html {}
@@ -135,12 +135,12 @@ def hot
end
def list_bill_type
- congress = params[:congress] ? params[:congress] : DEFAULT_CONGRESS
+ congress = params[:congress] ? params[:congress] : Settings.default_congress
@page = params[:page]
@page = "1" unless @page
@bill_type = params[:bill_type]
- @bills = Bill.paginate_all_by_bill_type_and_session(@bill_type, congress, :include => "bill_titles", :order => 'number', :page => @page)
+ @bills = Bill.where(["bills.bill_type=? AND bills.session=?", @bill_type, congress]).includes(:bill_titles).order('number').paginate(:page => @page)
respond_to do |format|
format.html {}
@@ -150,7 +150,7 @@ def list_bill_type
def most_commentary
@days = days_from_params(params[:days])
- @congress = params[:congress].blank? ? DEFAULT_CONGRESS : params[:congress]
+ @congress = params[:congress].blank? ? Settings.default_congress : params[:congress]
if params[:type] == 'news'
@sort = @commentary_type = 'news'
@@ -162,14 +162,14 @@ def most_commentary
@atom = {'link' => "/bill/atom/most/blog", 'title' => @page_title}
end
- if @congress != DEFAULT_CONGRESS
+ if @congress != Setting.default_congress
order = (@sort == 'news') ? 'news_article_count' : 'blog_article_count'
@bills = Bill.find(:all, :select => "bills.*, bills.#{order} AS article_count",
:conditions => ["session = ? AND #{order} IS NOT NULL", params[:congress]],
:order => "#{order} DESC", :limit => 100)
else
unless read_fragment("bill_meta_most_#{@commentary_type}_#{@days}")
- @bills = Bill.find_by_most_commentary(@commentary_type, 20, @days, DEFAULT_CONGRESS, @types_from_params)
+ @bills = Bill.find_by_most_commentary(@commentary_type, 20, @days, Settings.default_congress, @types_from_params)
end
end
respond_to do |format|
@@ -196,19 +196,19 @@ def readthebill
case params[:sort]
when 'rushed'
@page_title = "Read the Bill - Bills Rushed to Vote"
- @bills = Bill.find_rushed_bills(DEFAULT_CONGRESS, 72.hours.to_i, @show_resolutions).paginate :page => params[:page]
+ @bills = Bill.find_rushed_bills(Settings.default_congress, 72.hours.to_i, @show_resolutions).paginate :page => params[:page]
@atom = {'link' => "/bill/readthebill.rss?show_resolutions=#{@show_resolutions}", 'title' => @page_title}
@title_desc = SiteText.find_title_desc('bills_rushed')
@sort = 'rushed'
when 'rtb_all'
@page_title = "Read the Bill - All Bills With Vote on Passage"
- @bills = Bill.find_rushed_bills(DEFAULT_CONGRESS, 2.years.to_i, @show_resolutions).paginate :page => params[:page]
+ @bills = Bill.find_rushed_bills(Settings.default_congress, 2.years.to_i, @show_resolutions).paginate :page => params[:page]
@atom = {'link' => "/bill/readthebill.rss?sort=rtb_all&show_resolutions=#{@show_resolutions}", 'title' => @page_title}
@title_desc = SiteText.find_title_desc('bills_rushed_all')
@sort = 'rtb_all'
else
@page_title = "Read the Bill - GPO Text Available to Consideration"
- @bills = Bill.find_gpo_consideration_rushed_bills(DEFAULT_CONGRESS, 2.years.to_i, @show_resolutions).paginate :page => params[:page]
+ @bills = Bill.find_gpo_consideration_rushed_bills(Settings.default_congress, 2.years.to_i, @show_resolutions).paginate :page => params[:page]
@atom = {'link' => "/bill/readthebill.rss?sort=gpo&show_resolutions=#{@show_resolutions}", 'title' => @page_title}
@title_desc = SiteText.find_title_desc('bills_rushed_gpo')
@sort = 'gpo'
@@ -371,7 +371,7 @@ def text
begin
# open html from file
- path = "#{OC_BILLTEXT_PATH}/#{@bill.session}/#{@bill.bill_type}#{@bill.number}#{@version.version}.gen.html-oc"
+ path = "#{Settings.oc_billtext_path}/#{@bill.session}/#{@bill.bill_type}#{@bill.number}#{@version.version}.gen.html-oc"
@bill_text = File.open(path).read
rescue
@@ -384,7 +384,7 @@ def print_text
@bill_text = ""
version = @bill.bill_text_versions.find(:first, :conditions => ["bill_text_versions.version=?", params[:version]])
if version
- path = "#{OC_BILLTEXT_PATH}/#{@bill.session}/#{@bill.bill_type}#{@bill.number}#{version.version}.gen.html-oc"
+ path = "#{Settings.oc_billtext_path}/#{@bill.session}/#{@bill.bill_type}#{@bill.number}#{version.version}.gen.html-oc"
@bill_text = File.open(path).read
end
@@ -576,7 +576,7 @@ def videos
def bill_vote
@bill = Bill.find_by_ident(params[:bill])
- if logged_in?
+ if user_signed_in?
@bv = current_user.bill_votes.find_by_bill_id(@bill.id)
unless @bv
@bv = current_user.bill_votes.create({:bill_id => @bill.id, :user_id => current_user.id, :support => (params[:id] == "1" ? 1 : 0) }) unless @bv
@@ -652,8 +652,8 @@ def bill_profile_shared
if @bill.has_wiki_link?
@wiki_url = @bill.wiki_url
- elsif logged_in?
- @wiki_create_url = "#{WIKI_BASE_URL}/Special:AddData/Bill?Bill[common_title]=#{CGI::escape(@bill.title_common[0..70])}&Bill[bill_type]=#{@bill.bill_type}&Bill[type_name]=#{@bill.type_name}&Bill[bill_number]=#{@bill.number}&Bill[congress]=#{DEFAULT_CONGRESS}" #prolly should be rewritten as a post handled by a custom sfEditFormPreloadText call?
+ elsif user_signed_in?
+ @wiki_create_url = "#{Settings.wiki_base_url}/Special:AddData/Bill?Bill[common_title]=#{CGI::escape(@bill.title_common[0..70])}&Bill[bill_type]=#{@bill.bill_type}&Bill[type_name]=#{@bill.type_name}&Bill[bill_number]=#{@bill.number}&Bill[congress]=#{Settings.default_congress}" #prolly should be rewritten as a post handled by a custom sfEditFormPreloadText call?
end
@tabs = [
@@ -663,9 +663,9 @@ def bill_profile_shared
@tabs << ["Money Trail",{:action => 'money', :id => @bill.ident}] unless @bill.bill_interest_groups.empty?
@tabs.concat([
["Wiki","#{@wiki_url}"],
- ["News <span>(#{number_with_delimiter(@bill.news_article_count)})</span> & Blogs <span>(#{number_with_delimiter(@bill.blog_article_count)})</span>",{:action => 'news_blogs', :id => @bill.ident}],
- ["Videos <span>(#{number_with_delimiter(@bill.videos.size)})</span>",{:action => 'videos', :id => @bill.ident}],
- ["Comments <span>(#{number_with_delimiter(@comments.comments.size)})</span>",{:action => 'comments', :id => @bill.ident}]
+ ["News <span>(#{number_with_delimiter(@bill.news_article_count)})</span> & Blogs <span>(#{number_with_delimiter(@bill.blog_article_count)})</span>".html_safe,{:action => 'news_blogs', :id => @bill.ident}],
+ ["Videos <span>(#{number_with_delimiter(@bill.videos.size)})</span>".html_safe,{:action => 'videos', :id => @bill.ident}],
+ ["Comments <span>(#{number_with_delimiter(@comments.comments.size)})</span>".html_safe,{:action => 'comments', :id => @bill.ident}]
])
@top_comments = @bill.comments.find(:all,:include => [:user], :order => "comments.plus_score_count - comments.minus_score_count DESC", :limit => 2)
@bookmarking_image = "/images/fb-bill.jpg"
View
2  app/controllers/commentary_controller.rb
@@ -2,7 +2,7 @@ class CommentaryController < ApplicationController
skip_before_filter :store_location, :only => [:rate]
def rate
- unless current_user == :false
+ unless user_signed_in? == false
commentary = Commentary.find_by_id(params[:id])
score = current_user.commentary_ratings.find_or_initialize_by_commentary_id(commentary.id)
score.rating = params[:value]
View
4 app/controllers/comments_controller.rb
@@ -11,7 +11,7 @@ def add_comment
@comment.commentable_id = object.id
@comment.commentable_type = object.class.to_s
- @comment.user_id = current_user.id if logged_in?
+ @comment.user_id = current_user.id if user_signed_in?
@comment.ip_address = request.remote_ip
parent = nil
@@ -27,7 +27,7 @@ def add_comment
return
end
- if logged_in?
+ if user_signed_in?
unless @comment.save
flash[:error] = "Failed to save."
if parent
View
4 app/controllers/committee_controller.rb
@@ -7,7 +7,7 @@ def index
@house_committees = Committee.by_chamber('house').sort_by { |c| [c.name, (c.subcommittee_name || "")] }.group_by(&:name)
@senate_committees = Committee.by_chamber('senate').sort_by { |c| [c.name, (c.subcommittee_name || "")] }.group_by(&:name)
- @carousel = ObjectAggregate.popular('Committee', DEFAULT_COUNT_TIME).slice(0..7)
+ @carousel = ObjectAggregate.popular('Committee', Settings.default_count_time).slice(0..7)
@page_title = "Committees"
@title_class = "sort"
@@ -54,7 +54,7 @@ def by_chamber
@committees = Committee.by_chamber(@chamber).sort_by { |c| [c.name, (c.subcommittee_name || "")] }.group_by(&:name)
@major = @committees.keys.sort
- @related_committees = ObjectAggregate.popular('Committee', DEFAULT_COUNT_TIME).slice(0..2) unless @custom_sidebar
+ @related_committees = ObjectAggregate.popular('Committee', Settings.default_count_time).slice(0..2) unless @custom_sidebar
@title_class = "sort"
@title_desc = SiteText.find_title_desc('committee_index')
View
5 app/controllers/facebook_controller.rb
@@ -25,7 +25,7 @@ def bill_search
unless params[:facebook][:bill_search].blank?
search_text = prepare_tsearch_query(params[:facebook][:bill_search])
- @bills = Bill.full_text_search(search_text, { :page => 1, :congresses => ["#{DEFAULT_CONGRESS}"]})
+ @bills = Bill.full_text_search(search_text, { :page => 1, :congresses => ["#{Settings.default_congress}"]})
end
render :partial => 'bill_search_results', :layout => false
@@ -40,7 +40,8 @@ def hotbills
end
def mostviewedbills
- @bills = ObjectAggregate.popular('Bill', DEFAULT_COUNT_TIME, 25)
+ @bills = ObjectAggregate.popular('Bill', Settings.default_count_time, 25)
+
@bill_count = 25
respond_to do |format|
View
16 app/controllers/friends_controller.rb
@@ -37,7 +37,7 @@ def tracking_bill
@in_my_state_solr = User.find_users_in_states_tracking([params[:state]], @bill, 1000)
@in_my_state = User.find_for_tracking_table(current_user, @bill, @in_my_state_solr.docs)
end
- elsif logged_in? && !current_user.zipcode.blank?
+ elsif user_signed_in? && !current_user.zipcode.blank?
@state_abbrev = current_user.state_cache.first
@state_name = State.for_abbrev(@state_abbrev)
@in_my_state_solr = User.find_users_in_states_tracking(current_user.state_cache, @bill, 1000)
@@ -54,7 +54,7 @@ def tracking_person
@users = @users_solr.nil? ? [] : User.find_for_tracking_table(current_user, @person, @users_solr.docs)
@page_title = "Users tracking #{@person.short_name}"
- if logged_in? && !current_user.zipcode.blank?
+ if user_signed_in? && !current_user.zipcode.blank?
@in_my_state_solr = User.find_users_in_states_tracking(current_user.state_cache, @person, 1000)
@in_my_state = User.find_for_tracking_table(current_user, @person, @in_my_state_solr.docs)
@in_my_district_solr = User.find_users_in_districts_tracking(current_user.district_cache, @person, 1000)
@@ -68,7 +68,7 @@ def tracking_issue
@users = @users_solr.nil? ? [] : User.find_for_tracking_table(current_user, @issue, @users_solr.docs)
@page_title = "Users tracking #{@issue.term}"
- if logged_in? && !current_user.zipcode.blank?
+ if user_signed_in? && !current_user.zipcode.blank?
@in_my_state_solr = User.find_users_in_states_tracking(current_user.my_state, @issue, 1000)
@in_my_state = User.find_for_tracking_table(current_user, @issue, @in_my_state_solr.docs)
@in_my_district_solr = User.find_users_in_districts_tracking(current_user.my_district, @issue, 1000)
@@ -83,7 +83,7 @@ def tracking_committee
@users = @users_solr.nil? ? [] : User.find_for_tracking_table(current_user, @committee, @users_solr.docs)
@page_title = "Users tracking the #{@committee.name} Committee"
- if logged_in? && !current_user.zipcode.blank?
+ if user_signed_in? && !current_user.zipcode.blank?
@in_my_state_solr = User.find_users_in_states_tracking(current_user.my_state, @committee, 1000)
@in_my_state = User.find_for_tracking_table(current_user, @committee, @in_my_state_solr.docs)
@in_my_district_solr = User.find_users_in_districts_tracking(current_user.my_district, @committee, 1000)
@@ -99,7 +99,7 @@ def supporting_person
@users = @users_solr.nil? ? [] : User.find_for_tracking_table(current_user, @person, @users_solr.docs)
@page_title = "Users Supporting #{@person.short_name}"
- if logged_in? && !current_user.zipcode.blank?
+ if user_signed_in? && !current_user.zipcode.blank?
@in_my_state_solr = User.find_users_in_states_supporting(current_user.state_cache, @person, 1000)
@in_my_state = User.find_for_tracking_table(current_user, @person, @in_my_state_solr.docs)
@in_my_district_solr = User.find_users_in_districts_supporting(current_user.district_cache, @person, 1000)
@@ -116,7 +116,7 @@ def opposing_person
@users = @users_solr.nil? ? [] : User.find_for_tracking_table(current_user, @person, @users_solr.docs)
@page_title = "Users Opposing #{@person.short_name}"
- if logged_in? && !current_user.zipcode.blank?
+ if user_signed_in? && !current_user.zipcode.blank?
@in_my_state_solr = User.find_users_in_states_opposing(current_user.state_cache, @person, 1000)
@in_my_state = User.find_for_tracking_table(current_user, @person, @in_my_state_solr.docs)
@in_my_district_solr = User.find_users_in_districts_opposing(current_user.district_cache, @person, 1000)
@@ -131,7 +131,7 @@ def supporting_bill
@users = @users_solr.nil? ? [] : User.find_for_tracking_table(current_user, @bill, @users_solr.docs)
@page_title = "Users Supporting #{@bill.typenumber}"
- if logged_in? && !current_user.zipcode.blank?
+ if user_signed_in? && !current_user.zipcode.blank?
@in_my_state_solr = User.find_users_in_states_supporting(current_user.state_cache, @bill, 1000)
@in_my_state = User.find_for_tracking_table(current_user, @bill, @in_my_state_solr.docs)
@in_my_district_solr = User.find_users_in_districts_supporting(current_user.district_cache, @bill, 1000)
@@ -146,7 +146,7 @@ def opposing_bill
@users = @users_solr.nil? ? [] : User.find_for_tracking_table(current_user, @bill, @users_solr.docs)
@page_title = "Users Opposing #{@bill.typenumber}"
- if logged_in? && !current_user.zipcode.blank?
+ if user_signed_in? && !current_user.zipcode.blank?
@in_my_state_solr = User.find_users_in_states_opposing(current_user.state_cache, @bill, 1000)
@in_my_state = User.find_for_tracking_table(current_user, @bill, @in_my_state_solr.docs)
@in_my_district_solr = User.find_users_in_districts_opposing(current_user.district_cache, @bill, 1000)
View
2  app/controllers/gossip_controller.rb
@@ -74,7 +74,7 @@ def atom
end
private
def can_gossip
- if !(logged_in? && current_user.user_role.can_manage_text)
+ if !(user_signed_in? && current_user.user_role.can_manage_text)
redirect_to :controller => 'gossip', :action => 'index'
end
end
View
12 app/controllers/index_controller.rb
@@ -6,13 +6,13 @@ def index
@index_tabs = [
{:title => 'Bills in the News',
:partial => 'bill',
- :collection => Bill.find_by_most_commentary('news', 5, 7.days, DEFAULT_CONGRESS),
+ :collection => Bill.find_by_most_commentary('news', 5, 7.days, Settings.default_congress),
:id => 'bns',
:link => 'bill/most/news?types=all',
:count_type => 'news_articles'},
{:title => 'Bills on Blogs',
:partial => 'bill',
- :collection => Bill.find_by_most_commentary('blog', 5, 7.days, DEFAULT_CONGRESS),
+ :collection => Bill.find_by_most_commentary('blog', 5, 7.days, Settings.default_congress),
:id => 'bbg',
:link => 'bill/most/blog?types=all',
:style => 'display: none;',
@@ -26,28 +26,28 @@ def index
:count_type => 'views'},
{:title => 'Most-Viewed Bills',
:partial => 'bill',
- :collection => ObjectAggregate.popular('Bill', DEFAULT_COUNT_TIME, 5),
+ :collection => ObjectAggregate.popular('Bill', Settings.default_count_time, 5),
:id => "bv",
:link => '/bill/most/viewed',
:style => 'display: none;',
:count_type => 'views'},
{:title => 'Most-Viewed Senators',
:partial => 'person',
- :collection => Person.list_chamber('sen', DEFAULT_CONGRESS, "view_count desc", 5),
+ :collection => Person.list_chamber('sen', Settings.default_congress, "view_count desc", 5),
:id => 'ps',
:style => 'display: none;',
:link => '/people/senators?sort=popular',
:count_type => 'views'},
{:title => 'Most-Viewed Reps',
:partial => 'person',
- :collection => Person.list_chamber('rep', DEFAULT_CONGRESS, "view_count desc", 5),
+ :collection => Person.list_chamber('rep', Settings.default_congress, "view_count desc", 5),
:link => '/people/representatives?sort=popular',
:style => 'display: none;',
:id => 'pr',
:count_type => 'views'},
{:title => 'Most-Viewed Issues',
:partial => 'issue',
- :collection => ObjectAggregate.popular('Subject', DEFAULT_COUNT_TIME, 5),
+ :collection => ObjectAggregate.popular('Subject', Settings.default_count_time, 5),
:style => 'display: none;',
:id => 'pis',
:link => '/issues',
View
7 app/controllers/issue_controller.rb
@@ -9,8 +9,7 @@ def index
def alphabetical
@sort = :alphabetical
-
- @carousel = [ObjectAggregate.popular('Subject', DEFAULT_COUNT_TIME).slice(0..9)]
+ @carousel = [ObjectAggregate.popular('Subject', Settings.default_count_time).slice(0..9)]
letter = params[:id]
if letter.nil?
@@ -55,7 +54,7 @@ def by_most_viewed
def by_bill_count
@sort = :by_bill_count
- @carousel = [ObjectAggregate.popular('Subject', DEFAULT_COUNT_TIME).slice(0..9)]
+ @carousel = [ObjectAggregate.popular('Subject', Settings.default_count_time).slice(0..9)]
@order = :bill_count
@subjects = Subject.find(:all, :order => 'bill_count desc, term asc').paginate
@@ -73,7 +72,7 @@ def comments
unless @subject
render :partial => "index/notfound_page", :layout => 'application', :status => "404" and return
end
- congress = params[:congress] ? params[:congress] : DEFAULT_CONGRESS
+ congress = params[:congress] ? params[:congress] : Settings.default_congress
respond_to do |format|
format.html {
@sidebar_stats_object = @subject
View
3  app/controllers/money_trail_controller.rb
@@ -12,8 +12,7 @@ def show
def by_most_viewed
@sort = :popular
- @sectors = ObjectAggregate.popular('Sector', DEFAULT_COUNT_TIME)
-
+ @sectors = ObjectAggregate.popular('Sector', Settings.default_count_time)
@page_title = "Most Viewed Industry Sectors"
@title_class = 'sort'
@title_desc = SiteText.find_title_desc('industry_index')
View
26 app/controllers/people_controller.rb
@@ -37,7 +37,7 @@ def send_person
def people_list
expires_in 20.minutes, :public => true
- congress = params[:congress] ? params[:congress].to_i : DEFAULT_CONGRESS
+ congress = params[:congress] ? params[:congress].to_i : Settings.default_congress
person_type = (params[:person_type] == 'senators') ? 'sen' : 'rep'
@person_type = (person_type == 'sen') ? :senators : :representatives
@sort = (params[:sort] || :state).to_sym
@@ -69,11 +69,11 @@ def people_list
@show_tracked_list = true
@title_desc = SiteText.find_title_desc(person_type == 'sen' ? 'people_senator_list' : 'people_representative_list')
- with_random_news = @people.select{|p| p.news_count.to_i > 0}.rand
- with_random_blogs = @people.select{|p| p.blog_count.to_i > 0}.rand
+ with_random_news = @people.select{|p| p.news_count.to_i > 0}.sample
+ with_random_blogs = @people.select{|p| p.blog_count.to_i > 0}.sample
random_news, random_blogs = [[nil,nil],[nil,nil]]
- random_news = Person.random_commentary(with_random_news.id, "news", 1, DEFAULT_COUNT_TIME) if with_random_news
- random_blogs = Person.random_commentary(with_random_blogs.id, "blog", 1, DEFAULT_COUNT_TIME) if with_random_blogs
+ random_news = Person.random_commentary(with_random_news.id, "news", 1, Settings.default_count_time) if with_random_news
+ random_blogs = Person.random_commentary(with_random_blogs.id, "blog", 1, Settings.default_count_time) if with_random_blogs
@carousel = [random_news, random_blogs, @people.sort{|a,b| b.view_count.to_i <=> a.view_count.to_i}[0..9]]
@@ -170,7 +170,7 @@ def most_commentary
#check for fragment cache here!
unless read_fragment("person_meta_#{@person_type}_#{@sort}_#{@days}")
- @people = Person.list_chamber(person_type, DEFAULT_CONGRESS, "#{@commentary_type}_count DESC")
+ @people = Person.list_chamber(person_type, Settings.default_congress, "#{@commentary_type}_count DESC")
end
respond_to do |format|
format.html { render :action => 'list' }
@@ -216,7 +216,7 @@ def show_f
def comments
@person = Person.find(params[:id], :include => :roles)
- congress = params[:congress] ? params[:congress] : DEFAULT_CONGRESS
+ congress = params[:congress] ? params[:congress] : Settings.default_congress
respond_to do |format|
format.html {
@@ -231,7 +231,7 @@ def comments
end
def show
- congress = params[:congress] ? params[:congress] : DEFAULT_CONGRESS
+ congress = params[:congress] ? params[:congress] : Settings.default_congress
expires_in 20.minutes, :public => true
respond_to do |format|
@@ -479,7 +479,7 @@ def voting_history
bills.id = roll_calls.bill_id AND
roll_calls.id = roll_call_votes.roll_call_id AND
roll_call_votes.person_id = ?
- ORDER BY bills.hot_bill_category_id, bills.lastaction DESC", DEFAULT_CONGRESS, query_stripped, @person.id],
+ ORDER BY bills.hot_bill_category_id, bills.lastaction DESC", Settings.default_congress, query_stripped, @person.id],
:per_page => 30, :page => @page)
@page_title = "Voting History Search: #{@person.name}"
else
@@ -516,7 +516,7 @@ def bills
bill_fulltext.fti_names @@ to_tsquery('english', ?) AND
bills.id = bill_fulltext.bill_id AND
bills.sponsor_id = ?
- ORDER BY bills.hot_bill_category_id, bills.lastaction DESC", DEFAULT_CONGRESS, query_stripped, @person.id],
+ ORDER BY bills.hot_bill_category_id, bills.lastaction DESC", Settings.default_congress, query_stripped, @person.id],
:per_page => 30, :page => @page)
@cosponsored_bills = Bill.paginate_by_sql(
@@ -526,7 +526,7 @@ def bills
bills.id = bill_fulltext.bill_id AND
bills.id = bills_cosponsors.bill_id AND
bills_cosponsors.person_id=?
- ORDER BY bills.hot_bill_category_id, bills.lastaction DESC", DEFAULT_CONGRESS, query_stripped, @person.id],
+ ORDER BY bills.hot_bill_category_id, bills.lastaction DESC", Settings.default_congress, query_stripped, @person.id],
:per_page => 30, :page => @page)
@page_title = "Sponsored Bills Search #{@person.name}"
else
@@ -648,7 +648,7 @@ def person_profile_shared
#direct to create page for bill?
end
- u_approval = current_user.person_approvals.find_by_person_id(@person.id) if logged_in?
+ u_approval = current_user.person_approvals.find_by_person_id(@person.id) if user_signed_in?
@user_approval = u_approval.rating if u_approval
@user_approval = 5 if @user_approval.nil?
@@ -674,7 +674,7 @@ def person_profile_shared
def can_text
- if !(logged_in? && current_user.user_role.can_manage_text)
+ if !(user_signed_in? && current_user.user_role.can_manage_text)
redirect_to admin_url
end
end
View
6 app/controllers/political_notebooks_controller.rb
@@ -80,9 +80,9 @@ def get_notebook
@tag = params[:tag] ||= nil
@type = params[:type] ||= nil
if @tag && @type
- @items = @political_notebook.notebook_items.find_tagged_with(@tag, :conditions => ["type = ?", @type])
+ @items = @political_notebook.notebook_items.tagged_with(@tag, :conditions => ["type = ?", @type])
elsif @tag
- @items = @political_notebook.notebook_items.find_tagged_with @tag
+ @items = @political_notebook.notebook_items.tagged_with @tag
elsif @type
@items = @political_notebook.notebook_items.find(:all, :conditions => ["type = ?", @type])
else
@@ -94,7 +94,7 @@ def get_notebook
end
def is_users_notebook?
- return false unless logged_in?
+ return false unless user_signed_in?
return current_user == @political_notebook.user
end
View
12 app/controllers/profile_controller.rb
@@ -48,7 +48,7 @@ def show
@title_class = "tab-nav"
@profile_nav = @user
- if logged_in? && (current_user.id == @user.id) && @user.zipcode && @user.zip_four
+ if user_signed_in? && (current_user.id == @user.id) && @user.zipcode && @user.zip_four
zd = ZipcodeDistrict.zip_lookup(@user.zipcode, (@user.zip_four ? @user.zip_four : nil)).first
unless zd.nil?
@cd_text = zd.state.to_s + "-" + zd.district.to_s
@@ -93,15 +93,15 @@ def actions
end
def items_tracked
- @atom = {'link' => url_for(:controller => 'user_feeds', :login => @user.login, :action => 'tracked_items', :key => logged_in? ? current_user.feed_key : nil)}
+ @atom = {'link' => url_for(:controller => 'user_feeds', :login => @user.login, :action => 'tracked_items', :key => user_signed_in? ? current_user.feed_key : nil)}
@hide_atom = true
@user = User.find_by_login(params[:login], :include => [:bookmarks]) # => [:bill, {:person => :roles}]}])
@page_title = "#{@user.login}'s Profile"
@profile_nav = @user
@title_class = "tab-nav"
- @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?))
- if logged_in? && current_user.id == @user.id
+ @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?))
+ if user_signed_in? && current_user.id == @user.id
mailing_list = UserMailingList.find_or_create_by_user_id(@user.id)
@show_email_alerts = true
else
@@ -369,7 +369,7 @@ def committees
def edit_profile
- if logged_in?
+ if user_signed_in?
@user = current_user
field = params[:field]
value = params[:value]
@@ -401,7 +401,7 @@ def edit_profile
end
def track
- if logged_in?
+ if user_signed_in?
object = Object.const_get(params[:type])
@this_object = object.find_by_id(params[:id])
if @this_object
View
19 app/controllers/resources_controller.rb
@@ -61,31 +61,31 @@ def syndicator_panel
else
case object_type
when 'sen'
- @items = ObjectAggregate.popular('Person', DEFAULT_COUNT_TIME, 540).select{|p| p.title == 'Sen.'}.slice(0, num_items)
+ @items = ObjectAggregate.popular('Person', Settings.default_count_time, 540).select{|p| p.title == 'Sen.'}.slice(0, num_items)
@title = "Most Viewed Senators on OpenCongress.org"
@feed_link = "/people/atom_top20?type=sen"
@more_link = "/people/senators?sort=popular"
@more_text = "More Senators"
when 'rep'
- @items = ObjectAggregate.popular('Person', DEFAULT_COUNT_TIME, 540).select{|p| p.title == 'Rep.'}.slice(0, num_items)
+ @items = ObjectAggregate.popular('Person', Settings.default_count_time, 540).select{|p| p.title == 'Rep.'}.slice(0, num_items)
@title = "Most Viewed Representatives on OpenCongress.org"
@feed_link = "/people/atom_top20?type=rep"
@more_link = "/people/representatives?sort=popular"
@more_text = "More Representatives"
when 'committee'
- @items = ObjectAggregate.popular('Committee', DEFAULT_COUNT_TIME, num_items)
+ @items = ObjectAggregate.popular('Committee', Settings.default_count_time, num_items)
@title = "Most Viewed Committees on OpenCongress.org"
@feed_link = "/committee/atom_top20"
@more_link = "/committee/most_viewed"
@more_text = "More Commmittees"
when 'issue'
- @items = ObjectAggregate.popular('Subject', DEFAULT_COUNT_TIME, num_items)
+ @items = ObjectAggregate.popular('Subject', Settings.default_count_time, num_items)
@title = "Most Viewed Issues on OpenCongress.org"
@feed_link = "/issue/atom_top20"
@more_link = "/issue/most_viewed"
@more_text = "More Issues"
else
- @items = ObjectAggregate.popular('Bill', DEFAULT_COUNT_TIME, num_items)
+ @items = ObjectAggregate.popular('Bill', Settings.default_count_time, num_items)
@title = "Most Viewed Bills on OpenCongress.org"
@feed_link = "/bill/atom/most/viewed"
@more_link = "/bill/most/viewed"
@@ -122,7 +122,7 @@ def bill_number_search
unless number.blank?
@bills = Bill.find(:all,
- :conditions => ["number = ? AND session = ?", number.to_i, DEFAULT_CONGRESS],
+ :conditions => ["number = ? AND session = ?", number.to_i, Settings.default_congress],
:limit => 5,
:order => 'lastaction DESC')
end
@@ -138,7 +138,8 @@ def bill_status
end
@page_title = 'Bill Status Widget'
- @most_viewed_bills = ObjectAggregate.popular('Bill', DEFAULT_COUNT_TIME, 10) || Bill.find(:all, :limit => 10)
+
+ @most_viewed_bills = ObjectAggregate.popular('Bill', Settings.default_count_time, 10) || Bill.find(:all, :limit => 10)
end
def bill_status_panel
@@ -158,7 +159,7 @@ def issue_bills
@item_type = params[:item_type] || 'new-bill'
@page_title = 'Bills by Issue Area Widget'
- @most_viewed_issues = ObjectAggregate.popular('Subject', DEFAULT_COUNT_TIME, 10) || Issue.find(:all, :limit => 10)
+ @most_viewed_issues = ObjectAggregate.popular('Subject', Settings.default_count_time, 10) || Issue.find(:all, :limit => 10)
end
def issue_bills_panel
@@ -387,7 +388,7 @@ def write_rep_form
unless @user.representative.nil?
@representative = @user.representative
else
- if logged_in? && @user.zipcode
+ if user_signed_in? && @user.zipcode
@sens, @reps = Person.find_current_congresspeople_by_zipcode(@user.zipcode, (@user.zip_four ? @user.zip_four : nil))
if @reps.size == 1
View
33 app/controllers/roll_call_controller.rb
@@ -2,7 +2,7 @@ class RollCallController < ApplicationController
helper :index
skip_before_filter :store_location, :except => [:show, :all]
before_filter :page_view, :only => [:show, :by_number]
- before_filter :login_required, :only => [:make_hot]
+ before_filter :can_blog, :only => [:update_hot]
before_filter :no_users, :only => [:can_blog]
@@VOTE_TYPES = { "+" => "Aye", "-" => "Nay", "0" => "Abstain" }
@@ -129,22 +129,15 @@ def show
end
end
- def make_hot
+ def update_hot
@roll_call = RollCall.find_by_id(params[:id])
- @roll_call.is_hot = true
- @roll_call.hot_date = Time.now
+ @roll_call.is_hot = params[:roll_call][:is_hot]
+ @roll_call.hot_date = Time.now if @roll_call.is_hot
@roll_call.title = params[:roll_call][:title] if params[:roll_call][:title]
@roll_call.save
redirect_back_or_default("/roll_call/show/#{@roll_call.id}")
end
-
- def make_not_hot
- @roll_call = RollCall.find_by_id(params[:id])
- @roll_call.is_hot = false
- @roll_call.save
- redirect_back_or_default("/roll_call/show/#{@roll_call.id}")
- end
-
+
def sublist
@roll_call = RollCall.find(params[:id])
@@ -182,7 +175,7 @@ def all
@sort = 'hotbills'
@rolls = RollCall.find(:all, :include => [:bill, :amendment], :order => 'roll_calls.date DESC',
:conditions => ['roll_calls.date > ? AND bills.hot_bill_category_id IS NOT NULL',
- CONGRESS_START_DATES[DEFAULT_CONGRESS]]).paginate :page => @page
+ Settings.congress_start_dates[Settings.default_congress]]).paginate :page => @page
elsif params[:sort] == 'keyvotes'
@sort = 'keyvotes'
@@ -190,15 +183,16 @@ def all
elsif params[:sort] == 'oldest'
@sort = 'oldest'
@rolls = RollCall.find(:all, :include => [:bill, :amendment], :order => 'date ASC',
- :conditions => ['date > ?', CONGRESS_START_DATES[DEFAULT_CONGRESS]]).paginate :page => @page
+ :conditions => ['date > ?', Settings.congress_start_dates[Settings.default_congress]]).paginate :page => @page
else
@sort = 'newest'
@rolls = RollCall.find(:all, :include => [:bill, :amendment], :order => 'date DESC',
- :conditions => ['date > ?', CONGRESS_START_DATES[DEFAULT_CONGRESS]]).paginate :page => @page
+ :conditions => ['date > ?', Settings.congress_start_dates[Settings.default_congress]]).paginate :page => @page
end
- @carousel = [ObjectAggregate.popular('RollCall', DEFAULT_COUNT_TIME).slice(0..9)]
+ @carousel = [ObjectAggregate.popular('RollCall', Settings.default_count_time).slice(0..9)]
+
@page_title = 'All Roll Calls'
@title_desc = SiteText.find_title_desc('roll_call_all')
@@ -216,7 +210,7 @@ def search
bill_fulltext.fti_names @@ to_tsquery('english', ?) AND
bills.id = bill_fulltext.bill_id AND
roll_calls.bill_id=bills.id
- ORDER BY bills.hot_bill_category_id, roll_calls.date DESC", DEFAULT_CONGRESS, query_stripped]
+ ORDER BY bills.hot_bill_category_id, roll_calls.date DESC", Settings.default_congress, query_stripped]
)
render :partial => 'roll_calls_list', :locals => { :rolls => @rolls }, :layout => false
@@ -299,8 +293,9 @@ def roll_call_shared
@nay_chart = ofc2(400,220, "roll_call/partyvote_piechart_data/#{@roll_call.id}?breakdown_type=-")
@abstain_chart = ofc2(400,220, "roll_call/partyvote_piechart_data/#{@roll_call.id}?breakdown_type=0")
-
- @page_title = "#{@roll_call.chamber} Roll Call ##{@roll_call.number} Details"
+ @page_title = @roll_call.title.blank? ? "" : "#{@roll_call.title} - "
+ @page_title += "#{@roll_call.chamber} Roll Call ##{@roll_call.number} Details"
+
@title_desc = SiteText.find_title_desc('roll_call_show')
end
end
View
6 app/controllers/search_controller.rb
@@ -13,7 +13,7 @@ def result
@query = params[:q]
@page = (params[:page] || 1).to_i
@found_items = 0
- @congresses = params[:search_congress] ? params[:search_congress].keys : ["#{DEFAULT_CONGRESS}"]
+ @congresses = params[:search_congress] ? params[:search_congress].keys : ["#{Settings.default_congress}"]
unless @query
flash.now[:notice] = "You didn't enter anything in the search field!"
@@ -119,8 +119,8 @@ def result
end
if (@found_items == 0)
- if (@congresses == ["#{DEFAULT_CONGRESS}"])
- flash.now[:notice] = "Sorry, your search returned no results in the current #{DEFAULT_CONGRESS}th Congress."
+ if (@congresses == ["#{Settings.default_congress}"])
+ flash.now[:notice] = "Sorry, your search returned no results in the current #{Settings.default_congress}th Congress."
else
flash.now[:notice] = "Sorry, your search returned no results."
end
View
60 app/helpers/application_helper.rb
@@ -1,5 +1,3 @@
-# Methods added to this helper will be available to all templates in
-# the application.
module ApplicationHelper
def split_list(list, attribute, item_limit, action, controller = nil, show_views = false, trunc = false)
item_limit = list.size if item_limit > list.size
@@ -20,7 +18,7 @@ def link_to_item(item, attribute, action, controller = nil, show_views = false,
if item.kind_of? Bill
link_text += "<span class=\"date\"><span>#{temp_url_strip(item.status)}</span>#{item.last_action.formatted_date if item.last_action}</span>"
end
- link_text += show_views ? "<span class=\"views_count\"><span>#{item.views(DEFAULT_COUNT_TIME) if show_views}</span> views</span>" : ""
+ link_text += show_views ? "<span class=\"views_count\"><span>#{item.views(Settings.default_count_time) if show_views}</span> views</span>" : ""
if item.kind_of? Bill
controller ? link_to(link_text, { :action => action, :controller => controller, :id => item.ident }) :
@@ -245,11 +243,11 @@ def openhouse_button
end
def technorati_button
- '<a class="technorati" target="_blank" href="http://www.technorati.com">Information made available by <strong>Technorati</strong></a>'
+ '<a class="technorati" target="_blank" href="http://www.technorati.com">Information made available by <strong>Technorati</strong></a>'.html_safe