community_engine 2.0.0.beta3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/CHANGELOG +10 -28
- data/README.markdown +32 -30
- data/UPGRADING.markdown +2 -2
- data/app/controllers/ads_controller.rb +2 -8
- data/app/controllers/albums_controller.rb +2 -2
- data/app/controllers/authorizations_controller.rb +9 -9
- data/app/controllers/base_controller.rb +21 -1
- data/app/controllers/clippings_controller.rb +1 -2
- data/app/controllers/comments_controller.rb +1 -1
- data/app/controllers/forums_controller.rb +4 -8
- data/app/controllers/messages_controller.rb +4 -0
- data/app/controllers/photos_controller.rb +1 -1
- data/app/controllers/post_sweeper.rb +1 -1
- data/app/controllers/posts_controller.rb +1 -1
- data/app/controllers/sb_posts_controller.rb +1 -2
- data/app/controllers/sessions_controller.rb +3 -0
- data/app/controllers/tags_controller.rb +16 -16
- data/app/controllers/topics_controller.rb +16 -16
- data/app/controllers/users_controller.rb +102 -105
- data/app/helpers/base_helper.rb +19 -29
- data/app/models/acts_as_taggable_on/tag.rb +73 -0
- data/app/models/album.rb +2 -0
- data/app/models/category.rb +4 -11
- data/app/models/clipping.rb +4 -1
- data/app/models/comment.rb +44 -42
- data/app/models/country.rb +2 -0
- data/app/models/forum.rb +2 -0
- data/app/models/friendship_status.rb +2 -0
- data/app/models/message.rb +9 -4
- data/app/models/metro_area.rb +2 -0
- data/app/models/photo.rb +1 -1
- data/app/models/poll.rb +1 -0
- data/app/models/post.rb +4 -2
- data/app/models/role.rb +1 -0
- data/app/models/sb_post.rb +2 -8
- data/app/models/state.rb +2 -0
- data/app/models/topic.rb +8 -6
- data/app/models/user.rb +115 -113
- data/app/models/user_notifier.rb +2 -2
- data/app/views/admin/comments.html.haml +10 -9
- data/app/views/admin/users.html.haml +5 -4
- data/app/views/ads/edit.html.haml +3 -2
- data/app/views/ads/index.html.haml +2 -2
- data/app/views/ads/new.html.haml +3 -2
- data/app/views/clippings/edit.html.haml +1 -1
- data/app/views/clippings/load_images_from_uri.js.rjs +1 -1
- data/app/views/clippings/new_clipping.html.haml +2 -1
- data/app/views/clippings/show.html.haml +2 -2
- data/app/views/comments/_comment.html.haml +6 -6
- data/app/views/comments/create.js.rjs +1 -1
- data/app/views/comments/edit.js.rjs +1 -1
- data/app/views/comments/update.js.rjs +1 -1
- data/app/views/events/_event.html.haml +1 -1
- data/app/views/events/edit.html.haml +2 -2
- data/app/views/events/new.html.haml +2 -2
- data/app/views/events/show.html.haml +1 -1
- data/app/views/favorites/create.js.rjs +1 -1
- data/app/views/favorites/destroy.js.rjs +1 -1
- data/app/views/forums/_form.html.haml +3 -1
- data/app/views/forums/show.html.haml +3 -3
- data/app/views/layouts/application.html.haml +6 -4
- data/app/views/messages/_form.html.haml +1 -0
- data/app/views/pages/edit.html.haml +1 -1
- data/app/views/photos/_manage_photos.html.haml +8 -9
- data/app/views/photos/_show_image_list.html.haml +2 -3
- data/app/views/photos/edit.html.haml +3 -1
- data/app/views/photos/new.html.haml +2 -1
- data/app/views/photos/show.html.haml +1 -1
- data/app/views/posts/_send_to_friend.html.erb +1 -1
- data/app/views/posts/edit.html.haml +5 -2
- data/app/views/posts/manage.html.haml +4 -4
- data/app/views/posts/new.html.haml +4 -4
- data/app/views/posts/show.html.haml +14 -9
- data/app/views/sb_posts/_edit.html.erb +1 -1
- data/app/views/sessions/new.html.haml +4 -4
- data/app/views/shared/_end_javascript.html.haml +8 -0
- data/app/views/shared/_location_chooser.html.haml +14 -4
- data/app/views/shared/_scripts_and_styles.html.haml +2 -5
- data/app/views/tags/index.html.haml +3 -1
- data/app/views/tags/manage.html.haml +2 -2
- data/app/views/topics/_form.html.haml +5 -3
- data/app/views/topics/new.html.haml +3 -2
- data/app/views/topics/show.html.haml +24 -18
- data/app/views/users/_omniauth_connect.html.haml +1 -1
- data/app/views/users/_profile_user_info_sidebar.html.haml +1 -1
- data/app/views/users/_user.html.haml +1 -1
- data/app/views/users/crop_profile_photo.html.haml +18 -14
- data/app/views/users/edit.html.haml +2 -1
- data/app/views/users/welcome_about.html.haml +4 -1
- data/community_engine.gemspec +17 -15
- data/config/application_config.rb +76 -71
- data/config/initializers/white_list.rb +4 -7
- data/config/locales/de-DE.yml +97 -4
- data/config/locales/en.yml +4 -0
- data/config/routes.rb +85 -68
- data/db/migrate/080_migrate_to_acts_as_taggable_on.rb +18 -0
- data/lib/community_engine.rb +2 -1
- data/lib/community_engine/authenticated_system.rb +0 -1
- data/lib/community_engine/authenticated_test_helper.rb +0 -43
- data/lib/community_engine/version.rb +2 -2
- data/test/fixtures/taggings.yml +6 -1
- data/test/functional/admin_controller_test.rb +14 -0
- data/test/functional/albums_controller_test.rb +4 -4
- data/test/functional/categories_controller_test.rb +1 -1
- data/test/functional/clippings_controller_test.rb +5 -0
- data/test/functional/comments_controller_test.rb +3 -3
- data/test/functional/forums_controller_test.rb +20 -18
- data/test/functional/messages_controller_test.rb +3 -4
- data/test/functional/moderators_controller_test.rb +2 -2
- data/test/functional/photos_controller_test.rb +3 -3
- data/test/functional/sessions_controller_test.rb +14 -0
- data/test/functional/topics_controller_test.rb +4 -6
- data/test/functional/users_controller_test.rb +185 -170
- data/test/test_helper.rb +22 -13
- data/test/testapp/db/schema.rb +23 -18
- data/test/unit/{tag_test.rb → acts_as_taggable_on/tag_test.rb} +3 -3
- data/test/unit/category_test.rb +3 -11
- data/test/unit/message_test.rb +31 -0
- data/test/unit/message_thread_test.rb +6 -6
- data/test/unit/sb_post_test.rb +9 -6
- data/test/unit/user_test.rb +14 -0
- data/vendor/plugins/enumerations_mixin/.gitignore +1 -0
- data/vendor/plugins/enumerations_mixin/Gemfile +1 -0
- data/vendor/plugins/enumerations_mixin/README.md +120 -0
- data/vendor/plugins/enumerations_mixin/Rakefile +14 -0
- data/vendor/plugins/enumerations_mixin/VERSION +1 -0
- data/vendor/plugins/enumerations_mixin/enumerations_mixin.gemspec +44 -0
- data/vendor/plugins/enumerations_mixin/examples/virtual_enumerations_sample.rb +76 -0
- data/vendor/plugins/enumerations_mixin/lib/active_record/acts/enumerated.rb +7 -5
- data/vendor/plugins/enumerations_mixin/lib/enumerations_mixin.rb +12 -0
- data/vendor/plugins/prototype_legacy_helper/lib/prototype_legacy_helper.rb +1 -1
- data/vendor/plugins/white_list/init.rb +0 -3
- data/vendor/plugins/white_list/lib/white_list_helper.rb +22 -55
- metadata +244 -93
- data/app/controllers/theme_controller.rb +0 -60
- data/app/models/tag.rb +0 -36
- data/test/functional/theme_controller_test.rb +0 -11
- data/vendor/plugins/tiny_mce/CHANGELOG_PLUGIN.rdoc +0 -91
- data/vendor/plugins/tiny_mce/CHANGELOG_TINYMCE +0 -1226
- data/vendor/plugins/tiny_mce/DEV_UPGRADE_NOTES.rdoc +0 -12
- data/vendor/plugins/tiny_mce/init.rb +0 -2
- data/vendor/plugins/tiny_mce/install.rb +0 -18
- data/vendor/plugins/tiny_mce/lib/tiny_mce.rb +0 -24
- data/vendor/plugins/tiny_mce/lib/tiny_mce/base.rb +0 -33
- data/vendor/plugins/tiny_mce/lib/tiny_mce/configuration.rb +0 -114
- data/vendor/plugins/tiny_mce/lib/tiny_mce/exceptions.rb +0 -14
- data/vendor/plugins/tiny_mce/lib/tiny_mce/helpers.rb +0 -43
- data/vendor/plugins/tiny_mce/lib/tiny_mce/railtie.rb +0 -13
- data/vendor/plugins/tiny_mce/lib/tiny_mce/spell_checker.rb +0 -67
- data/vendor/plugins/tiny_mce/lib/tiny_mce/valid_tinymce_langs.yml +0 -25
- data/vendor/plugins/tiny_mce/lib/tiny_mce/valid_tinymce_options.yml +0 -167
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -1,36 +1,18 @@
|
|
1
1
|
= TODO
|
2
|
-
# * replace paginating find with will paginate
|
3
|
-
# * replace att_fu with paperclip
|
4
|
-
# * fix boot;
|
5
|
-
# * recaptcha constants
|
6
|
-
# * rip out beta mode and teaser stuff
|
7
|
-
# * clean up routes
|
8
|
-
# * take out vendors/offerings stuff
|
9
|
-
# * take out ez where
|
10
|
-
# * remote_form_for is gone (use dynamic_form gem/prototype legacy helper)
|
11
|
-
# * finding transparently by login is broken (fixed using friendly_id)
|
12
|
-
# * can't dup nilclass error in Rails timezone conversion (fixed with a little patch, should get fixed in a new version of Rails)
|
13
|
-
# * tinymce isn't working
|
14
|
-
# * fix responds-to-parent
|
15
|
-
# * replace white_list with something (sanitize?) (preserve stuff from white list initializer)
|
16
|
-
# * fix rakismet initializer
|
17
|
-
# * configure configatron from ruby, not yaml
|
18
|
-
|
19
|
-
* mce_opts initializer
|
20
2
|
* replace old multiple uploader
|
21
3
|
* fix photo uploading from welcome_photo page
|
22
4
|
* add back searching to users index
|
23
|
-
* remove all the theming stuff
|
24
|
-
* replace setup template with something else more sensible
|
25
|
-
* allow overriding initializers, autoloading assets, etc
|
26
|
-
* remove stylesheet customization
|
27
|
-
* use aato instead of aatos (and fix pg problems)
|
28
|
-
* authlogic has problems: not sure it's recording last_login magic columns, investigate
|
29
|
-
* Bug in rails fixtures.rb on 849 - use fixtures_path.to_s.size instead
|
30
5
|
* swap jquery for prototype
|
31
|
-
|
32
|
-
|
33
|
-
*
|
6
|
+
|
7
|
+
|
8
|
+
* Upgrade to bcrybt crypto method
|
9
|
+
|
10
|
+
=2.0.0.beta4
|
11
|
+
* Replace white_list plugin with Sanitize gem (white_list.rb initizlizer format has changed)
|
12
|
+
* Upgrade to Rails 3.2
|
13
|
+
* Use act_as_taggable_on
|
14
|
+
* fix photo cropping
|
15
|
+
* remove theme controller (no more theming functionality)
|
34
16
|
|
35
17
|
=2.0.0.pre
|
36
18
|
* Rails 3.1.0.beta1 compatibility
|
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
** Using Rails 2.x? You want the [
|
1
|
+
** Using Rails 2.x? You want the [rails2.x branch](https://github.com/bborn/communityengine/tree/rails2.x)
|
2
2
|
|
3
3
|
CommunityEngine [![Build Status](https://secure.travis-ci.org/bborn/communityengine.png)](http://travis-ci.org/bborn/communityengine)
|
4
4
|
|
@@ -6,40 +6,42 @@ Information at: [http://www.communityengine.org](http://www.communityengine.org)
|
|
6
6
|
|
7
7
|
Requirements:
|
8
8
|
|
9
|
-
- RAILS VERSION 3.
|
9
|
+
- RAILS VERSION 3.2.8
|
10
10
|
|
11
11
|
Getting CommunityEngine Running
|
12
12
|
--------------------------------
|
13
13
|
|
14
14
|
1. Copy the following into your `Gemfile`:
|
15
15
|
|
16
|
-
|
16
|
+
```
|
17
|
+
gem 'community_engine'
|
18
|
+
```
|
17
19
|
|
18
|
-
2.
|
20
|
+
2. Add a file called `application_config.rb` to your `config` directory. In it put (at least):
|
21
|
+
|
22
|
+
configatron.community_name = "Your Application Name"
|
23
|
+
# See CE's application_config.rb to see all the other configuration options available
|
24
|
+
|
25
|
+
3. From your app's root directory run:
|
19
26
|
|
20
27
|
$ bundle install --binstubs
|
21
28
|
$ bin/rake community_engine:install:migrations
|
22
29
|
$ bin/rake db:migrate
|
23
30
|
|
24
|
-
3. Add a file called `application_config.rb` to your `config` directory. In it put (at least):
|
25
|
-
|
26
|
-
configatron.community_name = "Your Application Name"
|
27
|
-
# See CE's application_config.rb to see all the other configuration options available
|
28
|
-
|
29
31
|
4. Mount CommunityEngine in your `config/routes.rb` file:
|
30
32
|
|
31
33
|
mount CommunityEngine::Engine => "/"
|
32
34
|
|
33
35
|
5. Delete the default `views/layouts/application.html.erb` that Rails created for you. Delete `public/index.html` if you haven't already.
|
34
36
|
|
35
|
-
6. Start your server!
|
37
|
+
6. Start your server!
|
36
38
|
|
37
39
|
$ bin/rails server
|
38
40
|
|
39
41
|
Optional Configuration
|
40
42
|
======================
|
41
43
|
|
42
|
-
To override the default configuration, create an `application_config.rb` file in `Rails.root/config`
|
44
|
+
To override the default configuration, create an `application_config.rb` file in `Rails.root/config`
|
43
45
|
|
44
46
|
The application configuration defined in this file overrides the one defined in the [CommunityEngine gem](https://github.com/bborn/communityengine/blob/rails3/config/application_config.rb)
|
45
47
|
|
@@ -65,7 +67,7 @@ Photo Uploading
|
|
65
67
|
|
66
68
|
By default CommunityEngine uses the filesystem to store photos.
|
67
69
|
|
68
|
-
To use Amazon S3 as the backend for your file uploads,you'll need to add a file called `s3.yml` to the application's root config directory (examples are in `/community_engine/sample_files`).
|
70
|
+
To use Amazon S3 as the backend for your file uploads,you'll need to add a file called `s3.yml` to the application's root config directory (examples are in `/community_engine/sample_files`).
|
69
71
|
|
70
72
|
You'll need to change your configuration in your `application_config.rb` to tell CommunityEngine to use s3 as the photo backend. For more, see the Paperclip documentation on S3 storage for uploads: https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/storage/s3.rb
|
71
73
|
|
@@ -82,9 +84,9 @@ Once logged in as an admin, you'll be able to toggle other users between moderat
|
|
82
84
|
|
83
85
|
Admins and moderators can edit and delete other users posts.
|
84
86
|
|
85
|
-
There is a rake task to make an existing user into an admin:
|
87
|
+
There is a rake task to make an existing user into an admin:
|
86
88
|
|
87
|
-
rake community_engine:make_admin email=user@foo.com
|
89
|
+
rake community_engine:make_admin email=user@foo.com
|
88
90
|
|
89
91
|
(Pass in the e-mail of the user you'd like to make an admin)
|
90
92
|
|
@@ -95,10 +97,10 @@ Localization
|
|
95
97
|
|
96
98
|
Localization is done via Rails native I18n API. We've added some extensions to String and Symbol to let them respond to the `.l` method. That allows for a look up of the symbol (or a symbolized version of the string).
|
97
99
|
|
98
|
-
For complex strings with substitutions, Symbols respond to the `.l` method with a hash passed as an argument, for example:
|
100
|
+
For complex strings with substitutions, Symbols respond to the `.l` method with a hash passed as an argument, for example:
|
99
101
|
|
100
102
|
:welcome.l :name => current_user.name
|
101
|
-
|
103
|
+
|
102
104
|
And in your language file you'd have:
|
103
105
|
|
104
106
|
welcome: "Welcome %{name}"
|
@@ -109,23 +111,23 @@ To customize the language, or add a new language create a new yaml file in `Rail
|
|
109
111
|
Spam Control
|
110
112
|
------------
|
111
113
|
|
112
|
-
Spam sucks. Most likely, you'll need to implement some custom solution to control spam on your site, but CE offers a few tools to help with the basics.
|
114
|
+
Spam sucks. Most likely, you'll need to implement some custom solution to control spam on your site, but CE offers a few tools to help with the basics.
|
113
115
|
|
114
116
|
ReCaptcha: to allow non-logged-in commenting and use [ReCaptcha](http://recaptcha.net/) to ensure robots aren't submitting comments to your site, just add the following lines to your `application_config.rb`:
|
115
117
|
|
116
118
|
:allow_anonymous_commenting => true,
|
117
119
|
:recaptcha_pub_key => YOUR_PUBLIC_KEY,
|
118
120
|
:recaptcha_priv_key => YOUR_PRIVATE_KEY
|
119
|
-
|
121
|
+
|
120
122
|
You can also require ReCaptcha on signup (to prevent automated signups) by adding this in your `application_config.rb` (you'll still need to add your ReCaptcha keys):
|
121
123
|
|
122
124
|
:require_captcha_on_signup => true
|
123
|
-
|
125
|
+
|
124
126
|
Akismet: Unfortunately, bots aren't the only ones submitting spam; humans do it too. [Akismet](http://akismet.com/) is a great collaborative spam filter from the makers of Wordpress, and you can use it to check for spam comments by adding one line to your `application_config.rb`:
|
125
127
|
|
126
128
|
:akismet_key => YOUR_KEY
|
127
|
-
|
128
|
-
|
129
|
+
|
130
|
+
|
129
131
|
Integrating with Your Application & Overriding CE
|
130
132
|
-------------------------------------------------
|
131
133
|
|
@@ -133,27 +135,27 @@ To make a controller from your application use CE's layout and inherit CE's help
|
|
133
135
|
|
134
136
|
class RecipesController < BaseController
|
135
137
|
|
136
|
-
before_filter :login_required
|
137
|
-
|
138
|
+
before_filter :login_required
|
139
|
+
|
138
140
|
uses_tiny_mce do
|
139
141
|
{:only => [:show], :options => configatron.default_mce_options}
|
140
|
-
end
|
141
|
-
|
142
|
+
end
|
143
|
+
|
142
144
|
end
|
143
|
-
|
145
|
+
|
144
146
|
To override or modify a controller, helper, or model from CE, you can use the `require_from_ce` helper method. For example, to override a method in CE's `User` model, create `app/models/user.rb`:
|
145
147
|
|
146
148
|
class User < ActiveRecordBase
|
147
149
|
require_from_ce('models/user')
|
148
|
-
|
150
|
+
|
149
151
|
#add a new association
|
150
152
|
has_many :recipes
|
151
|
-
|
153
|
+
|
152
154
|
#override an existing method
|
153
155
|
def display_name
|
154
156
|
login.capitalize
|
155
157
|
end
|
156
|
-
|
158
|
+
|
157
159
|
end
|
158
160
|
|
159
161
|
|
@@ -172,7 +174,7 @@ Contributors - Thanks! :)
|
|
172
174
|
- Bryan Kearney - localization
|
173
175
|
- Alex Nesbitt - forgot password bugs
|
174
176
|
- Alejandro Raiczyk - Spanish localization
|
175
|
-
- [Fritz Thielemann](http://github.com/fritzek) - German localization, il8n
|
177
|
+
- [Fritz Thielemann](http://github.com/fritzek) - German localization, il8n
|
176
178
|
- [Oleg Ivanov](http://github.com/morhekil) - `acts_as_taggable_on_steroids`
|
177
179
|
- David Fugere - French localization
|
178
180
|
- Barry Paul - routes refactoring
|
data/UPGRADING.markdown
CHANGED
@@ -30,8 +30,8 @@ That's it!
|
|
30
30
|
|
31
31
|
Note: this version adds a counter_cache to taggings, so you may need to update the counter on your existing tags by doing something like:
|
32
32
|
|
33
|
-
Tag.all.each do |tag|
|
34
|
-
|
33
|
+
ActsAsTaggableOn::Tag.all.each do |tag|
|
34
|
+
tag.update_counters tag.id, :taggings_count => tag.taggings.length
|
35
35
|
end
|
36
36
|
|
37
37
|
If you have many tags, this could take a while, though.
|
@@ -11,8 +11,7 @@ class AdsController < BaseController
|
|
11
11
|
@ads = @search.page(params[:page]).per(15)
|
12
12
|
|
13
13
|
respond_to do |format|
|
14
|
-
format.html
|
15
|
-
format.xml { render :xml => @ads.to_xml }
|
14
|
+
format.html
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
@@ -22,8 +21,7 @@ class AdsController < BaseController
|
|
22
21
|
@ad = Ad.find(params[:id])
|
23
22
|
|
24
23
|
respond_to do |format|
|
25
|
-
format.html
|
26
|
-
format.xml { render :xml => @ad.to_xml }
|
24
|
+
format.html
|
27
25
|
end
|
28
26
|
end
|
29
27
|
|
@@ -46,10 +44,8 @@ class AdsController < BaseController
|
|
46
44
|
if @ad.save
|
47
45
|
flash[:notice] = :ad_was_successfully_created.l
|
48
46
|
format.html { redirect_to ad_url(@ad) }
|
49
|
-
format.xml { head :created, :location => ad_url(@ad) }
|
50
47
|
else
|
51
48
|
format.html { render :action => "new" }
|
52
|
-
format.xml { render :xml => @ad.errors.to_xml }
|
53
49
|
end
|
54
50
|
end
|
55
51
|
end
|
@@ -63,10 +59,8 @@ class AdsController < BaseController
|
|
63
59
|
if @ad.update_attributes(params[:ad])
|
64
60
|
flash[:notice] = :ad_was_successfully_updated.l
|
65
61
|
format.html { redirect_to ad_url(@ad) }
|
66
|
-
format.xml { head :ok }
|
67
62
|
else
|
68
63
|
format.html { render :action => "edit" }
|
69
|
-
format.xml { render :xml => @ad.errors.to_xml }
|
70
64
|
end
|
71
65
|
end
|
72
66
|
end
|
@@ -52,7 +52,7 @@ class AlbumsController < BaseController
|
|
52
52
|
flash[:notice] = :album_was_successfully_created.l
|
53
53
|
format.html { redirect_to(user_photo_manager_index_path(current_user)) }
|
54
54
|
else
|
55
|
-
format.html { redirect_to(new_user_album_photo_path(current_user
|
55
|
+
format.html { redirect_to(new_user_album_photo_path(current_user, @album)) }
|
56
56
|
end
|
57
57
|
else
|
58
58
|
format.html { render :action => 'new' }
|
@@ -71,7 +71,7 @@ class AlbumsController < BaseController
|
|
71
71
|
flash[:notice] = :album_updated.l
|
72
72
|
format.html { redirect_to(user_album_path(current_user, @album)) }
|
73
73
|
else
|
74
|
-
format.html { redirect_to(new_user_album_photo_path(current_user
|
74
|
+
format.html { redirect_to(new_user_album_photo_path(current_user, @album)) }
|
75
75
|
end
|
76
76
|
else
|
77
77
|
format.html { render :action => "edit" }
|
@@ -2,9 +2,9 @@ class AuthorizationsController < BaseController
|
|
2
2
|
before_filter :login_required, :only => [:destroy]
|
3
3
|
|
4
4
|
def create
|
5
|
-
omniauth = request.env['omniauth.auth'] #this is where you get all the data from your provider through omniauth
|
6
|
-
provider_name = omniauth['provider'].capitalize
|
7
|
-
|
5
|
+
omniauth = request.env['omniauth.auth'] #this is where you get all the data from your provider through omniauth
|
6
|
+
provider_name = omniauth['provider'].to_s.capitalize
|
7
|
+
|
8
8
|
@auth = Authorization.find_or_create_from_hash(omniauth, current_user)
|
9
9
|
|
10
10
|
if logged_in?
|
@@ -17,25 +17,25 @@ class AuthorizationsController < BaseController
|
|
17
17
|
if logged_in?
|
18
18
|
redirect_to request.env['omniauth.origin'] || user_path(current_user)
|
19
19
|
else
|
20
|
-
flash[:notice] = @auth.user.errors.full_messages.to_sentence
|
20
|
+
flash[:notice] = @auth.user.errors.full_messages.to_sentence
|
21
21
|
redirect_to login_path
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def failure
|
26
26
|
flash[:notice] = t('authorizations.failure.notice')
|
27
27
|
redirect_to home_url
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def destroy
|
31
31
|
@authorization = current_user.authorizations.find(params[:id])
|
32
32
|
|
33
33
|
if @authorization.destroy
|
34
|
-
flash[:notice] = t('authorizations.destroy.notice', :provider => @authorization.provider.capitalize)
|
34
|
+
flash[:notice] = t('authorizations.destroy.notice', :provider => @authorization.provider.to_s.capitalize)
|
35
35
|
else
|
36
36
|
flash[:notice] = @authorization.errors.full_messages.to_sentence
|
37
37
|
end
|
38
|
-
|
39
|
-
redirect_to edit_account_user_path
|
38
|
+
|
39
|
+
redirect_to edit_account_user_path
|
40
40
|
end
|
41
41
|
end
|
@@ -11,6 +11,7 @@ class BaseController < ApplicationController
|
|
11
11
|
helper_method :commentable_url
|
12
12
|
before_filter :initialize_header_tabs
|
13
13
|
before_filter :initialize_admin_tabs
|
14
|
+
before_filter :store_location, :except => :footer_content
|
14
15
|
|
15
16
|
caches_action :site_index, :footer_content, :if => Proc.new{|c| c.cache_action? }
|
16
17
|
|
@@ -60,6 +61,25 @@ class BaseController < ApplicationController
|
|
60
61
|
|
61
62
|
def css_help
|
62
63
|
end
|
64
|
+
|
65
|
+
protected
|
66
|
+
def self.uses_tiny_mce(options = {}, &block)
|
67
|
+
if block_given?
|
68
|
+
options = block.call
|
69
|
+
end
|
70
|
+
|
71
|
+
new_configuration = TinyMCE::Rails.configuration.merge(options.delete(:options)).options
|
72
|
+
|
73
|
+
# Set instance vars in the current class
|
74
|
+
p = Proc.new do |c|
|
75
|
+
configuration = c.instance_variable_get(:@tiny_mce_configuration) || {}
|
76
|
+
|
77
|
+
c.instance_variable_set(:@tiny_mce_configuration, configuration.merge(new_configuration))
|
78
|
+
c.instance_variable_set(:@uses_tiny_mce, true)
|
79
|
+
end
|
80
|
+
|
81
|
+
before_filter p, options
|
82
|
+
end
|
63
83
|
|
64
84
|
|
65
85
|
private
|
@@ -95,7 +115,7 @@ class BaseController < ApplicationController
|
|
95
115
|
end
|
96
116
|
|
97
117
|
def popular_tags(limit = 20, type = nil)
|
98
|
-
Tag.popular(limit, type)
|
118
|
+
ActsAsTaggableOn::Tag.popular(limit, type)
|
99
119
|
end
|
100
120
|
|
101
121
|
|
@@ -39,7 +39,7 @@ class ClippingsController < BaseController
|
|
39
39
|
def index
|
40
40
|
@user = User.find(params[:user_id])
|
41
41
|
|
42
|
-
@clippings = Clipping.includes(:tags).where(:user_id => @user.id).order("created_at DESC")
|
42
|
+
@clippings = Clipping.includes(:tags).where(:user_id => @user.id).order("clippings.created_at DESC")
|
43
43
|
|
44
44
|
@clippings = @clippings.where('tags.name = ?', params[:tag_name]) if params[:tag_name]
|
45
45
|
|
@@ -88,7 +88,6 @@ class ClippingsController < BaseController
|
|
88
88
|
begin
|
89
89
|
doc = Hpricot( open( uri ) )
|
90
90
|
rescue
|
91
|
-
render :inline => "<h1>Sorry, there was an error fetching the images from the page you requested</h1><a href='#{params[:uri]}'>Go back...</a>"
|
92
91
|
return
|
93
92
|
end
|
94
93
|
@page_title = (doc/"title")
|
@@ -148,7 +148,7 @@ class CommentsController < BaseController
|
|
148
148
|
|
149
149
|
|
150
150
|
def unsubscribe
|
151
|
-
@comment = Comment.find(params[:
|
151
|
+
@comment = Comment.find(params[:id])
|
152
152
|
if @comment.token_for(params[:email]).eql?(params[:token])
|
153
153
|
@comment.unsubscribe_notifications(params[:email])
|
154
154
|
flash[:notice] = :comment_unsubscribe_succeeded.l
|
@@ -10,7 +10,7 @@ class ForumsController < BaseController
|
|
10
10
|
@forums = Forum.find(:all, :order => "position")
|
11
11
|
respond_to do |format|
|
12
12
|
format.html
|
13
|
-
format.xml { render :xml => @forums
|
13
|
+
format.xml { render :xml => @forums }
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -24,15 +24,12 @@ class ForumsController < BaseController
|
|
24
24
|
end
|
25
25
|
|
26
26
|
format.xml do
|
27
|
-
render :xml => @forum
|
27
|
+
render :xml => @forum
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
32
|
-
# new renders new.rhtml
|
33
31
|
|
34
32
|
def create
|
35
|
-
@forum.attributes = params[:forum]
|
36
33
|
@forum.tag_list = params[:tag_list] || ''
|
37
34
|
@forum.save!
|
38
35
|
respond_to do |format|
|
@@ -42,9 +39,8 @@ class ForumsController < BaseController
|
|
42
39
|
end
|
43
40
|
|
44
41
|
def update
|
45
|
-
@forum.attributes = params[:forum]
|
46
42
|
@forum.tag_list = params[:tag_list] || ''
|
47
|
-
@forum.
|
43
|
+
@forum.update_attributes!(params[:forum])
|
48
44
|
respond_to do |format|
|
49
45
|
format.html { redirect_to forums_path }
|
50
46
|
format.xml { head 200 }
|
@@ -61,7 +57,7 @@ class ForumsController < BaseController
|
|
61
57
|
|
62
58
|
protected
|
63
59
|
def find_or_initialize_forum
|
64
|
-
@forum = params[:id] ? Forum.find(params[:id]) : Forum.new
|
60
|
+
@forum = params[:id] ? Forum.find(params[:id]) : Forum.new(params[:forum])
|
65
61
|
end
|
66
62
|
|
67
63
|
|