Permalink
Browse files

Merge remote-tracking branch 'stiff/master'

  • Loading branch information...
2 parents 0409c17 + b1439b0 commit f5d10a0950c23947d24bf35778eabf5215745ca3 @brodock brodock committed Dec 20, 2011
Showing with 980 additions and 910 deletions.
  1. +3 −4 Gemfile
  2. +34 −34 Gemfile.lock
  3. +3 −10 app/controllers/application_controller.rb
  4. +9 −5 app/controllers/forums_controller.rb
  5. +5 −3 app/controllers/monitorships_controller.rb
  6. +19 −16 app/controllers/posts_controller.rb
  7. +39 −41 app/controllers/sessions_controller.rb
  8. +15 −6 app/controllers/sites_controller.rb
  9. +10 −9 app/controllers/topics_controller.rb
  10. +20 −22 app/controllers/users_controller.rb
  11. +12 −7 app/helpers/application_helper.rb
  12. +22 −0 app/helpers/error_messages_helper.rb
  13. +2 −3 app/helpers/forums_helper.rb
  14. +9 −10 app/helpers/users_helper.rb
  15. +22 −0 app/mailers/user_mailer.rb
  16. +7 −10 app/models/forum.rb
  17. +14 −12 app/models/moderatorship.rb
  18. +16 −15 app/models/monitorship.rb
  19. +17 −16 app/models/post.rb
  20. +0 −12 app/models/posts_sweeper.rb
  21. +22 −20 app/models/site.rb
  22. +41 −42 app/models/topic.rb
  23. +24 −22 app/models/user.rb
  24. +1 −1 app/models/user/editable.rb
  25. +8 −8 app/models/user/posting.rb
  26. +25 −24 app/models/user/states.rb
  27. +28 −28 app/models/user/validation.rb
  28. +0 −22 app/models/user_mailer.rb
  29. +4 −4 app/{models → sweepers}/monitorships_sweeper.rb
  30. +12 −0 app/sweepers/posts_sweeper.rb
  31. +16 −18 app/views/forums/_form.html.erb
  32. +4 −4 app/views/forums/edit.html.erb
  33. +8 −11 app/views/forums/index.html.erb
  34. +4 −4 app/views/forums/new.html.erb
  35. +33 −16 app/views/forums/show.html.erb
  36. +16 −0 app/views/layouts/_footer.html.erb
  37. +20 −40 app/views/layouts/_head.html.erb
  38. +33 −40 app/views/layouts/application.html.erb
  39. +22 −23 app/views/posts/_edit.html.erb
  40. 0 app/views/posts/{_formatting.erb → _formatting.html.erb}
  41. +7 −8 app/views/posts/edit.html.erb
  42. +27 −27 app/views/posts/index.html.erb
  43. +4 −4 app/views/sessions/new.html.erb
  44. +0 −10 app/views/shared/_error_messages.html.erb
  45. +1 −2 app/views/sites/_form.html.erb
  46. +4 −6 app/views/sites/edit.html.erb
  47. +3 −3 app/views/sites/index.html.erb
  48. +5 −5 app/views/sites/new.html.erb
  49. +1 −1 app/views/sites/show.html.erb
  50. +18 −19 app/views/topics/_form.html.erb
  51. +1 −2 app/views/topics/edit.html.erb
  52. +6 −8 app/views/topics/new.html.erb
  53. +122 −69 app/views/topics/show.html.erb
  54. +0 −3 app/views/user_mailer/activation.html.erb
  55. +3 −0 app/views/user_mailer/activation.text.erb
  56. +1 −1 app/views/user_mailer/{signup_notification.html.erb → signup_notification.text.erb}
  57. +0 −1 app/views/users/_settings.html.erb
  58. +5 −6 app/views/users/edit.html.erb
  59. +8 −9 app/views/users/index.html.erb
  60. +17 −16 app/views/users/new.html.erb
  61. +46 −6 app/views/users/show.html.erb
  62. +1 −1 config/application.rb
  63. +3 −10 config/boot.rb
  64. +3 −0 config/initializers/error_messages.rb
  65. +1 −1 config/locales/de.yml
  66. +1 −1 config/locales/en.yml
  67. +0 −20 config/preinitializer.rb
  68. +1 −1 lib/authenticated_system.rb
  69. +3 −3 lib/tasks/app_bootstrap.rake
  70. +0 −74 public/stylesheets/scaffold.css
  71. +13 −6 spec/models/user_spec.rb
  72. +2 −0 spec/spec_helper.rb
  73. +2 −2 vendor/plugins/model_stubbing/lib/model_stubbing.rb
  74. +4 −9 vendor/plugins/model_stubbing/lib/model_stubbing/definition.rb
  75. +23 −7 vendor/plugins/model_stubbing/lib/model_stubbing/extensions.rb
  76. +43 −5 vendor/plugins/model_stubbing/lib/model_stubbing/model.rb
  77. +1 −1 vendor/plugins/model_stubbing/lib/model_stubbing/stub.rb
  78. +1 −1 ...r/plugins/rspec_on_rails_on_crack/lib/rspec_on_rails_on_crack/controller_example_group_methods.rb
View
@@ -1,7 +1,6 @@
-# A sample Gemfile
source "http://rubygems.org"
-gem "rails", "3.0.5"
+gem 'rails', '3.0.7'
gem 'ruby-openid', '>= 2.0.4', :require => "openid"
gem 'rack-openid'
gem 'will_paginate', :git => "http://github.com/mislav/will_paginate.git", :branch => "rails3"
@@ -16,11 +15,11 @@ group :development, :test do
gem 'rspec-rails'
gem 'highline'
gem 'sqlite3-ruby', :require => "sqlite3"
-# gem 'ruby-debug' # XXX linecache gem currently doesn't work in ruby 1.9
+ # gem 'ruby-debug19'
gem 'autotest'
gem 'rails3-generators'
end
group :production do
- gem 'mysql2'
+ gem 'mysql2', '~> 0.2.7'
end
View
@@ -11,32 +11,32 @@ GEM
RedCloth (4.2.7)
ZenTest (4.5.0)
abstract (1.0.0)
- actionmailer (3.0.5)
- actionpack (= 3.0.5)
+ actionmailer (3.0.7)
+ actionpack (= 3.0.7)
mail (~> 2.2.15)
- actionpack (3.0.5)
- activemodel (= 3.0.5)
- activesupport (= 3.0.5)
+ actionpack (3.0.7)
+ activemodel (= 3.0.7)
+ activesupport (= 3.0.7)
builder (~> 2.1.2)
erubis (~> 2.6.6)
- i18n (~> 0.4)
+ i18n (~> 0.5.0)
rack (~> 1.2.1)
- rack-mount (~> 0.6.13)
+ rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
- activemodel (3.0.5)
- activesupport (= 3.0.5)
+ activemodel (3.0.7)
+ activesupport (= 3.0.7)
builder (~> 2.1.2)
- i18n (~> 0.4)
- activerecord (3.0.5)
- activemodel (= 3.0.5)
- activesupport (= 3.0.5)
+ i18n (~> 0.5.0)
+ activerecord (3.0.7)
+ activemodel (= 3.0.7)
+ activesupport (= 3.0.7)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
- activeresource (3.0.5)
- activemodel (= 3.0.5)
- activesupport (= 3.0.5)
- activesupport (3.0.5)
+ activeresource (3.0.7)
+ activemodel (= 3.0.7)
+ activesupport (= 3.0.7)
+ activesupport (3.0.7)
acts_as_list (0.1.2)
acts_as_state_machine (2.2.0)
activerecord (>= 2.1)
@@ -50,44 +50,44 @@ GEM
abstract (>= 1.0.0)
highline (1.6.1)
i18n (0.5.0)
- mail (2.2.15)
+ mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
- mysql2 (0.2.6)
+ mysql2 (0.2.7)
permalink_fu (1.0.0)
polyglot (0.3.1)
rack (1.2.2)
- rack-mount (0.6.13)
+ rack-mount (0.6.14)
rack (>= 1.0.0)
rack-openid (1.3.1)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-test (0.5.7)
rack (>= 1.0)
- rails (3.0.5)
- actionmailer (= 3.0.5)
- actionpack (= 3.0.5)
- activerecord (= 3.0.5)
- activeresource (= 3.0.5)
- activesupport (= 3.0.5)
+ rails (3.0.7)
+ actionmailer (= 3.0.7)
+ actionpack (= 3.0.7)
+ activerecord (= 3.0.7)
+ activeresource (= 3.0.7)
+ activesupport (= 3.0.7)
bundler (~> 1.0)
- railties (= 3.0.5)
+ railties (= 3.0.7)
rails3-generators (0.17.4)
railties (>= 3.0.0)
- railties (3.0.5)
- actionpack (= 3.0.5)
- activesupport (= 3.0.5)
+ railties (3.0.7)
+ actionpack (= 3.0.7)
+ activesupport (= 3.0.7)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
rspec (2.5.0)
rspec-core (~> 2.5.0)
rspec-expectations (~> 2.5.0)
rspec-mocks (~> 2.5.0)
- rspec-core (2.5.1)
+ rspec-core (2.5.2)
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
@@ -103,7 +103,7 @@ GEM
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
- tzinfo (0.3.25)
+ tzinfo (0.3.27)
PLATFORMS
ruby
@@ -115,10 +115,10 @@ DEPENDENCIES
autotest
bluecloth
highline
- mysql2
+ mysql2 (~> 0.2.7)
permalink_fu
rack-openid
- rails (= 3.0.5)
+ rails (= 3.0.7)
rails3-generators
rspec-rails
ruby-openid (>= 2.0.4)
@@ -4,9 +4,8 @@ class ApplicationController < ActionController::Base
include AuthenticatedSystem
helper_method :current_page
- before_filter :set_language
before_filter :login_required, :only => [:new, :edit, :create, :update, :destroy]
-
+
# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery # :secret => 'e125a4be589f9d81263920581f6e4182'
@@ -15,15 +14,9 @@ class ApplicationController < ActionController::Base
rescue_from Site::UndefinedError do |e|
redirect_to new_site_path
end
-
- def current_page
- @page ||= params[:page].blank? ? 1 : params[:page].to_i
- end
- private
-
- def set_language
- I18n.locale = :'pt-BR' || I18n.default_locale
+ def current_page
+ @page ||= [1, params[:page].to_i].max
end
end
@@ -1,5 +1,6 @@
class ForumsController < ApplicationController
before_filter :admin_required, :except => [:index, :show]
+ before_filter :find_forum, :only => [:show, :edit, :update, :destroy]
# GET /forums
# GET /forums.xml
@@ -18,7 +19,6 @@ def index
# GET /forums/1
# GET /forums/1.xml
def show
- @forum = current_site.forums.find_by_permalink!(params[:id])
(session[:forums] ||= {})[@forum.id] = Time.now.utc
(session[:forums_page] ||= Hash.new(1))[@forum.id] = current_page if current_page > 1
@@ -33,7 +33,7 @@ def show
# GET /forums/new
# GET /forums/new.xml
def new
- @forum = Forum.new
+ @forum = current_site.forums.new
respond_to do |format|
format.html # new.html.erb
@@ -43,7 +43,6 @@ def new
# GET /forums/1/edit
def edit
- @forum = current_site.forums.find_by_permalink!(params[:id])
end
# POST /forums
@@ -66,7 +65,6 @@ def create
# PUT /forums/1
# PUT /forums/1.xml
def update
- @forum = current_site.forums.find_by_permalink(params[:id])
respond_to do |format|
if @forum.update_attributes(params[:forum])
@@ -83,12 +81,18 @@ def update
# DELETE /forums/1
# DELETE /forums/1.xml
def destroy
- @forum = current_site.forums.find_by_permalink(params[:id])
@forum.destroy
respond_to do |format|
format.html { redirect_to(forums_path) }
format.xml { head :ok }
end
end
+
+ protected
+
+ def find_forum
+ @forum = current_site.forums.find_by_permalink!(params[:id])
+ end
+
end
@@ -1,6 +1,8 @@
class MonitorshipsController < ApplicationController
before_filter :login_required
+ cache_sweeper :monitorships_sweeper
+
def create
@monitorship = Monitorship.find_or_initialize_by_user_id_and_topic_id(current_user.id, params[:topic_id])
@monitorship.update_attribute :active, true
@@ -9,12 +11,12 @@ def create
format.js
end
end
-
+
def destroy
- Monitorship.update_all ['active = ?', false], ['user_id = ? and topic_id = ?', current_user.id, params[:topic_id]]
+ Monitorship.where(:user_id => current_user.id, :topic_id => params[:topic_id]).update_all(:active => false)
respond_to do |format|
format.html { redirect_to topic_path(params[:forum_id], params[:topic_id]) }
format.js
end
end
-end
+end
@@ -2,6 +2,8 @@ class PostsController < ApplicationController
before_filter :find_parents
before_filter :find_post, :only => [:edit, :update, :destroy]
+ cache_sweeper :posts_sweeper, :only => [:create, :update, :destroy]
+
# /posts
# /users/1/posts
# /forums/1/posts
@@ -70,22 +72,23 @@ def destroy
end
end
-protected
- def find_parents
- if params[:user_id]
- @parent = @user = User.find(params[:user_id])
- elsif params[:forum_id]
- @parent = @forum = Forum.find_by_permalink(params[:forum_id])
- @parent = @topic = @forum.topics.find_by_permalink(params[:topic_id]) if params[:topic_id]
+ protected
+
+ def find_parents
+ if params[:user_id]
+ @parent = @user = User.find(params[:user_id])
+ elsif params[:forum_id]
+ @parent = @forum = Forum.find_by_permalink(params[:forum_id])
+ @parent = @topic = @forum.topics.find_by_permalink(params[:topic_id]) if params[:topic_id]
+ end
end
- end
- def find_post
- post = @topic.posts.find(params[:id])
- if post.user == current_user || current_user.admin?
- @post = post
- else
- raise ActiveRecord::RecordNotFound
+ def find_post
+ post = @topic.posts.find(params[:id])
+ if post.user == current_user || current_user.admin?
+ @post = post
+ else
+ raise ActiveRecord::RecordNotFound
+ end
end
- end
-end
+end
Oops, something went wrong.

0 comments on commit f5d10a0

Please sign in to comment.