Skip to content
Browse files

rails3 fixes

  • Loading branch information...
1 parent b6a02e8 commit bd5f7ffbd7087d839b58749c8b6e77c14bee8cc5 @bborn committed
Showing with 1,401 additions and 1,987 deletions.
  1. +16 −0 CHANGELOG
  2. +13 −12 Gemfile
  3. +1 −1 README.markdown
  4. +6 −1 Rakefile
  5. +1 −1 app/controllers/comments_controller.rb
  6. +1 −1 app/controllers/forums_controller.rb
  7. +1 −1 app/controllers/friendships_controller.rb
  8. +3 −1 app/controllers/sessions_controller.rb
  9. +5 −10 app/controllers/users_controller.rb
  10. +55 −60 app/helpers/base_helper.rb
  11. +1 −5 app/helpers/users_helper.rb
  12. +2 −2 app/models/clipping.rb
  13. +1 −1 app/models/clipping_image.rb
  14. +12 −21 app/models/comment.rb
  15. +1 −1 app/models/contest.rb
  16. +2 −2 app/models/event.rb
  17. +2 −2 app/models/favorite.rb
  18. +3 −3 app/models/friendship.rb
  19. +1 −3 app/models/homepage_feature.rb
  20. +1 −1 app/models/invitation.rb
  21. +2 −2 app/models/message.rb
  22. +19 −4 app/models/photo.rb
  23. +9 −9 app/models/post.rb
  24. +6 −29 app/models/sb_post.rb
  25. +1 −1 app/models/tag.rb
  26. +1 −1 app/models/topic.rb
  27. +52 −70 app/models/user.rb
  28. +34 −34 app/models/user_notifier.rb
  29. +2 −2 app/models/user_observer.rb
  30. +1 −1 app/views/activities/index.html.haml
  31. +1 −1 app/views/activities/network.html.haml
  32. +4 −4 app/views/admin/comments.html.haml
  33. +2 −2 app/views/admin/users.html.haml
  34. +1 −1 app/views/ads/edit.html.haml
  35. +1 −1 app/views/ads/index.html.haml
  36. +1 −1 app/views/ads/new.html.haml
  37. +1 −1 app/views/albums/edit.html.haml
  38. +1 −1 app/views/albums/new.html.haml
  39. +1 −1 app/views/albums/show.html.haml
  40. +1 −1 app/views/base/teaser.html.haml
  41. +1 −1 app/views/categories/edit.html.haml
  42. +1 −1 app/views/categories/new.html.haml
  43. +1 −1 app/views/categories/show.html.haml
  44. +1 −1 app/views/clippings/edit.html.haml
  45. +1 −1 app/views/clippings/new.html.haml
  46. +2 −2 app/views/clippings/new_clipping.html.haml
  47. +1 −1 app/views/events/edit.html.haml
  48. +1 −1 app/views/events/new.html.haml
  49. +1 −1 app/views/forums/edit.html.haml
  50. +1 −1 app/views/forums/new.html.haml
  51. +1 −1 app/views/forums/show.html.haml
  52. +3 −3 app/views/friendships/index.xml.builder
  53. +1 −1 app/views/homepage_features/edit.html.haml
  54. +1 −1 app/views/homepage_features/new.html.haml
  55. +1 −1 app/views/invitations/new.html.haml
  56. +4 −3 app/views/layouts/application.html.haml
  57. +2 −2 app/views/layouts/beta.html.haml
  58. +1 −1 app/views/messages/_form.html.haml
  59. +2 −2 app/views/messages/index.html.haml
  60. +1 −1 app/views/metro_areas/edit.html.haml
  61. +1 −1 app/views/metro_areas/index.html.haml
  62. +1 −1 app/views/metro_areas/new.html.haml
  63. +1 −1 app/views/pages/edit.html.haml
  64. +1 −1 app/views/pages/edit.html.haml~
  65. +1 −1 app/views/pages/new.html.haml
  66. +1 −1 app/views/password_resets/edit.html.haml
  67. +1 −1 app/views/password_resets/new.html.haml
  68. +1 −1 app/views/photo_manager/index.html.haml
  69. +1 −1 app/views/photos/_manage_photos.html.haml
  70. +1 −1 app/views/photos/edit.html.haml
  71. +2 −2 app/views/photos/new.html.haml
  72. +1 −1 app/views/photos/recent.html.haml
  73. +1 −1 app/views/posts/edit.html.haml
  74. +2 −2 app/views/posts/manage.html.haml
  75. +1 −1 app/views/posts/new.html.haml
  76. +1 −1 app/views/rsvps/edit.html.haml
  77. +1 −1 app/views/rsvps/new.html.haml
  78. +1 −1 app/views/sessions/new.html.haml
  79. +10 −10 app/views/shared/_header.html.haml
  80. +3 −3 app/views/shared/_login_sidebar.html.haml
  81. +4 −12 app/views/shared/_scripts_and_styles.html.haml
  82. +2 −2 app/views/sitemap/index.xml.builder
  83. +1 −1 app/views/skills/edit.html.haml
  84. +2 −2 app/views/skills/index.html.haml
  85. +1 −1 app/views/skills/new.html.haml
  86. +1 −1 app/views/skills/show.html.haml
  87. +1 −1 app/views/tags/edit.html.haml
  88. +1 −1 app/views/tags/manage.html.haml
  89. +2 −2 app/views/tags/show.html.haml
  90. +1 −1 app/views/topics/edit.html.haml
  91. +1 −1 app/views/topics/new.html.haml
  92. +1 −1 app/views/topics/show.html.haml
  93. +1 −1 app/views/user_notifier/follow_up_comment_notice.erb
  94. +1 −1 app/views/user_notifier/new_forum_post_notice.erb
  95. +1 −12 app/views/users/_search_options.html.haml
  96. +1 −1 app/views/users/crop_profile_photo.html.haml
  97. +1 −1 app/views/users/dashboard.html.haml
  98. +1 −1 app/views/users/edit.html.haml
  99. +1 −1 app/views/users/edit_account.html.haml
  100. +1 −1 app/views/users/forgot_username.html.haml
  101. +2 −2 app/views/users/index.html.haml
  102. +1 −1 app/views/users/invite.html.haml
  103. +1 −1 app/views/users/new.html.haml
  104. +1 −1 app/views/users/resend_activation.html.haml
  105. +1 −1 app/views/users/statistics.html.haml
  106. +1 −1 app/views/users/upload_profile_photo.html.haml
  107. +1 −1 app/views/users/welcome_about.html.haml
  108. +1 −1 app/views/users/welcome_invite.html.haml
  109. +1 −1 app/views/users/welcome_photo.html.haml
  110. +12 −76 community_engine.gemspec
  111. +4 −0 config/application.yml
  112. +41 −41 config/initializers/mce_options.rb
  113. +0 −1 config/initializers/mimes.rb
  114. +10 −5 config/initializers/rakismet.rb
  115. +61 −61 {lang/ui → config/locales}/de-DE.yml
  116. +148 −148 {lang/ui → config/locales}/en.yml
  117. +70 −70 {lang/ui → config/locales}/es-AR.yml
  118. +24 −24 {lang/ui → config/locales}/es-ES.yml
  119. +40 −40 {lang/ui → config/locales}/es-MX.yml
  120. +142 −142 {lang/ui → config/locales}/fr-FR.yml
  121. +77 −77 {lang/ui → config/locales}/ja-JP.yml
  122. 0 {lang/ui → config/locales}/ru-RU.yml
  123. +4 −4 {lang/ui → config/locales}/sr-CP.yml
  124. +85 −85 {lang/ui → config/locales}/sv-SE.yml
  125. +199 −142 config/routes.rb
  126. +1 −1 generators/ce_plugin/templates/init.rb
  127. +1 −1 init.rb
  128. +1 −1 lib/authenticated_system.rb
  129. +17 −14 lib/community_engine.rb
  130. +5 −10 lib/engine.rb
  131. +0 −16 lib/flash_session_cookie_middleware.rb
  132. +32 −0 lib/i18n_extensions.rb
  133. +1 −1 lib/localized_application.rb
  134. +12 −27 { → lib}/tasks/community_engine_tasks.rake
  135. +6 −6 { → lib}/tasks/s3.rake
  136. +0 −17 sample_files/deployment_templates/database.erb
  137. +0 −216 sample_files/deployment_templates/deploy.erb
  138. +0 −62 sample_files/deployment_templates/god.erb
  139. +0 −8 sample_files/deployment_templates/mongrel.erb
  140. +0 −7 sample_files/deployment_templates/mysql.erb
  141. +0 −43 sample_files/deployment_templates/nginx.erb
  142. BIN sample_files/sample_themes/dappled/images/bg_body.png
  143. BIN sample_files/sample_themes/dappled/images/header.jpg
  144. +0 −76 sample_files/sample_themes/dappled/stylesheets/screen.css
  145. +0 −10 sample_files/sample_themes/dappled/views/base/_homepage_banner_message.html.haml
  146. +0 −39 sample_files/sample_themes/dappled/views/shared/_header.html.haml
  147. +0 −35 sample_files/sample_themes/dappled/views/shared/_scripts_and_styles.html.haml
  148. +0 −29 tasks/deployment.rake
  149. +3 −3 test/test_helper.rb
  150. +12 −12 test/unit/user_notifier_test.rb
  151. +5 −5 vendor/plugins/activity_tracker/lib/activity.rb
  152. +2 −2 vendor/plugins/activity_tracker/lib/activity_tracker.rb
  153. +3 −3 vendor/plugins/acts_as_publishable/lib/acts_as_publishable.rb
  154. +6 −1 vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb
  155. +2 −2 vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/cloud_file_backend.rb
  156. +2 −2 vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb
  157. +1 −1 vendor/plugins/attachment_fu/test/test_helper.rb
  158. +1 −1 vendor/plugins/mimetype-fu/spec/spec_helper.rb
  159. +1 −1 vendor/plugins/recaptcha/lib/recaptcha.rb
  160. +1 −1 vendor/plugins/resource_feeder/test/test_helper.rb
  161. +1 −1 vendor/plugins/resource_hacks/test/test_helper.rb
  162. +2 −6 vendor/plugins/tiny_mce/lib/tiny_mce_helper.rb
View
16 CHANGELOG
@@ -16,6 +16,22 @@
* remove all the theming stuff
* asset paths https://github.com/rails/rails/commit/a132229d7b4382d9ffe8847fa58f469cb8f2ecfc#L5L149
* take out ez where
+* fix initializers/rakismet, recaptcha etc.
+* take out vendors/offerings crap
+* go back and fix: Rails 3 Fix comments
+* searchlogic broken with rails 3 gem 'searchlogic', :git => git://github.com/railsdog/searchlogic.git
+* copy new migrations from main app back into ce
+* don't allow show_localization_keys_for_debugging
+* remote_form_for is gone
+* remove stylesheet customization
+* rework users index to use searchlogic/metaseach or something
+* use aato instead of aatos
+* authlogic has problems: not sure it's recording last_login magic columns, investigate
+* finding transparently by login is broken
+
+
+GOTCHAS:
+* edge rails needs edge rack? and edge arel
=1.2.1
* Anonymous forum replies
View
25 Gemfile
@@ -1,14 +1,15 @@
source "http://rubygems.org"
-gem 'rails', '3.1.0.beta', :git => 'git://github.com/rails/rails.git'
-gem 'configatron'
-gem 'hpricot'
-gem 'rmagick'
-gem 'htmlentities'
-gem 'haml'
-gem 'calendar_date_select'
-gem 'ri_cal'
-gem 'authlogic'
-gem 'searchlogic'
-gem 'rakismet'
-gem 'aws-s3'
+# gem 'rails', '3.1.0.beta', :git => 'git://github.com/rails/rails.git'
+# gem 'rails'
+# gem 'configatron'
+# gem 'hpricot'
+# gem 'rmagick'
+# gem 'htmlentities'
+# gem 'haml'
+# gem 'calendar_date_select'
+# gem 'ri_cal'
+# gem 'authlogic'
+# gem 'searchlogic'
+# gem 'rakismet'
+# gem 'aws-s3'
View
2 README.markdown
@@ -221,7 +221,7 @@ The language only file (`es.yml`) will support all locales.
To wrap all localized strings in a `<span>` that shows their localization key, put this in your `environment.rb`:
- configatron.show_localization_keys_for_debugging = true if RAILS_ENV.eql?('development')
+ configatron.show_localization_keys_for_debugging = true if Rails.env.eql?('development')
Note, this will affect the look and feel of buttons. You can highlight what is localized by using the `span.localized` style (look in `screen.css`)
View
7 Rakefile
@@ -32,6 +32,7 @@ begin
gem.version = '1.9.9'
gem.add_dependency 'rails', '3.1.0.beta'
+ gem.add_dependency 'rack', '1.2.1'
gem.add_dependency 'configatron'
gem.add_dependency 'hpricot'
gem.add_dependency 'rmagick'
@@ -40,9 +41,13 @@ begin
gem.add_dependency 'calendar_date_select'
gem.add_dependency 'ri_cal'
gem.add_dependency 'authlogic'
- gem.add_dependency 'searchlogic'
+
+ gem.add_dependency 'rd_searchlogic', '3.0.1'
gem.add_dependency 'rakismet'
gem.add_dependency 'aws-s3'
+ gem.add_dependency "will_paginate", "~> 3.0.pre2"
+ gem.add_dependency "dynamic_form"
+
# other fields that would normally go in your gemspec
# like authors, email and has_rdoc can also be included here
View
2 app/controllers/comments_controller.rb
@@ -156,7 +156,7 @@ def comment_link
end
def full_comment_link
- "#{application_url}#{comment_link}"
+ "#{home_url}#{comment_link}"
end
def comment_rss_link
View
2 app/controllers/forums_controller.rb
@@ -3,7 +3,7 @@ class ForumsController < BaseController
before_filter :find_or_initialize_forum
helper :application
- uses_tiny_mce do
+ uses_tiny_mce do
configatron.default_mce_options
end
View
2 app/controllers/friendships_controller.rb
@@ -97,7 +97,7 @@ def create
respond_to do |format|
if @friendship.save && reverse_friendship.save
- UserNotifier.deliver_friendship_request(@friendship) if @friendship.friend.notify_friend_requests?
+ UserNotifier.friendship_request(@friendship) if @friendship.friend.notify_friend_requests?
format.html {
flash[:notice] = :friendship_requested.l_with_args(:friend => @friendship.friend.login)
redirect_to accepted_user_friendships_path(@user)
View
4 app/controllers/sessions_controller.rb
@@ -15,9 +15,11 @@ def new
end
def create
+
@user_session = UserSession.new(:login => params[:login], :password => params[:password], :remember_me => params[:remember_me])
- if @user_session.save
+ if @user_session.save!
+
current_user = @user_session.record #if current_user has been called before this, it will ne nil, so we have to make to reset it
View
15 app/controllers/users_controller.rb
@@ -1,4 +1,3 @@
-require "RMagick"
class UsersController < BaseController
include Viewable
@@ -56,14 +55,10 @@ def deactivate
redirect_to login_path
end
- def index
- cond, @search, @metro_areas, @states = User.paginated_users_conditions_with_search(params)
+ def index
+ @users = User.active.paginate(:page => params[:page]) #Rails 3 fix no search!
- @users = User.recent.find(:all,
- :conditions => cond.to_sql,
- :include => [:tags],
- :page => {:current => params[:page], :size => 20}
- )
+ @metro_areas, @states = User.find_country_and_state_from_search_params(params)
@tags = User.tag_counts :limit => 10
@@ -316,7 +311,7 @@ def forgot_username
return unless request.post?
if @user = User.active.find_by_email(params[:email])
- UserNotifier.deliver_forgot_username(@user)
+ UserNotifier.forgot_username(@user)
redirect_to login_url
flash[:info] = :your_username_was_emailed_to_you.l
else
@@ -335,7 +330,7 @@ def resend_activation
if @user && !@user.active?
flash[:notice] = :activation_email_resent_message.l
- UserNotifier.deliver_signup_notification(@user)
+ UserNotifier.signup_notification(@user)
redirect_to login_path and return
else
flash[:notice] = :activation_email_not_sent_message.l
View
115 app/helpers/base_helper.rb
@@ -1,4 +1,3 @@
-require 'md5'
# Methods added to this helper will be available to all templates in the application.
module BaseHelper
@@ -12,7 +11,7 @@ def commentable_url(comment)
end
def forum_page?
- %w(forums topics sb_posts).include?(@controller.controller_name)
+ %w(forums topics sb_posts).include?(controller.controller_name)
end
def is_current_user_and_featured?(u)
@@ -109,74 +108,76 @@ def excerpt_with_jump(text, end_string = ' ...')
end
def page_title
+ divider = " | ".html_safe
+
app_base = configatron.community_name
- tagline = " | #{configatron.community_tagline}"
-
+ tagline = " #{divider} #{configatron.community_tagline}"
title = app_base
- case @controller.controller_name
+
+ case controller.controller_name
when 'base'
- title += tagline
- when 'pages'
- if @page and @page.title
- title = @page.title + ' &raquo; ' + app_base + tagline
- end
+ title += tagline
+ when 'pages'
+ if @page and @page.title
+ title = @page.title + divider + app_base + tagline
+ end
when 'posts'
if @post and @post.title
- title = @post.title + ' &raquo; ' + app_base + tagline
- title += (@post.tags.empty? ? '' : " &laquo; "+:keywords.l+": " + @post.tags[0...4].join(', ') )
+ title = @post.title + divider + app_base + tagline
+ title += (@post.tags.empty? ? '' : "#{divider}#{:keywords.l}: " + @post.tags[0...4].join(', ') )
@canonical_url = user_post_url(@post.user, @post)
end
when 'users'
if @user && !@user.new_record? && @user.login
title = @user.login
- title += ', ' + :expert_in.l + ' ' + @user.offerings.collect{|o| o.skill.name }.join(', ') if @user.vendor? and !@user.offerings.empty?
- title += ' &raquo; ' + app_base + tagline
+ title += ", #{:expert_in.l} #{@user.offerings.collect{|o| o.skill.name }.join(', ')}" if @user.vendor? and !@user.offerings.empty?
+ title += divider + app_base + tagline
@canonical_url = user_url(@user)
else
- title = :showing_users.l+' &raquo; ' + app_base + tagline
+ title = :showing_users.l+divider + app_base + tagline
end
when 'photos'
if @user and @user.login
- title = :users_photos.l(:user => @user.login)+' &raquo; ' + app_base + tagline
+ title = :users_photos.l(:user => @user.login) + divider + app_base + tagline
end
when 'clippings'
if @user and @user.login
- title = :user_clippings.l(:user => @user.login) + ' &raquo; ' + app_base + tagline
+ title = :user_clippings.l(:user => @user.login) + divider + app_base + tagline
end
when 'tags'
- case @controller.action_name
+ case controller.action_name
when 'show'
if params[:type]
title = I18n.translate('all_' + params[:type].downcase.pluralize + '_tagged', :tag_name => @tags.map(&:name).join(', '))
else
title = :posts_photos_and_bookmarks.l(:name => @tags.map(&:name).join(', '))
end
- title += ' (' + :related_tags.l + ': ' + @related_tags.join(', ') + ')' if @related_tags
- title += ' | ' + app_base
+ title += " (#{:related_tags.l}: #{@related_tags.join(', ')})" if @related_tags
+ title += divider + app_base
@canonical_url = tag_url(URI.escape(@tags_raw, /[\/.?#]/)) if @tags_raw
else
- title = 'Showing tags &raquo; ' + app_base + tagline
+ title = "Showing tags #{divider} #{app_base} #{tagline}"
end
when 'categories'
if @category and @category.name
- title = :posts_photos_and_bookmarks.l(:name => @category.name) + ' &raquo; ' + app_base + tagline
+ title = :posts_photos_and_bookmarks.l(:name => @category.name) + divider + app_base + tagline
else
- title = :showing_categories.l + ' &raquo; ' + app_base + tagline
+ title = :showing_categories.l + divider + app_base + tagline
end
when 'skills'
if @skill and @skill.name
- title = :find_an_expert_in.l + ' ' + @skill.name + ' &raquo; ' + app_base + tagline
+ title = :find_an_expert_in.l + ' ' + @skill.name + divider + app_base + tagline
else
- title = :find_experts.l + ' &raquo; ' + app_base + tagline
+ title = :find_experts.l + divider + app_base + tagline
end
when 'sessions'
- title = :login.l + ' &raquo; ' + app_base + tagline
+ title = :login.l + divider + app_base + tagline
end
if @page_title
- title = @page_title + ' &raquo; ' + app_base + tagline
+ title = @page_title + divider + app_base + tagline
elsif title == app_base
- title = :showing.l + ' ' + @controller.controller_name + ' &raquo; ' + app_base + tagline
+ title = :showing.l + ' ' + controller.controller_name + divider + app_base + tagline
end
title
@@ -194,14 +195,15 @@ def add_friend_link(user = nil)
html += "<span style='display:none;' class='spinner'>"
html += image_tag 'spinner.gif', :plugin => "community_engine"
html += :requesting_friendship.l+" ...</span></span>"
- html
+ html.html_safe
end
def topnav_tab(name, options)
classes = [options.delete(:class)]
classes << 'current' if options[:section] && (options.delete(:section).to_a.include?(@section))
- "<li class='#{classes.join(' ')}'>" + link_to( "<span>"+name+"</span>", options.delete(:url), options) + "</li>"
+ string = "<li class='#{classes.join(' ')}'>" + link_to( content_tag(:span, name), options.delete(:url), options) + "</li>"
+ string.html_safe
end
# def format_post_totals(posts)
@@ -212,7 +214,7 @@ def more_comments_links(commentable)
html = link_to "&raquo; " + :all_comments.l, comments_url(commentable.class.to_s.underscore, commentable.to_param)
html += "<br />"
html += link_to "&raquo; " + :comments_rss.l, comments_url(commentable.class.to_s.underscore, commentable.to_param, :format => :rss)
- html
+ html.html_safe
end
def more_user_comments_links(user = @user)
@@ -244,40 +246,34 @@ def feature_enabled?(feature)
end
def show_footer_content?
- return true if (
- current_page?(:controller => 'base', :action => 'site_index') ||
- current_page?(:controller => 'posts', :action => 'show') ||
- current_page?(:controller => 'categories', :action => 'show') ||
- current_page?(:controller => 'users', :action => 'show')
- )
-
- return false
+ return true #you can override this in your app
end
def clippings_link
- "javascript:(function() {d=document, w=window, e=w.getSelection, k=d.getSelection, x=d.selection, s=(e?e():(k)?k():(x?x.createRange().text:0)), e=encodeURIComponent, document.location='#{application_url}new_clipping?uri='+e(document.location)+'&title='+e(document.title)+'&selection='+e(s);} )();"
+ "javascript:(function() {d=document, w=window, e=w.getSelection, k=d.getSelection, x=d.selection, s=(e?e():(k)?k():(x?x.createRange().text:0)), e=encodeURIComponent, document.location='#{home_url}new_clipping?uri='+e(document.location)+'&title='+e(document.title)+'&selection='+e(s);} )();"
end
def paginating_links(paginator, options = {}, html_options = {})
- if paginator.page_count > 1
- name = options[:name] || PaginatingFind::Helpers::DEFAULT_OPTIONS[:name]
-
- our_params = (options[:params] || params).clone
-
- our_params.delete("authenticity_token")
- our_params.delete("commit")
-
- links = paginating_links_each(paginator, options) do |n|
- our_params[name] = n
- link_to(n, our_params, html_options.merge(:class => (paginator.page.eql?(n) ? 'active' : '')))
- end
- end
-
- if options[:show_info].eql?(false)
- (links || '')
- else
- content_tag(:div, pagination_info_for(paginator), :class => 'pagination_info') + (links || '')
- end
+ will_paginate paginator
+ # if paginator.page_count > 1
+ # name = options[:name] || PaginatingFind::Helpers::DEFAULT_OPTIONS[:name]
+ #
+ # our_params = (options[:params] || params).clone
+ #
+ # our_params.delete("authenticity_token")
+ # our_params.delete("commit")
+ #
+ # links = paginating_links_each(paginator, options) do |n|
+ # our_params[name] = n
+ # link_to(n, our_params, html_options.merge(:class => (paginator.page.eql?(n) ? 'active' : '')))
+ # end
+ # end
+ #
+ # if options[:show_info].eql?(false)
+ # (links || '')
+ # else
+ # content_tag(:div, pagination_info_for(paginator), :class => 'pagination_info') + (links || '')
+ # end
end
def pagination_info_for(paginator, options = {})
@@ -366,6 +362,5 @@ def profile_completeness(user)
def possesive(user)
user.gender ? (user.male? ? :his.l : :her.l) : :their.l
end
-
end
View
6 app/helpers/users_helper.rb
@@ -2,9 +2,5 @@ module UsersHelper
def friends?(user, friend)
Friendship.friends?(user, friend)
end
-
- def random_greeting(user)
- "#{:greetings.l.sort_by{rand}.first} #{user.login}!"
- end
-
+
end
View
4 app/models/clipping.rb
@@ -17,8 +17,8 @@ class Clipping < ActiveRecord::Base
acts_as_taggable
acts_as_activity :user
- named_scope :recent, :order => 'clippings.created_at DESC'
- named_scope :tagged_with, lambda {|tag_name|
+ scope :recent, :order => 'clippings.created_at DESC'
+ scope :tagged_with, lambda {|tag_name|
{:conditions => ["tags.name = ?", tag_name], :include => :tags}
}
View
2 app/models/clipping_image.rb
@@ -1,6 +1,6 @@
class ClippingImage < Asset
include UrlUpload
- has_attachment prepare_options_for_attachment_fu(configatron.clipping['attachment_fu_options'])
+ has_attachment prepare_options_for_attachment_fu(configatron.clipping.attachment_fu_options.to_hash)
validates_as_attachment
end
View
33 app/models/comment.rb
@@ -1,7 +1,5 @@
class Comment < ActiveRecord::Base
- include Rakismet::Model
- rakismet_attrs :author => :author_name, :comment_type => 'comment', :content => :comment, :user_ip => :author_ip
-
+
belongs_to :commentable, :polymorphic => true
belongs_to :user
belongs_to :recipient, :class_name => "User", :foreign_key => "recipient_id"
@@ -17,15 +15,14 @@ class Comment < ActiveRecord::Base
validates_presence_of :author_email, :unless => Proc.new{|record| record.user } #require email unless logged in
validates_presence_of :author_ip, :unless => Proc.new{|record| record.user} #log ip unless logged in
validates_format_of :author_url, :with => /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix, :unless => Proc.new{|record| record.user }
- validate :check_spam
-
+
acts_as_activity :user, :if => Proc.new{|record| record.user } #don't record an activity if there's no user
- # named_scopes
- named_scope :recent, :order => 'created_at DESC'
+ # scopes
+ scope :recent, :order => 'created_at DESC'
def self.find_photo_comments_for(user)
- Comment.find(:all, :conditions => ["recipient_id = ? AND commentable_type = ?", user.id, 'Photo'], :order => 'created_at DESC', :limit => 10)
+ Comment.find(:all, :conditions => ["recipient_id = ? AND commentable_type = ?", user.id, 'Photo'], :order => 'created_at DESC')
end
# Helper class method to lookup all comments assigned
@@ -92,20 +89,19 @@ def should_notify_recipient?
def notify_previous_commenters
previous_commenters_to_notify.each do |commenter|
- UserNotifier.deliver_follow_up_comment_notice(commenter, self)
+ UserNotifier.follow_up_comment_notice(commenter, self)
end
end
def notify_previous_anonymous_commenters
anonymous_commenters_emails = commentable.comments.map{|c| c.author_email if (c.notify_by_email? && !c.user && !c.author_email.eql?(self.author_email) && c.author_email) }.uniq.compact
anonymous_commenters_emails.each do |email|
- UserNotifier.deliver_follow_up_comment_notice_anonymous(email, self)
+ UserNotifier.follow_up_comment_notice_anonymous(email, self)
end
end
def send_notifications
- return if commentable.respond_to?(:send_comment_notifications?) && !commentable.send_comment_notifications?
- UserNotifier.deliver_comment_notice(self) if should_notify_recipient?
+ UserNotifier.comment_notice(self) if should_notify_recipient?
self.notify_previous_commenters
self.notify_previous_anonymous_commenters if configatron.allow_anonymous_commenting
end
@@ -120,15 +116,10 @@ def unsubscribe_notifications(email)
end
end
- def check_spam
- if AppConfig.akismet_key && self.spam?
- self.errors.add_to_base(:comment_spam_error.l)
- end
- end
-
protected
- def whitelist_attributes
- self.comment = white_list(self.comment)
- end
+ def whitelist_attributes
+ self.comment = white_list(self.comment)
+ end
+
end
View
2 app/models/contest.rb
@@ -4,7 +4,7 @@ class Contest < ActiveRecord::Base
validates_presence_of :begin_date, :end_date, :title, :banner_title, :banner_subtitle
- named_scope :active, :conditions => ["begin_date < ? AND end_date > ?", Time.now, Time.now], :order => 'created_at desc'
+ scope :active, :conditions => ["begin_date < ? AND end_date > ?", Time.now, Time.now], :order => 'created_at desc'
def self.current
active.find(:first)
View
4 app/models/event.rb
@@ -13,8 +13,8 @@ class Event < ActiveRecord::Base
attr_protected :user_id
#Procs used to make sure time is calculated at runtime
- named_scope :upcoming, lambda { { :order => 'start_time', :conditions => ['end_time > ?' , Time.now ] } }
- named_scope :past, lambda { { :order => 'start_time DESC', :conditions => ['end_time <= ?' , Time.now ] } }
+ scope :upcoming, lambda { { :order => 'start_time', :conditions => ['end_time > ?' , Time.now ] } }
+ scope :past, lambda { { :order => 'start_time DESC', :conditions => ['end_time <= ?' , Time.now ] } }
acts_as_commentable
View
4 app/models/favorite.rb
@@ -14,8 +14,8 @@ class Favorite < ActiveRecord::Base
validates_uniqueness_of :ip_address, :scope => [:favoritable_type, :favoritable_id], :message => 'has already favorited this item.', :if => Proc.new{|f| f.user.nil? }
#named scopes
- named_scope :recent, :order => "created_at DESC"
- named_scope :by_user, lambda { |user|
+ scope :recent, :order => "created_at DESC"
+ scope :by_user, lambda { |user|
{:conditions => ["user_id = ?", user.id] }
}
View
6 app/models/friendship.rb
@@ -13,7 +13,7 @@ class Friendship < ActiveRecord::Base
validates_uniqueness_of :friend_id, :scope => :user_id
# named scopes
- named_scope :accepted, lambda {
+ scope :accepted, lambda {
#hack: prevents FriendshipStatus[:accepted] from getting called before the friendship_status records are in the db (only matters in testing ENV)
{:conditions => ["friendship_status_id = ?", FriendshipStatus[:accepted].id] }
}
@@ -27,7 +27,7 @@ def validate
end
end
- before_validation_on_create :set_pending
+ before_validation(:on => :create){:set_pending}
after_save :notify_requester, :if => Proc.new{|fr| fr.accepted? && fr.initiator }
attr_protected :friendship_status_id
@@ -53,7 +53,7 @@ def self.friends?(user, friend)
end
def notify_requester
- UserNotifier.deliver_friendship_accepted(self)
+ UserNotifier.friendship_accepted(self)
end
private
View
4 app/models/homepage_feature.rb
@@ -1,7 +1,5 @@
class HomepageFeature < ActiveRecord::Base
- has_attachment prepare_options_for_attachment_fu(configatron.feature['attachment_fu_options'])
- attr_accessible :url, :title, :description
- has_attachment prepare_options_for_attachment_fu(AppConfig.feature['attachment_fu_options'])
+ has_attachment prepare_options_for_attachment_fu(configatron.feature.attachment_fu_options.to_hash)
attr_accessible :url, :title, :description, :position
validates_presence_of :content_type
View
2 app/models/invitation.rb
@@ -29,7 +29,7 @@ class Invitation < ActiveRecord::Base
def send_invite
emails = self.email_addresses.split(",").collect{|email| email.strip }.uniq
emails.each{|email|
- UserNotifier.deliver_signup_invitation(email, self.user, self.message)
+ UserNotifier.signup_invitation(email, self.user, self.message)
}
end
View
4 app/models/message.rb
@@ -8,7 +8,7 @@ class Message < ActiveRecord::Base
has_many :children, :class_name => "Message", :foreign_key => "parent_id"
has_many :message_threads
- named_scope :parents, :conditions => "parent_id IS NULL"
+ scope :parents, where("parent_id IS NULL")
validates_presence_of :body, :subject
validates_presence_of :recipient, :message => "is invalid"
@@ -22,7 +22,7 @@ def ensure_not_sending_to_self
end
def notify_recipient
- UserNotifier.deliver_message_notification(self)
+ UserNotifier.message_notification(self)
end
def update_message_threads
View
23 app/models/photo.rb
@@ -2,7 +2,22 @@ class Photo < ActiveRecord::Base
acts_as_commentable
belongs_to :album
- has_attachment prepare_options_for_attachment_fu(AppConfig.photo['attachment_fu_options'])
+ has_attachment prepare_options_for_attachment_fu(configatron.photo.attachment_fu_options.to_hash)
+ # attr_accessor :cropped_size
+ # before_thumbnail_saved do |thumbnail|
+ # raise thumbnail.inspect
+ # # thumbnail.send(:'attributes=', {:thumbnail_resize_options => cropped_size}, false) if thumbnail.parent.cropped_size
+ # if thumbnail.parent.cropped_size[:x1]
+ # # img = Magick::Image::read(@photo.public_filename).first
+ # thumbnail.crop!(::Magick::CenterGravity, parent.cropped_size[:x1].to_i, parent.cropped_size[:y1].to_i, parent.cropped_size[:width].to_i, parent.cropped_size[:height].to_i, true)
+ # raise thumbnail.inspect
+ # # size = configatron.photo['attachment_fu_options']['thumbnails']['medium']
+ # # dimensions = size[1..size.size].split("x")
+ # # img.crop_resized!(dimensions[0].to_i, dimensions[1].to_i)
+ # # img.write @settings.header_image_file
+ # end
+ # end
+
acts_as_taggable
@@ -19,9 +34,9 @@ class Photo < ActiveRecord::Base
has_one :user_as_avatar, :class_name => "User", :foreign_key => "avatar_id"
#Named scopes
- named_scope :recent, :order => "photos.created_at DESC", :conditions => ["photos.parent_id IS NULL"]
- named_scope :new_this_week, :order => "photos.created_at DESC", :conditions => ["photos.created_at > ? AND photos.parent_id IS NULL", 7.days.ago.to_s(:db)]
- named_scope :tagged_with, lambda {|tag_name|
+ scope :recent, :order => "photos.created_at DESC", :conditions => ["photos.parent_id IS NULL"]
+ scope :new_this_week, :order => "photos.created_at DESC", :conditions => ["photos.created_at > ? AND photos.parent_id IS NULL", 7.days.ago.to_s(:db)]
+ scope :tagged_with, lambda {|tag_name|
{:conditions => ["tags.name = ?", tag_name], :include => :tags}
}
attr_accessible :name, :description
View
18 app/models/post.rb
@@ -30,16 +30,16 @@ class Post < ActiveRecord::Base
attr_accessor :invalid_emails
#Named scopes
- named_scope :by_featured_writers, :conditions => ["users.featured_writer = ?", true], :include => :user
- named_scope :recent, :order => 'posts.published_at DESC'
- named_scope :popular, :order => 'posts.view_count DESC'
- named_scope :since, lambda { |days|
- {:conditions => "posts.published_at > '#{days.ago.to_s :db}'" }
+ scope :by_featured_writers, :conditions => ["users.featured_writer = ?", true], :include => :user
+ scope :recent, order("posts.published_at DESC")
+ scope :popular, :order => 'posts.view_count DESC'
+ scope :since, lambda { |days|
+ where("posts.published_at IS NOT NULL AND posts.published_at <= ?", days.ago.to_s(:db))
}
- named_scope :tagged_with, lambda {|tag_name|
- {:conditions => ["tags.name = ?", tag_name], :include => :tags}
+ scope :tagged_with, lambda {|tag_name|
+ where("tags.name = ?", tag_name).includes(:tags)
}
-
+
def self.find_related_to(post, options = {})
merged_options = options.merge({:limit => 8,
:order => 'published_at DESC',
@@ -133,7 +133,7 @@ def send_to(email_addresses = '', message = '', user = nil)
else
emails = email_addresses.split(",").collect{|email| email.strip }.uniq
emails.each{|email|
- UserNotifier.deliver_post_recommendation((user ? user.login : 'Someone'), email, self, message, user)
+ UserNotifier.post_recommendation((user ? user.login : 'Someone'), email, self, message, user)
}
self.increment(:emailed_count).save
end
View
35 app/models/sb_post.rb
@@ -1,8 +1,5 @@
class SbPost < ActiveRecord::Base
- acts_as_activity :user, :if => Proc.new{|record| record.user } #don't record an activity if there's no user
- include Rakismet::Model
- rakismet_attrs :author => :username, :comment_type => 'comment', :content => :body, :user_ip => :author_ip
-
+ acts_as_activity :user
belongs_to :forum, :counter_cache => true
belongs_to :user, :counter_cache => true
@@ -13,24 +10,16 @@ class SbPost < ActiveRecord::Base
after_create { |r| Topic.update_all(['replied_at = ?, replied_by = ?, last_post_id = ?', r.created_at, r.user_id, r.id], ['id = ?', r.topic_id]) }
after_destroy { |r| t = Topic.find(r.topic_id) ; Topic.update_all(['replied_at = ?, replied_by = ?, last_post_id = ?', t.sb_posts.last.created_at, t.sb_posts.last.user_id, t.sb_posts.last.id], ['id = ?', t.id]) if t.sb_posts.last }
- validates_presence_of :user_id, :unless => Proc.new{|record| AppConfig.allow_anonymous_forum_posting }
- validates_presence_of :author_email, :unless => Proc.new{|record| record.user } #require email unless logged in
- validates_format_of :author_email, :with => /^([^@\s]+)@((?:[-a-z0-9A-Z]+\.)+[a-zA-Z]{2,})$/, :unless => Proc.new{|record| record.user}
- validates_presence_of :author_ip, :unless => Proc.new{|record| record.user} #log ip unless logged in
-
- validates_presence_of :body, :topic
-
- attr_accessible :body, :author_email, :author_ip, :author_name, :author_url
- after_create :monitor_topic
+ validates_presence_of :user_id, :body, :topic
+ attr_accessible :body
+ after_create :monitor_topic
after_create :notify_monitoring_users
- named_scope :with_query_options, :select => 'sb_posts.*, topics.title as topic_title, forums.name as forum_name', :joins => 'inner join topics on sb_posts.topic_id = topics.id inner join forums on topics.forum_id = forums.id', :order => 'sb_posts.created_at desc'
- named_scope :recent, :order => 'sb_posts.created_at'
- validate :check_spam
+ scope :with_query_options, :select => 'sb_posts.*, topics.title as topic_title, forums.name as forum_name', :joins => 'inner join topics on sb_posts.topic_id = topics.id inner join forums on topics.forum_id = forums.id', :order => 'sb_posts.created_at desc'
+ scope :recent, :order => 'sb_posts.created_at'
def monitor_topic
- return unless user
monitorship = Monitorship.find_or_initialize_by_user_id_and_topic_id(user.id, topic.id)
if monitorship.new_record?
monitorship.update_attribute :active, true
@@ -50,16 +39,4 @@ def to_xml(options = {})
options[:except] << :topic_title << :forum_name
super
end
-
- def username
- user ? user.login : (author_name.blank? ? :anonymous.l : author_name)
- end
-
- def check_spam
- if AppConfig.akismet_key && self.spam?
- self.errors.add_to_base(:comment_spam_error.l)
- end
- end
-
-
end
View
2 app/models/tag.rb
@@ -1,4 +1,4 @@
-require_dependency File.dirname(__FILE__) + '/../../plugins/acts_as_taggable_on_steroids/lib/tag.rb'
+require_dependency File.dirname(__FILE__) + '/../../vendor/plugins/acts_as_taggable_on_steroids/lib/tag.rb'
class Tag < ActiveRecord::Base
View
2 app/models/topic.rb
@@ -26,7 +26,7 @@ def last
def notify_of_new_post(post)
monitorships.each do |m|
- UserNotifier.deliver_new_forum_post_notice(m.user, post) if (m.user != post.user) && m.user.notify_comments
+ UserNotifier.new_forum_post_notice(m.user, post) if (m.user != post.user) && m.user.notify_comments
end
end
View
122 app/models/user.rb
@@ -1,6 +1,7 @@
require 'digest/sha1'
class User < ActiveRecord::Base
+ # include 'CommunityEngineSha1CryptoMethod'
has_many :albums
MALE = 'M'
@@ -18,13 +19,10 @@ class User < ActiveRecord::Base
c.validates_length_of_email_field_options = { :within => 3..100 }
c.validates_format_of_email_field_options = { :with => /^([^@\s]+)@((?:[-a-z0-9A-Z]+\.)+[a-zA-Z]{2,})$/ }
- c.perishable_token_valid_for = 2.hours
end
acts_as_taggable
acts_as_commentable
- has_private_messages
- has_many :message_threads_as_recipient, :class_name => "MessageThread", :foreign_key => "recipient_id"
-
+ has_private_messages
tracks_unlinked_activities [:logged_in, :invited_friends, :updated_profile, :joined_the_site]
#callbacks
@@ -39,7 +37,7 @@ class User < ActiveRecord::Base
#validation
- validates_presence_of :metro_area, :if => Proc.new { |user| user.state }
+ validates_presence_of :metro_area, :if => Proc.new { |user| user.state }
validates_uniqueness_of :login_slug
validates_exclusion_of :login, :in => configatron.reserved_logins
validates_date :birthday, :before => 13.years.ago.to_date
@@ -69,7 +67,7 @@ class User < ActiveRecord::Base
has_many :monitored_topics, :through => :monitorships, :conditions => ['monitorships.active = ?', true], :order => 'topics.replied_at desc', :source => :topic
belongs_to :avatar, :class_name => "Photo", :foreign_key => "avatar_id"
- belongs_to :metro_area, :counter_cache => true
+ belongs_to :metro_area
belongs_to :state
belongs_to :country
has_many :comments_as_author, :class_name => "Comment", :foreign_key => "user_id", :order => "created_at desc", :dependent => :destroy
@@ -78,12 +76,12 @@ class User < ActiveRecord::Base
has_many :favorites, :order => "created_at desc", :dependent => :destroy
#named scopes
- named_scope :recent, :order => 'users.created_at DESC'
- named_scope :featured, :conditions => ["users.featured_writer = ?", true]
- named_scope :active, :conditions => ["users.activated_at IS NOT NULL"]
- named_scope :vendors, :conditions => ["users.vendor = ?", true]
- named_scope :tagged_with, lambda {|tag_name|
- {:conditions => ["tags.name = ?", tag_name], :include => :tags}
+ scope :recent, order('users.created_at DESC')
+ scope :featured, where("users.featured_writer = ?", true)
+ scope :active, where("users.activated_at IS NOT NULL")
+ scope :vendors, where("users.vendor = ?", true)
+ scope :tagged_with, lambda {|tag_name|
+ includes(:tags).where("tags.name = ?", tag_name)
}
@@ -91,6 +89,7 @@ class User < ActiveRecord::Base
# override activerecord's find to allow us to find by name or id transparently
def self.find(*args)
+ raise 'test'
if args.is_a?(Array) and args.first.is_a?(String) and (args.first.index(/[a-zA-Z\-_]+/) or args.first.to_i.eql?(0) )
find_by_login_slug(args)
else
@@ -99,6 +98,7 @@ def self.find(*args)
end
def self.find_country_and_state_from_search_params(search)
+ search = prepare_params_for_search(search)
country = Country.find(search['country_id']) if !search['country_id'].blank?
state = State.find(search['state_id']) if !search['state_id'].blank?
metro_area = MetroArea.find(search['metro_area_id']) if !search['metro_area_id'].blank?
@@ -129,30 +129,30 @@ def self.prepare_params_for_search(params)
search
end
- def self.build_conditions_for_search(search)
- cond = Caboose::EZ::Condition.new
-
- cond.append ['activated_at IS NOT NULL ']
- if search['country_id'] && !(search['metro_area_id'] || search['state_id'])
- cond.append ['country_id = ?', search['country_id'].to_s]
- end
- if search['state_id'] && !search['metro_area_id']
- cond.append ['state_id = ?', search['state_id'].to_s]
- end
- if search['metro_area_id']
- cond.append ['metro_area_id = ?', search['metro_area_id'].to_s]
- end
- if search['login']
- cond.login =~ "%#{search['login']}%"
- end
- if search['vendor']
- cond.vendor == true
- end
- if search['description']
- cond.description =~ "%#{search['description']}%"
- end
- cond
- end
+ # def self.build_conditions_for_search(search)
+ # cond = Caboose::EZ::Condition.new
+ #
+ # cond.append ['activated_at IS NOT NULL ']
+ # if search['country_id'] && !(search['metro_area_id'] || search['state_id'])
+ # cond.append ['country_id = ?', search['country_id'].to_s]
+ # end
+ # if search['state_id'] && !search['metro_area_id']
+ # cond.append ['state_id = ?', search['state_id'].to_s]
+ # end
+ # if search['metro_area_id']
+ # cond.append ['metro_area_id = ?', search['metro_area_id'].to_s]
+ # end
+ # if search['login']
+ # cond.login =~ "%#{search['login']}%"
+ # end
+ # if search['vendor']
+ # cond.vendor == true
+ # end
+ # if search['description']
+ # cond.description =~ "%#{search['description']}%"
+ # end
+ # cond
+ # end
def self.find_by_activity(options = {})
options.reverse_merge! :limit => 30, :require_avatar => true, :since => 7.days.ago
@@ -171,39 +171,31 @@ def self.find_by_activity(options = {})
def self.find_featured
self.featured
end
-
- def self.paginated_users_conditions_with_search(params)
- search = prepare_params_for_search(params)
-
- metro_areas, states = find_country_and_state_from_search_params(search)
- cond = build_conditions_for_search(search)
- return cond, search, metro_areas, states
- end
-
-
def self.recent_activity(page = {}, options = {})
page.reverse_merge! :size => 10, :current => 1
- Activity.recent.find(:all,
+ Activity.recent.paginate(:all,
:select => 'activities.*',
:conditions => "users.activated_at IS NOT NULL",
:joins => "LEFT JOIN users ON users.id = activities.user_id",
- :page => page, *options)
+ :per_page => page[:size],
+ :page => page[:current])
+ #Rails 3 fix: page, *options
end
def self.currently_online
User.find(:all, :conditions => ["sb_last_seen_at > ?", Time.now.utc-5.minutes])
end
- def self.search(query, options = {})
- with_scope :find => { :conditions => build_search_conditions(query) } do
- find :all, options
- end
- end
-
- def self.build_search_conditions(query)
- query
- end
+ # def self.search(query, options = {})
+ # with_scope :find => { :conditions => build_search_conditions(query) } do
+ # find :all, options
+ # end
+ # end
+ #
+ # def self.build_search_conditions(query)
+ # query
+ # end
## End Class Methods
@@ -326,12 +318,11 @@ def generate_login_slug
end
def deliver_activation
- UserNotifier.deliver_activation(self) if self.recently_activated?
- @activated = false
+ UserNotifier.activation(self) if self.recently_activated?
end
def deliver_signup_notification
- UserNotifier.deliver_signup_notification(self)
+ UserNotifier.signup_notification(self)
end
def update_last_login
@@ -370,7 +361,7 @@ def network_activity(page = {}, since = 1.week.ago)
ids = ((friends_ids | metro_area_people_ids) - [self.id])[0..100] #don't pull TOO much activity for now
- Activity.recent.since(since).by_users(ids).find(:all, :page => page)
+ Activity.recent.since(since).by_users(ids).paginate(:all, :page => page[:current], :per_page => page[:size])
end
def comments_activity(page = {}, since = 1.week.ago)
@@ -431,15 +422,6 @@ def update_last_seen_at
self.sb_last_seen_at = Time.now.utc
end
- def deliver_password_reset_instructions!
- reset_perishable_token!
- UserNotifier.deliver_password_reset_instructions(self)
- end
-
- def unread_message_count
- message_threads_as_recipient.count(:conditions => ["messages.recipient_id = ? AND messages.recipient_deleted = ? AND read_at IS NULL", self.id, false], :include => :message)
- end
-
## End Instance Methods
View
68 app/models/user_notifier.rb
@@ -2,49 +2,50 @@ class UserNotifier < ActionMailer::Base
include ActionView::Helpers::TextHelper
include ActionView::Helpers::SanitizeHelper
extend ActionView::Helpers::SanitizeHelper::ClassMethods # Required for rails 2.2
-
include BaseHelper
- ActionMailer::Base.default_url_options[:host] = APP_URL.sub('http://', '')
+
+ default_url_options[:host] = configatron.app_host
+ default :from => "#{:the_team.l(:site => configatron.community_name, :email => configatron.support_email)}"
def signup_invitation(email, user, message)
setup_sender_info
@recipients = "#{email}"
@subject = "#{:would_like_you_to_join.l(:user => user.login, :site => configatron.community_name)}"
@sent_on = Time.now
- @body[:user] = user
- @body[:url] = signup_by_id_url(user, user.invite_code)
- @body[:message] = message
+ @user = user
+ @url = signup_by_id_url(user, user.invite_code)
+ @message = message
end
def friendship_request(friendship)
setup_email(friendship.friend)
@subject += "#{:would_like_to_be_friends_with_you_on.l(:user => friendship.user.login, :site => configatron.community_name)}"
- @body[:url] = pending_user_friendships_url(friendship.friend)
- @body[:requester] = friendship.user
+ @url = pending_user_friendships_url(friendship.friend)
+ @requester = friendship.user
end
def friendship_accepted(friendship)
setup_email(friendship.user)
@subject += "#{:friendship_request_accepted.l}"
- @body[:requester] = friendship.user
- @body[:friend] = friendship.friend
- @body[:url] = user_url(friendship.friend)
+ @requester = friendship.user
+ @friend = friendship.friend
+ @url = user_url(friendship.friend)
end
def comment_notice(comment)
setup_email(comment.recipient)
@subject += "#{:has_something_to_say_to_you_on.l(:user => comment.username, :site => configatron.community_name)}"
- @body[:url] = commentable_url(comment)
- @body[:comment] = comment
- @body[:commenter] = comment.user
+ @url = commentable_url(comment)
+ @comment = comment
+ @commenter = comment.user
end
def follow_up_comment_notice(user, comment)
setup_email(user)
@subject += "#{:has_commented_on_something_that_you_also_commented_on.l(:user => comment.username, :item => comment.commentable_type)}"
- @body[:url] = commentable_url(comment)
- @body[:comment] = comment
- @body[:commenter] = comment.user
+ @url = commentable_url(comment)
+ @comment = comment
+ @commenter = comment.user
end
def follow_up_comment_notice_anonymous(email, comment)
@@ -53,30 +54,30 @@ def follow_up_comment_notice_anonymous(email, comment)
@subject = "[#{configatron.community_name}] "
@sent_on = Time.now
@subject += "#{:has_commented_on_something_that_you_also_commented_on.l(:user => comment.username, :item => comment.commentable_type)}"
- @body[:url] = commentable_url(comment)
- @body[:comment] = comment
+ @url = commentable_url(comment)
+ @comment = comment
- @body[:unsubscribe_link] = url_for(:controller => 'comments', :action => 'unsubscribe', :comment_id => comment.id, :token => comment.token_for(email), :email => email)
+ @unsubscribe_link = url_for(:controller => 'comments', :action => 'unsubscribe', :comment_id => comment.id, :token => comment.token_for(email), :email => email)
end
def new_forum_post_notice(user, post)
setup_email(user)
@subject += "#{:has_posted_in_a_thread_you_are_monitoring.l(:user => post.username)}"
- @body[:url] = "#{forum_topic_url(:forum_id => post.topic.forum, :id => post.topic, :page => post.topic.last_page)}##{post.dom_id}"
- @body[:post] = post
- @body[:author] = post.username
+ @url = "#{forum_topic_url(:forum_id => post.topic.forum, :id => post.topic, :page => post.topic.last_page)}##{post.dom_id}"
+ @post = post
+ @author = post.username
end
def signup_notification(user)
setup_email(user)
@subject += "#{:please_activate_your_new_account.l(:site => configatron.community_name)}"
- @body[:url] = "#{application_url}users/activate/#{user.activation_code}"
+ @url = "#{home_url}users/activate/#{user.activation_code}"
end
def message_notification(message)
setup_email(message.recipient)
@subject += "#{:sent_you_a_private_message.l(:user => message.sender.login)}"
- @body[:message] = message
+ @message = message
end
@@ -86,19 +87,19 @@ def post_recommendation(name, email, post, message = nil, current_user = nil)
setup_sender_info
@subject = "#{:check_out_this_story_on.l(:site => configatron.community_name)}"
content_type "text/plain"
- @body[:name] = name
- @body[:title] = post.title
- @body[:post] = post
- @body[:signup_link] = (current_user ? signup_by_id_url(current_user, current_user.invite_code) : signup_url )
- @body[:message] = message
- @body[:url] = user_post_url(post.user, post)
- @body[:description] = truncate_words(post.post, 100, @body[:url] )
+ @name = name
+ @title = post.title
+ @post = post
+ @signup_link = (current_user ? signup_by_id_url(current_user, current_user.invite_code) : signup_url )
+ @message = message
+ @url = user_post_url(post.user, post)
+ @description = truncate_words(post.post, 100, @url )
end
def activation(user)
setup_email(user)
@subject += "#{:your_account_has_been_activated.l(:site => configatron.community_name)}"
- @body[:url] = home_url
+ @url = home_url
end
def password_reset_instructions(user)
@@ -121,11 +122,10 @@ def setup_email(user)
setup_sender_info
@subject = "[#{configatron.community_name}] "
@sent_on = Time.now
- @body[:user] = user
+ @user = user
end
def setup_sender_info
- from "#{:the_team.l(:site => configatron.community_name, :email => configatron.support_email)}"
headers "Reply-to" => "#{configatron.support_email}"
@content_type = "text/plain"
end
View
4 app/models/user_observer.rb
@@ -1,10 +1,10 @@
class UserObserver < ActiveRecord::Observer
def after_create(user)
- UserNotifier.deliver_signup_notification(user)
+ UserNotifier.signup_notification(user)
end
def after_save(user)
- UserNotifier.deliver_activation(user) if user.recently_activated?
+ UserNotifier.activation(user) if user.recently_activated?
end
end
View
2 app/views/activities/index.html.haml
@@ -3,7 +3,7 @@
-box :class => "fresh" do
%h3= :whats_fresh.l
=render :partial => "activities/activity", :collection => @activities
- .pagination=paginating_links @activities if @activities.page_count > 1
+ =will_paginate @activities
.yui-u
-box do
View
2 app/views/activities/network.html.haml
@@ -8,7 +8,7 @@
%table{:width => "100%"}
=render :partial => "activities/activity", :collection => @activities
-if @activities.page_count > 1
- .pagination= paginating_links @activities, :link_to_current_page => true
+ = will_paginate @activities
-else
=:you_have_no_network_activity_yet.l
= link_to :add_some_friends_to_get_started.l, users_path
View
8 app/views/admin/comments.html.haml
@@ -2,7 +2,7 @@
= render :partial => 'shared/admin_nav'
-box do
- - form_for @search, :html => {:class => "MainForm"} do |f|
+ = form_for @search, :html => {:class => "MainForm"} do |f|
= f.label :commentable_type.l
= f.text_field :commentable_type_like
@@ -18,7 +18,7 @@
-- form_tag delete_selected_comments_path, :id => 'comments' do
+= form_tag delete_selected_comments_path, :id => 'comments' do
#yui-main
-box :class => "yui-b" do
%h3
@@ -26,7 +26,7 @@
= :comments.l
-if @comments.page_count > 1
- .pagination= paginating_links @comments, :link_to_current_page => true
+ = will_paginate @comments
%table{"cellspacing"=>"0", "border"=>"0", "cellpadding"=>"0", "width"=>"100%", :style => "table-layout:fixed;"}
%thead
@@ -66,7 +66,7 @@
-if @comments.page_count > 1
- .pagination= paginating_links @comments, :link_to_current_page => true
+ = will_paginate @comments
%script{:type => 'text/javascript'}
var form = $('comments');
View
4 app/views/admin/users.html.haml
@@ -27,7 +27,7 @@
%input{:type=>"submit", :value=> :search_users.l }
-if @users.page_count > 1
- .pagination= paginating_links @users, :link_to_current_page => true
+ = will_paginate @users
%table{"cellspacing"=>"0", "border"=>"0", "cellpadding"=>"0", "width"=>"100%"}
%tr
@@ -50,4 +50,4 @@
= link_to_remote(image_tag('icons/delete.png', :plugin => 'community_engine'), {:url => user_path(user), :method => :delete, :success => visual_effect(:fade, "user_#{user.id}"), :confirm => "Are you sure you want to permanently delete this user"} )
-if @users.page_count > 1
- .pagination= paginating_links @users, :link_to_current_page => true
+ = will_paginate @users
View
2 app/views/ads/edit.html.haml
@@ -1,7 +1,7 @@
-box do
%h3=:editing_ad.l
= error_messages_for :ad
- - form_for(:ad, :url => ad_path(@ad), :html => { :method => :put, :class => "MainForm" }) do |f|
+ = form_for(:ad, :url => ad_path(@ad), :html => { :method => :put, :class => "MainForm" }) do |f|
%label=:name.l
= f.text_field :name
View
2 app/views/ads/index.html.haml
@@ -3,7 +3,7 @@
-box do
%h3=:search.l
- - form_for @search, :html => {:class => "MainForm"} do |f|
+ = form_for @search, :html => {:class => "MainForm"} do |f|
= f.label :name.l
= f.text_field :name_begins_with
View
2 app/views/ads/new.html.haml
@@ -1,7 +1,7 @@
-box do
%h3=:new_ad.l
= error_messages_for :ad
- - form_for(:ad, :url => ads_path, :html => {:class => "MainForm" }) do |f|
+ = form_for(:ad, :url => ads_path, :html => {:class => "MainForm" }) do |f|
%label=:name.l
= f.text_field :name
View
2 app/views/albums/edit.html.haml
@@ -11,6 +11,6 @@
.yui-b
-box :id => "single_upload", :class => ".yui-b" do
%h3= :new_album.l
- - form_for(@album, :url => user_album_path(current_user, @album),:html => {:class => "MainForm"}) do |f|
+ = form_for(@album, :url => user_album_path(current_user, @album),:html => {:class => "MainForm"}) do |f|
= render :partial => 'form', :locals => {:f => f, :button1 => :edit_and_add_photos.l, :button2 => :edit_album.l }
View
2 app/views/albums/new.html.haml
@@ -11,5 +11,5 @@
.yui-b
-box :id => "single_upload", :class => ".yui-b" do
%h3= :new_album.l
- - form_for(@album, :url => user_albums_path(current_user.id), :html => {:class => "MainForm"}) do |f|
+ = form_for(@album, :url => user_albums_path(current_user.id), :html => {:class => "MainForm"}) do |f|
= render :partial => 'form', :locals => {:f => f, :button1 => :create_and_add_photos.l, :button2 => :create_album.l }
View
2 app/views/albums/show.html.haml
@@ -15,7 +15,7 @@
- @album_photos.each do |photo|
= link_to image_tag( photo.public_filename(:thumb), :class => "polaroid"), |
user_photo_path(photo.user, photo) |
- .pagination= paginating_links @album_photos if @album_photos.page_count > 1
+ = will_paginate @album_photos
-box :class => "hfeed comments", :id => 'comments' do
View
2 app/views/base/teaser.html.haml
@@ -1,7 +1,7 @@
=render :partial => 'base/homepage_banner_message'
#login
- - form_tag sessions_path, :class => "MainForm" do
+ = form_tag sessions_path, :class => "MainForm" do
%label{"for"=>"username"}
=:username.l
\:
View
2 app/views/categories/edit.html.haml
@@ -4,7 +4,7 @@
#yui-main
-box :class => "yui-b" do
%h3=:editing_category.l
- - form_for(:category, :url => category_path(@category), :html => { :method => :put, :class => "MainForm" }) do |f|
+ = form_for(:category, :url => category_path(@category), :html => { :method => :put, :class => "MainForm" }) do |f|
%label
=:name.l
View
2 app/views/categories/new.html.haml
@@ -1,7 +1,7 @@
-box do
%h3= :new_category.l
- - form_for(:category, :url => categories_path, :html => {:class => "MainForm"}) do |f|
+ = form_for(:category, :url => categories_path, :html => {:class => "MainForm"}) do |f|
%label= :name.l
= f.text_field :name
%p= submit_tag :create.l
View
2 app/views/categories/show.html.haml
@@ -40,4 +40,4 @@
= render :partial => 'posts/post', :collection => @posts
- if @posts.page_count > 1
- .pagination= paginating_links @posts, :link_to_current_page => true
+ = will_paginate @posts
View
2 app/views/clippings/edit.html.haml
@@ -8,7 +8,7 @@
-box do
%h3= :editing_clipping.l
%img{"src"=>"#{h @clipping.image_uri}"}
- - form_for(:clipping, :url => user_clipping_path(@user, @clipping), :html => { :method => :put, :class => "MainForm" }) do |f|
+ = form_for(:clipping, :url => user_clipping_path(@user, @clipping), :html => { :method => :put, :class => "MainForm" }) do |f|
%label= :url.l
= f.text_field :url
View
2 app/views/clippings/new.html.haml
@@ -8,7 +8,7 @@
-box do
%h3= :new_clipping.l
%img{"src"=>"#{h @clipping.image_uri}"}
- - form_for(:clipping, :url => user_clippings_path(@user), :html => { :class => "MainForm" }) do |f|
+ = form_for(:clipping, :url => user_clippings_path(@user), :html => { :class => "MainForm" }) do |f|
%label= :url.l
= f.text_field :url
View
4 app/views/clippings/new_clipping.html.haml
@@ -55,7 +55,7 @@
=:cancel_and_go_back_to.l
= @clipping.url
#form_div{"style"=>"display:none;"}
- - form_for(:clipping, :url => user_clippings_path(@user), :html => {:class => "MainForm"} ) do |f|
+ = form_for(:clipping, :url => user_clippings_path(@user), :html => {:class => "MainForm"} ) do |f|
%label=:url.l
= f.text_field :url
@@ -90,7 +90,7 @@
});
-box :class => "yui-u" do
%h3=:create_a_post.l
- - form_for(:post, :url => user_posts_path(current_user), :html => {:class => "MainForm"}) do |f|
+ = form_for(:post, :url => user_posts_path(current_user), :html => {:class => "MainForm"}) do |f|
= hidden_field_tag 'post[published_as]', 'live'
- unless @post.category || @post.contest
View
2 app/views/events/edit.html.haml
@@ -2,7 +2,7 @@
-box do
%h3= :edit_event.l
= error_messages_for :event
- - form_for(:event, :url => event_path(@event), :html => {:method => :put, :class => "MainForm"} ) do |f|
+ = form_for(:event, :url => event_path(@event), :html => {:method => :put, :class => "MainForm"} ) do |f|
%label= :name.l
= f.text_field :name
View
2 app/views/events/new.html.haml
@@ -2,7 +2,7 @@
-box do
%h3= :new_event.l
= error_messages_for :event
- - form_for(:event, :url => events_path, :html => {:class => "MainForm"} ) do |f|
+ = form_for(:event, :url => events_path, :html => {:class => "MainForm"} ) do |f|
%label= :name.l
= f.text_field :name
View
2 app/views/forums/edit.html.haml
@@ -2,7 +2,7 @@
%h3= :edit_forum.l
%p= link_to :delete_this_forum.l, forum_path(@forum), :method => :delete, :class => "utility", :confirm => :are_you_sure.l
- - form_for :forum, :url => forum_path(@forum), :html => { :class => "MainForm", :method => :put } do |f|
+ = form_for :forum, :url => forum_path(@forum), :html => { :class => "MainForm", :method => :put } do |f|
= render :partial => "form", :object => f
%p
= submit_tag :save_forum.l
View
2 app/views/forums/new.html.haml
@@ -1,6 +1,6 @@
-box do
%h3= :new_forum.l
- - form_for :forum, :url => forums_path, :html => {:class => "MainForm"} do |f|
+ = form_for :forum, :url => forums_path, :html => {:class => "MainForm"} do |f|
= render :partial => "form", :object => f
%p
= submit_tag :create.l
View
2 app/views/forums/show.html.haml
@@ -65,7 +65,7 @@
%span= link_to :view.l, forum_topic_path(:forum_id => @forum, :id => topic, :page => topic.last_page, :anchor => "posts-#{topic.last_post_id}")
- if @topics.page_count > 1
- .pagination= paginating_links @topics
+ = will_paginate @topics
- if logged_in?
%h6.all.right= link_to :post_a_new_topic.l, new_forum_topic_path(@forum)
View
6 app/views/friendships/index.xml.builder
@@ -1,6 +1,6 @@
xml.instruct!
xml.RelationViewerData do
- xml.Settings :appTitle=>"#{configatron.community_name} Friendships Browser", :WWWLinkTargetFrame=>"_blank", :startID=>"#{application_url}#{@user.login_slug}",
+ xml.Settings :appTitle=>"#{configatron.community_name} Friendships Browser", :WWWLinkTargetFrame=>"_blank", :startID=>"#{home_url}#{@user.login_slug}",
:defaultRadius=>"170", :maxRadius=>"240", :contextRadius=>"130" do
xml.RelationTypes do
xml.DirectedRelation :color=>"0x999999", :lineSize=>"3"
@@ -14,7 +14,7 @@ xml.RelationViewerData do
@users.each do |user|
imageUrl = (user.avatar_photo_url(:thumb).eql?('icon_missing_thumb.png') ? '/images/icon_missing_thumb.png' : user.avatar_photo_url(:thumb) )
xml.Person :tags => "#{user.tags.collect{|t| t.name }.join(", ")}", :dataURL=>"friendships.xml?id=#{user.id}",
- :id=>"#{application_url}#{user.login_slug}", :name=>"#{user.login}", :imageURL=>imageUrl, :URL=>"#{application_url}#{user.login_slug}" do
+ :id=>"#{home_url}#{user.login_slug}", :name=>"#{user.login}", :imageURL=>imageUrl, :URL=>"#{home_url}#{user.login_slug}" do
xml.cdata!( truncate_words( strip_tags(user.description), 50, '...') )
end
end
@@ -22,7 +22,7 @@ xml.RelationViewerData do
xml.Relations do
@friendships.each do |friendship|
- xml.DirectedRelation :fromID=>"#{application_url}#{friendship.user.login_slug}", :toID=>"#{application_url}#{friendship.friend.login_slug}"
+ xml.DirectedRelation :fromID=>"#{home_url}#{friendship.user.login_slug}", :toID=>"#{home_url}#{friendship.friend.login_slug}"
end
end
View
2 app/views/homepage_features/edit.html.haml
@@ -3,7 +3,7 @@
%h1
= :editing_homepage_feature.l
= error_messages_for :homepage_feature
- - form_for(:homepage_feature, :url => homepage_feature_path(@homepage_feature), :html => { :multipart => true, :method => :put }) do |f|
+ = form_for(:homepage_feature, :url => homepage_feature_path(@homepage_feature), :html => { :multipart => true, :method => :put }) do |f|
%p
%b
URL
View
2 app/views/homepage_features/new.html.haml
@@ -3,7 +3,7 @@
%h1
= :new_homepage_feature.l
= error_messages_for :homepage_feature
- - form_for(:homepage_feature, :url => homepage_features_path, :html => {:multipart =>true} ) do |f|
+ = form_for(:homepage_feature, :url => homepage_features_path, :html => {:multipart =>true} ) do |f|
%p
%b
Url