community_engine 3.0.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +4 -1
- data/.travis.yml +5 -2
- data/CHANGELOG.markdown +270 -0
- data/Gemfile +3 -0
- data/README.markdown +20 -21
- data/Rakefile +8 -6
- data/TODO.markdown +3 -0
- data/UPGRADING.markdown +46 -36
- data/app/assets/javascripts/active_admin.js.coffee +19 -0
- data/app/assets/javascripts/ckeditor/configs/ads.js.coffee +175 -0
- data/app/assets/javascripts/ckeditor/configs/comments.js.coffee +2 -0
- data/app/assets/javascripts/ckeditor/configs/posts.js.coffee +248 -0
- data/app/assets/javascripts/ckeditor/rte/rte.ads.js.coffee +7 -0
- data/app/assets/javascripts/ckeditor/rte/rte.comments.js.coffee +8 -0
- data/app/assets/javascripts/ckeditor/rte/rte.js.coffee +20 -0
- data/app/assets/javascripts/ckeditor/rte/rte.posts.js.coffee +14 -0
- data/app/assets/javascripts/community_engine.js +114 -123
- data/{vendor → app}/assets/javascripts/jcrop/jquery.Jcrop.js +0 -0
- data/{vendor → app}/assets/javascripts/jcrop/jquery.color.js +0 -0
- data/{vendor → app}/assets/javascripts/tag-it/tag-it.js +0 -0
- data/app/assets/stylesheets/active_admin.css.scss +27 -0
- data/{vendor → app}/assets/stylesheets/jcrop/Jcrop.gif +0 -0
- data/{vendor → app}/assets/stylesheets/jcrop/jquery.Jcrop.min.css +0 -0
- data/{vendor → app}/assets/stylesheets/tag-it/tag-it.css +0 -0
- data/{vendor → app}/assets/stylesheets/tag-it/tagit.ui-zendesk.css +0 -0
- data/app/controllers/activities_controller.rb +4 -4
- data/app/controllers/albums_controller.rb +13 -18
- data/app/controllers/authorizations_controller.rb +1 -1
- data/app/controllers/base_controller.rb +9 -32
- data/app/controllers/categories_controller.rb +1 -78
- data/app/controllers/clippings_controller.rb +3 -7
- data/app/controllers/comments_controller.rb +4 -24
- data/app/controllers/events_controller.rb +3 -12
- data/app/controllers/favorites_controller.rb +2 -2
- data/app/controllers/forums_controller.rb +5 -9
- data/app/controllers/invitations_controller.rb +1 -1
- data/app/controllers/messages_controller.rb +4 -8
- data/app/controllers/moderators_controller.rb +1 -1
- data/app/controllers/monitorships_controller.rb +1 -1
- data/app/controllers/pages_controller.rb +0 -62
- data/app/controllers/password_resets_controller.rb +2 -2
- data/app/controllers/photo_manager_controller.rb +3 -3
- data/app/controllers/photos_controller.rb +43 -14
- data/app/controllers/posts_controller.rb +7 -14
- data/app/controllers/rsvps_controller.rb +3 -3
- data/app/controllers/sb_posts_controller.rb +20 -20
- data/app/controllers/sessions_controller.rb +1 -1
- data/app/controllers/tags_controller.rb +4 -52
- data/app/controllers/topics_controller.rb +15 -10
- data/app/controllers/users_controller.rb +9 -16
- data/app/controllers/votes_controller.rb +2 -2
- data/app/helpers/base_helper.rb +4 -14
- data/app/models/acts_as_taggable_on/tag.rb +9 -41
- data/app/models/clipping.rb +1 -1
- data/app/models/forum.rb +2 -2
- data/app/models/photo.rb +1 -1
- data/app/models/post.rb +1 -1
- data/app/models/sb_post.rb +19 -15
- data/app/models/topic.rb +10 -10
- data/app/models/user.rb +1 -1
- data/app/policies/active_admin/page_policy.rb +11 -0
- data/app/policies/application_policy.rb +59 -0
- data/app/policies/post_policy.rb +13 -0
- data/app/policies/sb_post_policy.rb +15 -0
- data/app/policies/topic_policy.rb +23 -0
- data/app/views/ckeditor/pictures/index.html.haml +15 -0
- data/app/views/ckeditor/shared/_asset.html.haml +9 -0
- data/app/views/ckeditor/shared/_asset_tmpl.html.erb +14 -0
- data/app/views/comments/approve.js.haml +1 -1
- data/app/views/comments/create.js.erb +1 -1
- data/app/views/comments/edit.js.erb +2 -1
- data/app/views/events/_subscribe.html.haml +1 -1
- data/app/views/forums/show.html.haml +8 -4
- data/app/views/posts/show.html.haml +4 -0
- data/app/views/sb_posts/_edit_script.js.erb +2 -3
- data/app/views/sb_posts/_reply_script.js.erb +2 -4
- data/app/views/sb_posts/_sb_post.html.haml +7 -6
- data/app/views/sb_posts/create.js.erb +4 -4
- data/app/views/sb_posts/edit.js.erb +2 -1
- data/app/views/sessions/_menu_item.html.haml +4 -4
- data/app/views/shared/_end_javascript.html.haml +1 -2
- data/app/views/shared/_login_sidebar.html.haml +2 -2
- data/app/views/tags/show.html.haml +3 -3
- data/app/views/topics/show.html.haml +1 -1
- data/app/views/users/_profile_user_info_sidebar.html.haml +2 -2
- data/app/views/users/destroy.js.erb +3 -0
- data/app/views/users/new.html.haml +1 -1
- data/app/views/users/show.html.haml +1 -1
- data/app/views/users/signup_completed.html.haml +1 -1
- data/community_engine.gemspec +14 -11
- data/config/initializers/active_admin.rb +239 -0
- data/config/initializers/ckeditor.rb +8 -0
- data/config/initializers/ransack_bootstrap_fix.rb +25 -0
- data/config/locales/de-DE.yml +1 -0
- data/config/locales/en.yml +3 -0
- data/config/routes.rb +14 -19
- data/config/spring.rb +1 -0
- data/db/migrate/083_create_active_admin_comments.rb +19 -0
- data/lib/community_engine.rb +7 -3
- data/lib/community_engine/admin/ads.rb +3 -0
- data/lib/community_engine/admin/categories.rb +20 -0
- data/lib/community_engine/admin/comments.rb +4 -0
- data/lib/community_engine/admin/dashboard.rb +38 -0
- data/lib/community_engine/admin/events.rb +3 -0
- data/lib/community_engine/admin/forums.rb +3 -0
- data/lib/community_engine/admin/homepage_features.rb +25 -0
- data/lib/community_engine/admin/metro_areas.rb +4 -0
- data/lib/community_engine/admin/pages.rb +26 -0
- data/lib/community_engine/admin/posts.rb +92 -0
- data/lib/community_engine/admin/tags.rb +21 -0
- data/lib/community_engine/admin/users.rb +54 -0
- data/lib/community_engine/authenticated_system.rb +5 -20
- data/lib/community_engine/engine.rb +5 -0
- data/lib/community_engine/version.rb +1 -1
- data/lib/resource_feeder/atom.rb +2 -0
- data/lib/resource_feeder/rss.rb +2 -0
- data/lib/white_list.rb +6 -11
- data/test/fixtures/events.yml +10 -0
- data/test/fixtures/tags.yml +6 -5
- data/test/functional/activities_controller_test.rb +19 -19
- data/test/functional/admin/posts_controller_test.rb +16 -0
- data/test/functional/admin_controller_test.rb +82 -82
- data/test/functional/categories_controller_test.rb +0 -39
- data/test/functional/comments_controller_test.rb +14 -7
- data/test/functional/favorites_controller_test.rb +15 -16
- data/test/functional/pages_controller_test.rb +0 -71
- data/test/functional/posts_controller_test.rb +21 -2
- data/test/functional/sb_posts_controller_test.rb +3 -3
- data/test/functional/sessions_controller_test.rb +2 -2
- data/test/functional/tags_controller_test.rb +9 -20
- data/test/functional/users_controller_test.rb +0 -8
- data/test/functional/votes_controller_test.rb +1 -1
- data/test/testapp/config/spring.rb +1 -0
- data/test/testapp/db/schema.rb +16 -1
- data/test/unit/event_test.rb +1 -1
- metadata +204 -170
- data/CHANGELOG +0 -144
- data/app/controllers/admin_controller.rb +0 -80
- data/app/controllers/ads_controller.rb +0 -90
- data/app/controllers/homepage_features_controller.rb +0 -74
- data/app/controllers/metro_areas_controller.rb +0 -74
- data/app/controllers/statistics_controller.rb +0 -35
- data/app/views/admin/comments.html.haml +0 -53
- data/app/views/admin/events.html.haml +0 -26
- data/app/views/admin/messages.html.haml +0 -3
- data/app/views/admin/update.js.erb +0 -1
- data/app/views/admin/users.html.haml +0 -57
- data/app/views/ads/_form.html.haml +0 -21
- data/app/views/ads/edit.html.haml +0 -7
- data/app/views/ads/index.html.haml +0 -29
- data/app/views/ads/new.html.haml +0 -6
- data/app/views/ads/show.html.haml +0 -19
- data/app/views/categories/_form.html.haml +0 -8
- data/app/views/categories/edit.html.haml +0 -4
- data/app/views/categories/index.html.haml +0 -20
- data/app/views/categories/new.html.haml +0 -4
- data/app/views/homepage_features/_form.html.haml +0 -6
- data/app/views/homepage_features/edit.html.haml +0 -6
- data/app/views/homepage_features/index.html.haml +0 -24
- data/app/views/homepage_features/new.html.haml +0 -2
- data/app/views/homepage_features/show.html.haml +0 -27
- data/app/views/metro_areas/_form.html.haml +0 -6
- data/app/views/metro_areas/edit.html.haml +0 -8
- data/app/views/metro_areas/index.html.haml +0 -21
- data/app/views/metro_areas/new.html.haml +0 -6
- data/app/views/metro_areas/show.html.haml +0 -14
- data/app/views/pages/_form.html.haml +0 -18
- data/app/views/pages/edit.html.haml +0 -4
- data/app/views/pages/index.html.haml +0 -34
- data/app/views/pages/new.html.haml +0 -7
- data/app/views/shared/_admin_nav.html.haml +0 -17
- data/app/views/shared/_load_tinymce.js.erb +0 -15
- data/app/views/statistics/activities.xml.builder +0 -33
- data/app/views/statistics/index.html.haml +0 -48
- data/app/views/tags/edit.html.haml +0 -12
- data/app/views/tags/manage.html.haml +0 -30
- data/app/views/users/update.js.erb +0 -1
- data/test/functional/ads_controller_test.rb +0 -51
- data/test/functional/homepage_features_controller_test.rb +0 -69
- data/test/functional/metro_areas_controller_test.rb +0 -63
- data/test/functional/statistics_controller_test.rb +0 -18
- data/test/unit/acts_as_taggable_on/tag_test.rb +0 -22
- data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/README +0 -3
- data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/Rakefile +0 -22
- data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/generators/publishing/publishing_generator.rb +0 -34
- data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/generators/publishing/templates/migration.rb +0 -13
- data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/install.rb +0 -3
- data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/test/acts_as_publishable_test.rb +0 -8
- data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/uninstall.rb +0 -1
- data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/README +0 -4
- data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/Rakefile +0 -22
- data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/atom_feed_test.rb +0 -85
- data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/rss_feed_test.rb +0 -61
- data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/test_helper.rb +0 -60
- data/vendor/converted2.3plugins_to_lib_leftovers/white_list/README +0 -35
- data/vendor/converted2.3plugins_to_lib_leftovers/white_list/Rakefile +0 -22
- data/vendor/converted2.3plugins_to_lib_leftovers/white_list/test/white_list_test.rb +0 -120
@@ -1,18 +0,0 @@
|
|
1
|
-
- if @page.new_record?
|
2
|
-
- url = admin_pages_path
|
3
|
-
- else
|
4
|
-
- url = admin_page_path(@page)
|
5
|
-
|
6
|
-
= bootstrap_form_for @page, :url => url, :layout => :horizontal do |f|
|
7
|
-
= f.text_field :title
|
8
|
-
= f.text_area :body, :class => "rich_text_editor"
|
9
|
-
= f.form_group :public do
|
10
|
-
= f.check_box :page_public, :label => :make_page_public.l
|
11
|
-
.help-block
|
12
|
-
=:when_checked_this_page_will_be_visible_to_anyone.l
|
13
|
-
=:when_unchecked_this_page_will_only_be_visible_to_people_who_are_logged_in_to.l
|
14
|
-
=configatron.community_name
|
15
|
-
= f.select :published_as, [[:published.l, 'live'], [:draft.l, 'draft']], :label => :save_page_as.l
|
16
|
-
|
17
|
-
= f.form_group :submit_group do
|
18
|
-
= f.primary :save.l
|
@@ -1,34 +0,0 @@
|
|
1
|
-
-@page_title=:manage_pages.l
|
2
|
-
|
3
|
-
= render :partial => 'shared/admin_nav'
|
4
|
-
-widget do
|
5
|
-
%h3=:tips.l
|
6
|
-
%p=:page_tips.l
|
7
|
-
|
8
|
-
%p=:pages_saved_with_draft_status_wont_appear_on_the_site_until_you_publish_them.l
|
9
|
-
|
10
|
-
%table.table.table-bordered.table-striped
|
11
|
-
%tr
|
12
|
-
%th=:title.l
|
13
|
-
%th=:public.l
|
14
|
-
%th=:status.l
|
15
|
-
%th=:actions.l
|
16
|
-
- @pages.each do |page|
|
17
|
-
%tr
|
18
|
-
%td
|
19
|
-
= link_to page.title, edit_admin_page_path(page)
|
20
|
-
%td
|
21
|
-
-if page.is_public?
|
22
|
-
= t(:yes)
|
23
|
-
-else
|
24
|
-
= t(:no)
|
25
|
-
%td= page.is_live? ? link_to(:published.l, pages_path(page)) : :draft.l
|
26
|
-
%td
|
27
|
-
=link_to :show.l, pages_path(page), :class => 'btn btn-primary'
|
28
|
-
- unless page.is_live?
|
29
|
-
= link_to :preview.l, preview_admin_page_path(page), :class => 'btn btn-default'
|
30
|
-
=link_to :edit.l, edit_admin_page_path(page), :class => 'btn btn-warning'
|
31
|
-
=link_to :delete.l, pages_path(page), :method => 'delete', data: { confirm: :are_you_sure.l }, :class => 'btn btn-danger'
|
32
|
-
|
33
|
-
=paginate @pages, :theme => 'bootstrap'
|
34
|
-
=link_to :new_page.l, new_admin_page_path, :class => 'btn btn-success'
|
@@ -1,17 +0,0 @@
|
|
1
|
-
-widget do
|
2
|
-
%h3=:admin.l
|
3
|
-
%ul.list-unstyled
|
4
|
-
%li= link_to_unless_current :features.l, homepage_features_path
|
5
|
-
%li= link_to_unless_current :categories.l, categories_path
|
6
|
-
%li= link_to_unless_current :metro_areas.l, metro_areas_path
|
7
|
-
%li= link_to_unless_current :events.l, admin_events_path
|
8
|
-
%li= link_to_unless_current :statistics.l, statistics_path
|
9
|
-
%li= link_to_unless_current :ads.l, ads_path
|
10
|
-
%li= link_to_unless_current :comments.l, admin_comments_path
|
11
|
-
%li= link_to_unless_current :tags.l, admin_tags_path
|
12
|
-
%li= link_to_unless_current :admin_pages.l, admin_pages_path
|
13
|
-
%li= link_to_unless_current :users.l, admin_users_path
|
14
|
-
- if @admin_nav_links.any?
|
15
|
-
- @admin_nav_links.each do |link|
|
16
|
-
%li=link_to link[:name], link[:url]
|
17
|
-
%li= link_to :cache_clear_link.l, admin_clear_cache_path, data: { confirm: :are_you_sure.l }
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// Because the dom is loaded already we have to set up the tinymce config.
|
2
|
-
$(".rich_text_editor").each(function(){
|
3
|
-
var options = <%= @tiny_mce_configuration.to_json.html_safe %>;
|
4
|
-
$this = $(this);
|
5
|
-
|
6
|
-
// fix tinymce bug with html5 and required fields
|
7
|
-
if($this.is("[required]")){
|
8
|
-
options.oninit = function(editor){
|
9
|
-
$this.closest("form").find(":submit").on("click", function(){
|
10
|
-
editor.save();
|
11
|
-
});
|
12
|
-
}
|
13
|
-
}
|
14
|
-
$this.tinymce(options);
|
15
|
-
});
|
@@ -1,33 +0,0 @@
|
|
1
|
-
xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
2
|
-
xml.rsp 'status_code' => 0, 'status_message' => 'Success' do
|
3
|
-
xml.daily_counts 'type' => 'Logins' do
|
4
|
-
current = (Time.now.midnight) - 8.days
|
5
|
-
0.upto 7 do |i|
|
6
|
-
current += 1.day
|
7
|
-
xml.count @logins[current.to_date.iso8601].to_i, 'date' => current.to_s(:line_grapher)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
xml.daily_counts 'type' => 'Comments' do
|
11
|
-
current = (Time.now.midnight) - 8.days
|
12
|
-
0.upto 7 do |i|
|
13
|
-
current += 1.day
|
14
|
-
xml.count @comments[current.to_date.iso8601].to_i, 'date' => current.to_s(:line_grapher)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
xml.daily_counts 'type' => 'Posts' do
|
18
|
-
current = (Time.now.midnight) - 8.days
|
19
|
-
0.upto 7 do |i|
|
20
|
-
current += 1.day
|
21
|
-
xml.count @posts[current.to_date.iso8601].to_i, 'date' => current.to_s(:line_grapher)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
xml.daily_counts 'type' => 'Photos' do
|
25
|
-
current = (Time.now.midnight) - 8.days
|
26
|
-
0.upto 7 do |i|
|
27
|
-
current += 1.day
|
28
|
-
xml.count @photos[current.to_date.iso8601].to_i, 'date' => current.to_s(:line_grapher)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
= render :partial => 'shared/admin_nav'
|
2
|
-
-@page_title = :statistics.l
|
3
|
-
%dl.dl-horizontal
|
4
|
-
%dt= :total_users.l
|
5
|
-
%dd= @total_users
|
6
|
-
%dt= :unactivated_users.l
|
7
|
-
%dd= @unactivated_users
|
8
|
-
%dt= :new_today.l
|
9
|
-
%dd
|
10
|
-
= @today_new_users.size
|
11
|
-
%ul
|
12
|
-
- @today_new_users.each do |user|
|
13
|
-
%li= link_to user.login, user_path(user)
|
14
|
-
|
15
|
-
%dt= :new_yesterday.l
|
16
|
-
%dd
|
17
|
-
= @yesterday_new_users.size
|
18
|
-
%ul
|
19
|
-
- @yesterday_new_users.each do |user|
|
20
|
-
%li= link_to user.login, user_path(user)
|
21
|
-
|
22
|
-
%dt= :active.l
|
23
|
-
%dd
|
24
|
-
= pluralize @active_users_count, :user.l
|
25
|
-
(
|
26
|
-
= number_to_percentage((@active_users_count/@total_users.to_f)*100, :precision => 1)
|
27
|
-
=", 1 "+:month.l+")"
|
28
|
-
%dt= :most_active_1_month.l
|
29
|
-
%dd
|
30
|
-
='Users'
|
31
|
-
%ul
|
32
|
-
- @active_users.each do |user|
|
33
|
-
%li
|
34
|
-
= link_to user.login, user_path(user.id)
|
35
|
-
\(
|
36
|
-
= user.activities_count
|
37
|
-
\)
|
38
|
-
%dt='Reporting ZIP'
|
39
|
-
%dd= number_to_percentage @percent_reporting_zip, :precision => 1
|
40
|
-
%dt=:male.l
|
41
|
-
%dd= number_to_percentage @percent_male
|
42
|
-
%dt=:female.l
|
43
|
-
%dd= number_to_percentage @percent_female
|
44
|
-
%dt= :featured_writer.l
|
45
|
-
%dd
|
46
|
-
%ul
|
47
|
-
- @featured_writers.each do |w|
|
48
|
-
%li= link_to w.login, statistics_user_path(w)
|
@@ -1,12 +0,0 @@
|
|
1
|
-
-@page_title=:editing_tag.l
|
2
|
-
= render :partial => 'shared/admin_nav'
|
3
|
-
|
4
|
-
%p
|
5
|
-
=link_to :back.l, admin_tags_path, :class => 'btn btn-default'
|
6
|
-
=link_to :show.l, tag_path(@tag), :class => 'btn btn-primary'
|
7
|
-
=link_to :delete.l, tag_path(@tag), :method => 'delete', data: { confirm: :are_you_sure.l }, :class => 'btn btn-danger'
|
8
|
-
|
9
|
-
= bootstrap_form_for :tag, :url => tag_path(@tag), :layout => :horizontal, :html => {:method => 'put'} do |f|
|
10
|
-
= f.text_field :name
|
11
|
-
= f.form_group :submit_group do
|
12
|
-
= f.primary :update.l
|
@@ -1,30 +0,0 @@
|
|
1
|
-
-@page_title=:tags.l
|
2
|
-
= render :partial => 'shared/admin_nav'
|
3
|
-
|
4
|
-
-box do
|
5
|
-
%h3=:search.l
|
6
|
-
= bootstrap_form_for @search, :url => admin_tags_path, :layout => :horizontal do |f|
|
7
|
-
= f.text_field :name_start, :label => :name.l
|
8
|
-
|
9
|
-
= f.form_group :submit_group do
|
10
|
-
= f.primary :search.l
|
11
|
-
|
12
|
-
%table.table.table-bordered.table-striped
|
13
|
-
%tr
|
14
|
-
%th
|
15
|
-
=sort_link @search, :name, :name.l
|
16
|
-
%th
|
17
|
-
=sort_link @search, :taggings_count, :taggings.l
|
18
|
-
%th=:actions.l
|
19
|
-
|
20
|
-
- for tag in @tags
|
21
|
-
%tr
|
22
|
-
%td= tag.name
|
23
|
-
%td= tag.taggings.count
|
24
|
-
%td
|
25
|
-
= link_to :show.l, tag_path(tag), :class => 'btn btn-default'
|
26
|
-
= link_to :edit.l, edit_tag_path(tag), :class => 'btn btn-warning'
|
27
|
-
= link_to :destroy.l, tag_path(tag), data: { confirm: :are_you_sure.l }, :method => :delete, :class => 'btn btn-danger'
|
28
|
-
|
29
|
-
=paginate @tags, :theme => 'bootstrap'
|
30
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
What does this do?
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class AdsControllerTest < ActionController::TestCase
|
4
|
-
fixtures :ads, :users, :categories, :roles
|
5
|
-
|
6
|
-
def setup
|
7
|
-
login_as :admin
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_should_get_index
|
11
|
-
get :index
|
12
|
-
assert_response :success
|
13
|
-
assert assigns(:ads)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_should_get_new
|
17
|
-
get :new
|
18
|
-
assert_response :success
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_should_create_ad
|
22
|
-
assert_difference Ad, :count do
|
23
|
-
post :create, :ad => { :html => 'Our company is great!', :frequency => 1, :audience => 'all'}
|
24
|
-
end
|
25
|
-
|
26
|
-
assert_redirected_to ad_path(assigns(:ad))
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_should_show_ad
|
30
|
-
get :show, :id => ads(:hgtv).id
|
31
|
-
assert_response :success
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_should_get_edit
|
35
|
-
get :edit, :id => ads(:hgtv).id
|
36
|
-
assert_response :success
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_should_update_ad
|
40
|
-
patch :update, :id => ads(:hgtv).id, :ad => { }
|
41
|
-
assert_redirected_to ad_path(assigns(:ad))
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_should_destroy_ad
|
45
|
-
assert_difference Ad, :count, -1 do
|
46
|
-
delete :destroy, :id => ads(:hgtv).id
|
47
|
-
end
|
48
|
-
|
49
|
-
assert_redirected_to ads_path
|
50
|
-
end
|
51
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class HomepageFeaturesControllerTest < ActionController::TestCase
|
4
|
-
fixtures :all
|
5
|
-
|
6
|
-
def test_should_get_index
|
7
|
-
login_as :admin
|
8
|
-
get :index
|
9
|
-
assert_response :success
|
10
|
-
assert assigns(:homepage_features)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_should_get_new
|
14
|
-
login_as :admin
|
15
|
-
get :new
|
16
|
-
assert_response :success
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_should_create_homepage_feature
|
20
|
-
login_as :admin
|
21
|
-
assert_difference HomepageFeature, :count, 1 do
|
22
|
-
post :create, :homepage_feature => {:title => 'feature', :url => 'example.com', :image => fixture_file_upload('/files/library.jpg', 'image/jpg') }
|
23
|
-
end
|
24
|
-
assert_redirected_to homepage_feature_path(assigns(:homepage_feature))
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_should_fail_to_create_homepage_feature
|
28
|
-
login_as :admin
|
29
|
-
assert_no_difference HomepageFeature, :count do
|
30
|
-
post :create, :homepage_feature => { }
|
31
|
-
end
|
32
|
-
assert_response :success
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
def test_should_show_homepage_feature
|
37
|
-
login_as :admin
|
38
|
-
get :show, :id => homepage_features(:community_tour).id
|
39
|
-
assert_response :success
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_should_get_edit
|
43
|
-
login_as :admin
|
44
|
-
get :edit, :id => homepage_features(:community_tour).id
|
45
|
-
assert_response :success
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_should_update_homepage_feature
|
49
|
-
login_as :admin
|
50
|
-
patch :update, :id => homepage_features(:community_tour).id, :homepage_feature => {:url => 'changed_url.com' }
|
51
|
-
assert_redirected_to homepage_feature_path(assigns(:homepage_feature))
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_should_fail_to_update_homepage_feature
|
55
|
-
login_as :admin
|
56
|
-
patch :update, :id => homepage_features(:community_tour).id, :homepage_feature => { :url => nil }
|
57
|
-
assert assigns(:homepage_feature).errors[:url]
|
58
|
-
assert_response :success
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
def test_should_destroy_homepage_feature
|
63
|
-
login_as :admin
|
64
|
-
assert_difference HomepageFeature, :count, -1 do
|
65
|
-
delete :destroy, :id => homepage_features(:community_tour).id
|
66
|
-
end
|
67
|
-
assert_redirected_to homepage_features_path
|
68
|
-
end
|
69
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class MetroAreasControllerTest < ActionController::TestCase
|
4
|
-
fixtures :metro_areas, :users, :countries, :roles
|
5
|
-
|
6
|
-
def test_should_get_index
|
7
|
-
login_as :admin
|
8
|
-
get :index
|
9
|
-
assert_response :success
|
10
|
-
assert assigns(:metro_areas)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_should_get_new
|
14
|
-
login_as :admin
|
15
|
-
get :new
|
16
|
-
assert_response :success
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_should_create_metro_area
|
20
|
-
login_as :admin
|
21
|
-
assert_difference MetroArea, :count, 1 do
|
22
|
-
post :create, :metro_area => {:country_id => countries(:germany), :name => "Dusseldorf" }
|
23
|
-
end
|
24
|
-
|
25
|
-
assert_redirected_to metro_area_path(assigns(:metro_area))
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_should_not_create_metro_area_without_country
|
29
|
-
login_as :admin
|
30
|
-
assert_no_difference MetroArea, :count do
|
31
|
-
post :create, :metro_area => {:name => "Dusseldorf" }
|
32
|
-
assert assigns(:metro_area).errors[:country_id]
|
33
|
-
assert_response :success
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_should_show_metro_area
|
38
|
-
login_as :admin
|
39
|
-
get :show, :id => metro_areas(:twincities).id
|
40
|
-
assert_response :success
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_should_get_edit
|
44
|
-
login_as :admin
|
45
|
-
get :edit, :id => metro_areas(:twincities).id
|
46
|
-
assert_response :success
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_should_update_metro_area
|
50
|
-
login_as :admin
|
51
|
-
patch :update, :id => metro_areas(:twincities).id, :metro_area => { }
|
52
|
-
assert_redirected_to metro_area_path(assigns(:metro_area))
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_should_destroy_metro_area
|
56
|
-
login_as :admin
|
57
|
-
assert_difference MetroArea, :count, -1 do
|
58
|
-
delete :destroy, :id => metro_areas(:twincities).id
|
59
|
-
end
|
60
|
-
|
61
|
-
assert_redirected_to metro_areas_path
|
62
|
-
end
|
63
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class StatisticsControllerTest < ActionController::TestCase
|
4
|
-
fixtures :users, :roles
|
5
|
-
|
6
|
-
def test_should_get_index
|
7
|
-
login_as :admin
|
8
|
-
get :index
|
9
|
-
assert_response :success
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_should_not_get_index
|
13
|
-
login_as :quentin
|
14
|
-
get :index
|
15
|
-
assert_redirected_to login_url
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ActsAsTaggableOn::TagTest < ActiveSupport::TestCase
|
4
|
-
fixtures :all
|
5
|
-
|
6
|
-
test "should get popular tags" do
|
7
|
-
popular = ActsAsTaggableOn::Tag.popular
|
8
|
-
assert_equal popular.first['count'], 2
|
9
|
-
end
|
10
|
-
|
11
|
-
test "should get popular tags of one type" do
|
12
|
-
popular = ActsAsTaggableOn::Tag.popular(20, 'clipping')
|
13
|
-
assert_equal popular.to_a.size, 2
|
14
|
-
assert_equal popular.first['count'], 2
|
15
|
-
end
|
16
|
-
|
17
|
-
test "should get related tags" do
|
18
|
-
related = tags(:misc).related_tags
|
19
|
-
assert_equal(related, [tags(:related_to_misc)])
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|