community_engine 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +4 -1
  3. data/.travis.yml +5 -2
  4. data/CHANGELOG.markdown +270 -0
  5. data/Gemfile +3 -0
  6. data/README.markdown +20 -21
  7. data/Rakefile +8 -6
  8. data/TODO.markdown +3 -0
  9. data/UPGRADING.markdown +46 -36
  10. data/app/assets/javascripts/active_admin.js.coffee +19 -0
  11. data/app/assets/javascripts/ckeditor/configs/ads.js.coffee +175 -0
  12. data/app/assets/javascripts/ckeditor/configs/comments.js.coffee +2 -0
  13. data/app/assets/javascripts/ckeditor/configs/posts.js.coffee +248 -0
  14. data/app/assets/javascripts/ckeditor/rte/rte.ads.js.coffee +7 -0
  15. data/app/assets/javascripts/ckeditor/rte/rte.comments.js.coffee +8 -0
  16. data/app/assets/javascripts/ckeditor/rte/rte.js.coffee +20 -0
  17. data/app/assets/javascripts/ckeditor/rte/rte.posts.js.coffee +14 -0
  18. data/app/assets/javascripts/community_engine.js +114 -123
  19. data/{vendor → app}/assets/javascripts/jcrop/jquery.Jcrop.js +0 -0
  20. data/{vendor → app}/assets/javascripts/jcrop/jquery.color.js +0 -0
  21. data/{vendor → app}/assets/javascripts/tag-it/tag-it.js +0 -0
  22. data/app/assets/stylesheets/active_admin.css.scss +27 -0
  23. data/{vendor → app}/assets/stylesheets/jcrop/Jcrop.gif +0 -0
  24. data/{vendor → app}/assets/stylesheets/jcrop/jquery.Jcrop.min.css +0 -0
  25. data/{vendor → app}/assets/stylesheets/tag-it/tag-it.css +0 -0
  26. data/{vendor → app}/assets/stylesheets/tag-it/tagit.ui-zendesk.css +0 -0
  27. data/app/controllers/activities_controller.rb +4 -4
  28. data/app/controllers/albums_controller.rb +13 -18
  29. data/app/controllers/authorizations_controller.rb +1 -1
  30. data/app/controllers/base_controller.rb +9 -32
  31. data/app/controllers/categories_controller.rb +1 -78
  32. data/app/controllers/clippings_controller.rb +3 -7
  33. data/app/controllers/comments_controller.rb +4 -24
  34. data/app/controllers/events_controller.rb +3 -12
  35. data/app/controllers/favorites_controller.rb +2 -2
  36. data/app/controllers/forums_controller.rb +5 -9
  37. data/app/controllers/invitations_controller.rb +1 -1
  38. data/app/controllers/messages_controller.rb +4 -8
  39. data/app/controllers/moderators_controller.rb +1 -1
  40. data/app/controllers/monitorships_controller.rb +1 -1
  41. data/app/controllers/pages_controller.rb +0 -62
  42. data/app/controllers/password_resets_controller.rb +2 -2
  43. data/app/controllers/photo_manager_controller.rb +3 -3
  44. data/app/controllers/photos_controller.rb +43 -14
  45. data/app/controllers/posts_controller.rb +7 -14
  46. data/app/controllers/rsvps_controller.rb +3 -3
  47. data/app/controllers/sb_posts_controller.rb +20 -20
  48. data/app/controllers/sessions_controller.rb +1 -1
  49. data/app/controllers/tags_controller.rb +4 -52
  50. data/app/controllers/topics_controller.rb +15 -10
  51. data/app/controllers/users_controller.rb +9 -16
  52. data/app/controllers/votes_controller.rb +2 -2
  53. data/app/helpers/base_helper.rb +4 -14
  54. data/app/models/acts_as_taggable_on/tag.rb +9 -41
  55. data/app/models/clipping.rb +1 -1
  56. data/app/models/forum.rb +2 -2
  57. data/app/models/photo.rb +1 -1
  58. data/app/models/post.rb +1 -1
  59. data/app/models/sb_post.rb +19 -15
  60. data/app/models/topic.rb +10 -10
  61. data/app/models/user.rb +1 -1
  62. data/app/policies/active_admin/page_policy.rb +11 -0
  63. data/app/policies/application_policy.rb +59 -0
  64. data/app/policies/post_policy.rb +13 -0
  65. data/app/policies/sb_post_policy.rb +15 -0
  66. data/app/policies/topic_policy.rb +23 -0
  67. data/app/views/ckeditor/pictures/index.html.haml +15 -0
  68. data/app/views/ckeditor/shared/_asset.html.haml +9 -0
  69. data/app/views/ckeditor/shared/_asset_tmpl.html.erb +14 -0
  70. data/app/views/comments/approve.js.haml +1 -1
  71. data/app/views/comments/create.js.erb +1 -1
  72. data/app/views/comments/edit.js.erb +2 -1
  73. data/app/views/events/_subscribe.html.haml +1 -1
  74. data/app/views/forums/show.html.haml +8 -4
  75. data/app/views/posts/show.html.haml +4 -0
  76. data/app/views/sb_posts/_edit_script.js.erb +2 -3
  77. data/app/views/sb_posts/_reply_script.js.erb +2 -4
  78. data/app/views/sb_posts/_sb_post.html.haml +7 -6
  79. data/app/views/sb_posts/create.js.erb +4 -4
  80. data/app/views/sb_posts/edit.js.erb +2 -1
  81. data/app/views/sessions/_menu_item.html.haml +4 -4
  82. data/app/views/shared/_end_javascript.html.haml +1 -2
  83. data/app/views/shared/_login_sidebar.html.haml +2 -2
  84. data/app/views/tags/show.html.haml +3 -3
  85. data/app/views/topics/show.html.haml +1 -1
  86. data/app/views/users/_profile_user_info_sidebar.html.haml +2 -2
  87. data/app/views/users/destroy.js.erb +3 -0
  88. data/app/views/users/new.html.haml +1 -1
  89. data/app/views/users/show.html.haml +1 -1
  90. data/app/views/users/signup_completed.html.haml +1 -1
  91. data/community_engine.gemspec +14 -11
  92. data/config/initializers/active_admin.rb +239 -0
  93. data/config/initializers/ckeditor.rb +8 -0
  94. data/config/initializers/ransack_bootstrap_fix.rb +25 -0
  95. data/config/locales/de-DE.yml +1 -0
  96. data/config/locales/en.yml +3 -0
  97. data/config/routes.rb +14 -19
  98. data/config/spring.rb +1 -0
  99. data/db/migrate/083_create_active_admin_comments.rb +19 -0
  100. data/lib/community_engine.rb +7 -3
  101. data/lib/community_engine/admin/ads.rb +3 -0
  102. data/lib/community_engine/admin/categories.rb +20 -0
  103. data/lib/community_engine/admin/comments.rb +4 -0
  104. data/lib/community_engine/admin/dashboard.rb +38 -0
  105. data/lib/community_engine/admin/events.rb +3 -0
  106. data/lib/community_engine/admin/forums.rb +3 -0
  107. data/lib/community_engine/admin/homepage_features.rb +25 -0
  108. data/lib/community_engine/admin/metro_areas.rb +4 -0
  109. data/lib/community_engine/admin/pages.rb +26 -0
  110. data/lib/community_engine/admin/posts.rb +92 -0
  111. data/lib/community_engine/admin/tags.rb +21 -0
  112. data/lib/community_engine/admin/users.rb +54 -0
  113. data/lib/community_engine/authenticated_system.rb +5 -20
  114. data/lib/community_engine/engine.rb +5 -0
  115. data/lib/community_engine/version.rb +1 -1
  116. data/lib/resource_feeder/atom.rb +2 -0
  117. data/lib/resource_feeder/rss.rb +2 -0
  118. data/lib/white_list.rb +6 -11
  119. data/test/fixtures/events.yml +10 -0
  120. data/test/fixtures/tags.yml +6 -5
  121. data/test/functional/activities_controller_test.rb +19 -19
  122. data/test/functional/admin/posts_controller_test.rb +16 -0
  123. data/test/functional/admin_controller_test.rb +82 -82
  124. data/test/functional/categories_controller_test.rb +0 -39
  125. data/test/functional/comments_controller_test.rb +14 -7
  126. data/test/functional/favorites_controller_test.rb +15 -16
  127. data/test/functional/pages_controller_test.rb +0 -71
  128. data/test/functional/posts_controller_test.rb +21 -2
  129. data/test/functional/sb_posts_controller_test.rb +3 -3
  130. data/test/functional/sessions_controller_test.rb +2 -2
  131. data/test/functional/tags_controller_test.rb +9 -20
  132. data/test/functional/users_controller_test.rb +0 -8
  133. data/test/functional/votes_controller_test.rb +1 -1
  134. data/test/testapp/config/spring.rb +1 -0
  135. data/test/testapp/db/schema.rb +16 -1
  136. data/test/unit/event_test.rb +1 -1
  137. metadata +204 -170
  138. data/CHANGELOG +0 -144
  139. data/app/controllers/admin_controller.rb +0 -80
  140. data/app/controllers/ads_controller.rb +0 -90
  141. data/app/controllers/homepage_features_controller.rb +0 -74
  142. data/app/controllers/metro_areas_controller.rb +0 -74
  143. data/app/controllers/statistics_controller.rb +0 -35
  144. data/app/views/admin/comments.html.haml +0 -53
  145. data/app/views/admin/events.html.haml +0 -26
  146. data/app/views/admin/messages.html.haml +0 -3
  147. data/app/views/admin/update.js.erb +0 -1
  148. data/app/views/admin/users.html.haml +0 -57
  149. data/app/views/ads/_form.html.haml +0 -21
  150. data/app/views/ads/edit.html.haml +0 -7
  151. data/app/views/ads/index.html.haml +0 -29
  152. data/app/views/ads/new.html.haml +0 -6
  153. data/app/views/ads/show.html.haml +0 -19
  154. data/app/views/categories/_form.html.haml +0 -8
  155. data/app/views/categories/edit.html.haml +0 -4
  156. data/app/views/categories/index.html.haml +0 -20
  157. data/app/views/categories/new.html.haml +0 -4
  158. data/app/views/homepage_features/_form.html.haml +0 -6
  159. data/app/views/homepage_features/edit.html.haml +0 -6
  160. data/app/views/homepage_features/index.html.haml +0 -24
  161. data/app/views/homepage_features/new.html.haml +0 -2
  162. data/app/views/homepage_features/show.html.haml +0 -27
  163. data/app/views/metro_areas/_form.html.haml +0 -6
  164. data/app/views/metro_areas/edit.html.haml +0 -8
  165. data/app/views/metro_areas/index.html.haml +0 -21
  166. data/app/views/metro_areas/new.html.haml +0 -6
  167. data/app/views/metro_areas/show.html.haml +0 -14
  168. data/app/views/pages/_form.html.haml +0 -18
  169. data/app/views/pages/edit.html.haml +0 -4
  170. data/app/views/pages/index.html.haml +0 -34
  171. data/app/views/pages/new.html.haml +0 -7
  172. data/app/views/shared/_admin_nav.html.haml +0 -17
  173. data/app/views/shared/_load_tinymce.js.erb +0 -15
  174. data/app/views/statistics/activities.xml.builder +0 -33
  175. data/app/views/statistics/index.html.haml +0 -48
  176. data/app/views/tags/edit.html.haml +0 -12
  177. data/app/views/tags/manage.html.haml +0 -30
  178. data/app/views/users/update.js.erb +0 -1
  179. data/test/functional/ads_controller_test.rb +0 -51
  180. data/test/functional/homepage_features_controller_test.rb +0 -69
  181. data/test/functional/metro_areas_controller_test.rb +0 -63
  182. data/test/functional/statistics_controller_test.rb +0 -18
  183. data/test/unit/acts_as_taggable_on/tag_test.rb +0 -22
  184. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/README +0 -3
  185. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/Rakefile +0 -22
  186. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/generators/publishing/publishing_generator.rb +0 -34
  187. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/generators/publishing/templates/migration.rb +0 -13
  188. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/install.rb +0 -3
  189. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/test/acts_as_publishable_test.rb +0 -8
  190. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/uninstall.rb +0 -1
  191. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/README +0 -4
  192. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/Rakefile +0 -22
  193. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/atom_feed_test.rb +0 -85
  194. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/rss_feed_test.rb +0 -61
  195. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/test_helper.rb +0 -60
  196. data/vendor/converted2.3plugins_to_lib_leftovers/white_list/README +0 -35
  197. data/vendor/converted2.3plugins_to_lib_leftovers/white_list/Rakefile +0 -22
  198. data/vendor/converted2.3plugins_to_lib_leftovers/white_list/test/white_list_test.rb +0 -120
@@ -0,0 +1,8 @@
1
+ Ckeditor.setup do |config|
2
+ require "ckeditor/orm/active_record"
3
+
4
+ config.default_per_page = 24
5
+
6
+ config.assets_languages = ['en']
7
+
8
+ end
@@ -0,0 +1,25 @@
1
+ # Ugly fix because BootstrapForm always expects an AR object.
2
+
3
+ BootstrapForm::FormBuilder.class_eval do
4
+
5
+ def required_attribute?(obj, attribute)
6
+ return false unless obj.respond_to?(:validators_on)
7
+ return false unless obj and attribute
8
+
9
+ target = (obj.class == Class) ? obj : obj.class
10
+ target_validators = target.validators_on(attribute).map(&:class)
11
+
12
+ has_presence_validator = target_validators.include?(
13
+ ActiveModel::Validations::PresenceValidator)
14
+
15
+ if defined? ActiveRecord::Validations::PresenceValidator
16
+ has_presence_validator |= target_validators.include?(
17
+ ActiveRecord::Validations::PresenceValidator)
18
+ end
19
+
20
+ has_presence_validator
21
+ end
22
+
23
+
24
+
25
+ end
@@ -853,6 +853,7 @@ de-DE:
853
853
  posts_photos_and_bookmarks: "%{name} Beiträge, Fotos und Bookmarks"
854
854
  #en: posts_saved_with_draft_status_wont_appear_in_your_blog_until_you_publish_them: Posts saved with 'draft' status won't appear in your blog until you publish them.
855
855
  posts_saved_with_draft_status_wont_appear_in_your_blog_until_you_publish_them: "Einträge, die als Entwurf gespeichert wurden, erscheinen erst in deinem Blog, wenn du sie veröffentlichst."
856
+ post_not_published_yet: "Dieser Eintrag wurde noch nicht veröffentlicht."
856
857
  #en: preview: Preview
857
858
  preview: Vorschau
858
859
  #en: previewing_your_post: Previewing your post
@@ -1023,6 +1023,7 @@ en:
1023
1023
  posts_photos_and_bookmarks: "%{name} posts, photos and bookmarks"
1024
1024
  #en: posts_saved_with_draft_status_wont_appear_in_your_blog_until_you_publish_them: "Posts saved with 'draft' status won't appear in your blog until you publish them."
1025
1025
  posts_saved_with_draft_status_wont_appear_in_your_blog_until_you_publish_them: "Posts saved with 'draft' status won't appear in your blog until you publish them."
1026
+ post_not_published_yet: "This post is not published yet."
1026
1027
  #en: posts_tagged: Posts tagged
1027
1028
  posts_tagged: "Posts tagged"
1028
1029
  #en: pages_saved_with_draft_status_wont_appear_on_the_site_until_you_publish_them: Pages saved with 'draft' status won't appear on the site until you publish them.
@@ -1305,6 +1306,8 @@ en:
1305
1306
  the_friendship_was_denied: The friendship was denied.
1306
1307
  #en: the_more_people_you_invite_the_better: The more people you invite, the better
1307
1308
  the_more_people_you_invite_the_better: "The more people you invite, the better"
1309
+ #en: the_selected_users_were_deleted: The selected users were deleted.
1310
+ the_selected_users_were_deleted: The selected users were deleted.
1308
1311
  #en: the_service_was_deleted: The service was deleted.
1309
1312
  the_service_was_deleted: The service was deleted.
1310
1313
  #en: the_slideshow_is_disabled: The slideshow is disabled.
@@ -1,4 +1,6 @@
1
1
  Rails.application.routes.draw do
2
+ ActiveAdmin.routes(self)
3
+
2
4
  concern :paginatable do
3
5
  get '(page/:page)', :action => :index, :on => :collection
4
6
  end
@@ -44,24 +46,14 @@ Rails.application.routes.draw do
44
46
 
45
47
  get '/' => 'base#site_index', :as => :home
46
48
 
47
- scope "/admin" do
48
- get 'dashboard' => 'homepage_features#index', :as => :admin_dashboard
49
- match 'users' => 'admin#users', :as => :admin_users, :via => [:post, :get]
50
- get 'messages' => 'admin#messages', :as => :admin_messages
51
- match 'comments' => 'admin#comments', :as => :admin_comments, :via => [:post, :get]
52
- match 'tags' => 'tags#manage', :as => :admin_tags, :via => [:post, :get]
53
- get 'events' => 'admin#events', :as => :admin_events
54
- get 'clear_cache' => 'admin#clear_cache', :as => :admin_clear_cache
55
- get 'subscribers(.:format)' => "admin#subscribers", :as => :admin_subscribers
56
- get 'activate_user' => "admin#activate_user", :as => :admin_activate_user
57
- get 'deactivate_user' => 'admin#deactivate_user', :as => :admin_deactivate_user
58
-
59
- resources :pages, :as => :admin_pages do
60
- member do
61
- get :preview
62
- end
63
- end
64
- end
49
+ root to: "base#site_index"
50
+
51
+
52
+
53
+ # scope "/admin" do
54
+ # get 'dashboard' => 'homepage_features#index', :as => :admin_dashboard
55
+ # get 'clear_cache' => 'admin#clear_cache', :as => :admin_clear_cache
56
+ # end
65
57
 
66
58
  get 'pages/:id' => 'pages#show', :as => :pages
67
59
 
@@ -76,7 +68,7 @@ Rails.application.routes.draw do
76
68
 
77
69
  match '/forgot_username' => 'users#forgot_username', :as => :forgot_username, :via => [:get, :post]
78
70
 
79
- post '/resend_activation' => 'users#resend_activation', :as => :resend_activation
71
+ post '/resend_activation/:id' => 'users#resend_activation', :as => :resend_activation
80
72
 
81
73
  get '/new_clipping' => 'clippings#new_clipping'
82
74
  post '/load_images_from_uri' => 'clippings#load_images_from_uri', :format => 'js'
@@ -100,6 +92,8 @@ Rails.application.routes.draw do
100
92
  get '/friendships' => 'friendships#index', :as => :friendships
101
93
 
102
94
  get 'manage_photos' => 'photos#manage_photos', :as => :manage_photos
95
+ post 'manage_photos' => 'photos#create_photos', :as => :create_photos
96
+
103
97
  post 'create_photo.js' => 'photos#create', :as => :create_photo, :format => 'js'
104
98
 
105
99
  resources :sessions
@@ -252,4 +246,5 @@ Rails.application.routes.draw do
252
246
  get '/users/:user_id/posts/category/:category_name' => 'posts#index', :as => :users_posts_in_category
253
247
  post '/users/metro_area_update' => 'users#metro_area_update', :as => :users_metro_area_update
254
248
 
249
+
255
250
  end
@@ -0,0 +1 @@
1
+ Spring.application_root = './test/testapp'
@@ -0,0 +1,19 @@
1
+ class CreateActiveAdminComments < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :active_admin_comments do |t|
4
+ t.string :namespace
5
+ t.text :body
6
+ t.string :resource_id, null: false
7
+ t.string :resource_type, null: false
8
+ t.references :author, polymorphic: true
9
+ t.timestamps
10
+ end
11
+ add_index :active_admin_comments, [:namespace]
12
+ add_index :active_admin_comments, [:author_type, :author_id]
13
+ add_index :active_admin_comments, [:resource_type, :resource_id]
14
+ end
15
+
16
+ def self.down
17
+ drop_table :active_admin_comments
18
+ end
19
+ end
@@ -1,4 +1,5 @@
1
1
  require 'acts-as-taggable-on'
2
+ require 'ckeditor' #has to come first so we can override stuff in CE
2
3
 
3
4
  require 'community_engine/engine'
4
5
 
@@ -15,7 +16,7 @@ require 'hpricot'
15
16
  require 'htmlentities'
16
17
  require 'haml'
17
18
  require 'sass-rails'
18
- require 'aws/s3'
19
+ require 'aws-sdk'
19
20
  require 'ri_cal'
20
21
  require 'rakismet'
21
22
  require 'kaminari'
@@ -29,13 +30,16 @@ require 'omniauth'
29
30
  require 'authlogic'
30
31
  require 'rails_autolink'
31
32
  require 'ransack'
32
- require 'tinymce-rails'
33
33
  require 'sanitize'
34
34
  require 'bootstrap-sass'
35
35
  require 'bootstrap_form'
36
36
  require 'font-awesome-rails'
37
37
  require 'jquery-rails'
38
38
  require 'jquery-ui-rails'
39
+ require 'jquery-turbolinks'
40
+ require 'turbolinks'
41
+ require 'active_admin'
42
+ require 'pundit'
39
43
 
40
44
  # Rails 2.3 Plugins converted to lib
41
45
  require 'activity_tracker'
@@ -53,6 +57,6 @@ require 'actionpack/action_caching'
53
57
  require 'actionpack/page_caching'
54
58
 
55
59
  # We need this here because it will not get autoloaded. Maybe this should go in lib?
56
- require File.dirname(__FILE__) + "/../app/models/acts_as_taggable_on/tag"
60
+ require_dependency File.dirname(__FILE__) + "/../app/models/acts_as_taggable_on/tag"
57
61
 
58
62
  include EnginesExtensions
@@ -0,0 +1,3 @@
1
+ ActiveAdmin.register Ad do
2
+ permit_params :name, :html, :frequency, :audience, :start_date, :end_date, :location, :published, :time_constrained
3
+ end
@@ -0,0 +1,20 @@
1
+ ActiveAdmin.register Category do
2
+ permit_params :name, :tips, :new_post_text, :nav_text, :slug
3
+
4
+ menu :parent => "Taxonomy", :priority => 1
5
+ filter :name
6
+
7
+ index do
8
+ column :id do |category|
9
+ link_to category.id, admin_category_path(category)
10
+ end
11
+
12
+ column :name
13
+ column :tips
14
+ column :posts do |category|
15
+ category.posts.count
16
+ end
17
+ default_actions
18
+ end
19
+
20
+ end
@@ -0,0 +1,4 @@
1
+ ActiveAdmin.register Comment do
2
+ permit_params :author_name, :author_email, :notify_by_email, :author_url, :comment
3
+ actions :all, except: [:new, :create]
4
+ end
@@ -0,0 +1,38 @@
1
+ ActiveAdmin.register_page "Dashboard" do
2
+
3
+ menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }
4
+
5
+ page_action :clear_cache do
6
+ case Rails.cache
7
+ when ActiveSupport::Cache::FileStore
8
+ dir = Rails.cache.cache_path
9
+ unless dir == Rails.public_path
10
+ FileUtils.rm_r(Dir.glob(dir+"/*")) rescue Errno::ENOENT
11
+ Rails.logger.info("Cache directory fully swept.")
12
+ end
13
+ flash[:notice] = :cache_cleared.l
14
+ else
15
+ Rails.logger.warn("Cache not swept: you must override AdminController#clear_cache to support #{Rails.cache}")
16
+ end
17
+ redirect_to admin_dashboard_path and return
18
+ end
19
+
20
+
21
+ content title: proc{ I18n.t("active_admin.dashboard") } do
22
+
23
+ columns do
24
+ column do
25
+ panel "Info" do
26
+ para "Welcome to CE."
27
+ end
28
+ end
29
+
30
+ column do
31
+ panel "Cache" do
32
+ link_to "Clear cache", admin_dashboard_clear_cache_path
33
+ end
34
+ end
35
+ end
36
+
37
+ end # content
38
+ end
@@ -0,0 +1,3 @@
1
+ ActiveAdmin.register Event do
2
+ permit_params :user_id, :name, :start_time, :end_time, :description, :metro_area, :location, :allow_rsvp
3
+ end
@@ -0,0 +1,3 @@
1
+ ActiveAdmin.register Forum do
2
+ permit_params :name, :description, :position, :description_html
3
+ end
@@ -0,0 +1,25 @@
1
+ ActiveAdmin.register HomepageFeature, as: "Features" do
2
+ permit_params :url, :title, :description, :image
3
+
4
+ form do |f|
5
+
6
+ f.semantic_errors *f.object.errors.keys
7
+ inputs 'Details' do
8
+ input :url
9
+ input :title
10
+ end
11
+
12
+ inputs 'Content' do
13
+ input :description, input_html: {class: 'rich_text_editor'}
14
+ input :image, as: :file, required: true, hint: image_tag(f.object.image.url(:thumb))
15
+ end
16
+
17
+
18
+ panel 'Actions' do
19
+ actions
20
+ end
21
+ end
22
+
23
+
24
+
25
+ end
@@ -0,0 +1,4 @@
1
+ ActiveAdmin.register MetroArea do
2
+ permit_params :name, :state, :country_id, :state_id
3
+ end
4
+
@@ -0,0 +1,26 @@
1
+ ActiveAdmin.register Page do
2
+
3
+ form do |f|
4
+ tabs do
5
+ tab 'Main' do
6
+ f.semantic_errors *f.object.errors.keys
7
+ inputs 'Details' do
8
+ input :title
9
+ input :published_as, as: :select, collection: ['live', 'draft']
10
+ li "Created at #{f.object.created_at}" unless f.object.new_record?
11
+ end
12
+
13
+ inputs 'Content' do
14
+ input :body, input_html: {class: 'rich_text_editor'}
15
+ end
16
+ end
17
+
18
+ end
19
+
20
+ panel 'Actions' do
21
+ actions
22
+ end
23
+ end
24
+
25
+
26
+ end
@@ -0,0 +1,92 @@
1
+ ActiveAdmin.register Post do
2
+ permit_params :title, :raw_post, :published_at, :published_as, :category_id
3
+
4
+ filter :title
5
+ filter :user_login_cont, if: proc{ current_user.admin? }, label: "User"
6
+ filter :published_as, as: :select, collection: [['Published','live'], ['Draft','draft']], include_blank: true
7
+ filter :published_at
8
+ filter :created_at
9
+
10
+ scope_to unless: proc{ current_user.admin? } do
11
+ current_user.posts
12
+ end
13
+
14
+ controller do
15
+ def scoped_collection
16
+ end_of_association_chain.unscoped
17
+ end
18
+ end
19
+
20
+
21
+ index do
22
+ selectable_column
23
+ column :id do |post|
24
+ link_to post.id, admin_post_path(post)
25
+ end
26
+
27
+ column :user
28
+
29
+ column :published_at
30
+ column :published_as do |post|
31
+ if post.is_live? && post.published_at <= Time.now
32
+ link_to(:published.l, user_post_path(post.user, post))
33
+ elsif post.is_live? && post.published_at > Time.now
34
+ "Pending"
35
+ elsif !post.is_live?
36
+ :draft.l
37
+ end
38
+ end
39
+
40
+ column :title do |post|
41
+ link_to post.title, user_post_path(post.user, post)
42
+ end
43
+ column :tags do |post|
44
+ simple_format post.taggings.group_by(&:context).map{|context, array|
45
+ "<strong>#{context}</strong>: " + array.map{|t| t.tag.name }.join(',')
46
+ }.join("\n")
47
+ end
48
+
49
+ actions
50
+ end
51
+
52
+ form do |f|
53
+ tabs do
54
+ tab 'Content' do
55
+ f.semantic_errors *f.object.errors.keys
56
+ inputs 'Title' do
57
+ input :title
58
+ end
59
+
60
+ inputs 'Content' do
61
+ input :raw_post, input_html: {class: 'rich_text_editor'}
62
+ end
63
+ end
64
+
65
+ tab 'Meta' do
66
+ inputs 'Publishing' do
67
+ input :published_at, minute_step: 15
68
+ input :published_as, as: :select, collection: [['Live', 'live'], ['Draft', 'draft']]
69
+ li "Created at #{f.object.created_at}" unless f.object.new_record?
70
+ end
71
+
72
+ inputs "Taxonomy" do
73
+ input :category
74
+ input :tag_list, input_html: {id: 'tags', data: {auto_complete_url: auto_complete_for_tag_name_tags_path}}
75
+ end
76
+
77
+ inputs 'Commenting' do
78
+ input :comments_disabled
79
+ input :send_comment_notifications
80
+ end
81
+ end
82
+
83
+ end
84
+
85
+ panel 'Actions' do
86
+ actions
87
+ end
88
+ end
89
+
90
+
91
+
92
+ end
@@ -0,0 +1,21 @@
1
+ ActiveAdmin.register ActsAsTaggableOn::Tag, as: "Tag" do
2
+ menu :parent => "Taxonomy", :priority => 2
3
+ permit_params :name
4
+
5
+ filter :name
6
+
7
+
8
+ controller do
9
+ def find_resource
10
+ ActsAsTaggableOn::Tag.find_by_name(URI::decode(params[:id]))
11
+ end
12
+ end
13
+
14
+
15
+ index do
16
+ column :id
17
+ column :name
18
+ column :taggings_count
19
+ column :featured
20
+ end
21
+ end
@@ -0,0 +1,54 @@
1
+ ActiveAdmin.register User do
2
+ permit_params :avatar_id, :country_id, :description, :email,
3
+ :gender, :login, :metro_area_id,
4
+ :notify_comments, :notify_community_news,
5
+ :notify_friend_requests, :password, :password_confirmation,
6
+ :profile_public, :state_id, :stylesheet, :vendor, :zip,
7
+ :tag_list,
8
+ {:avatar_attributes => [:id, :name, :description, :album_id, :user, :user_id, :photo, :photo_remote_url]}, :birthday
9
+
10
+
11
+ index do
12
+ selectable_column
13
+ column :id
14
+ column :login
15
+ column :email
16
+ column :created_at
17
+ actions
18
+ end
19
+
20
+
21
+ form do |f|
22
+ f.semantic_errors *f.object.errors.keys
23
+
24
+ inputs 'Details', :email, :login, :password, :password_confirmation
25
+
26
+ inputs 'Description' do
27
+ input :description, input_html: {class: 'rich_text_editor'}
28
+ input :tag_list
29
+ input :gender
30
+ input :birthday
31
+ end
32
+
33
+ f.inputs 'Location', :country, :state, :metro_area, :zip
34
+
35
+ f.inputs 'Notifications', :notify_comments, :notify_community_news, :notify_friend_requests
36
+
37
+ f.actions
38
+ end
39
+
40
+
41
+ # def activate_user
42
+ # user = User.find(params[:id])
43
+ # user.activate
44
+ # flash[:notice] = :the_user_was_activated.l
45
+ # redirect_to :action => :users
46
+ # end
47
+
48
+ # def deactivate_user
49
+ # user = User.find(params[:id])
50
+ # user.deactivate
51
+ # flash[:notice] = :the_user_was_deactivated.l
52
+ # redirect_to :action => :users
53
+ # end
54
+ end