refinerycms-whatson 1.8.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.
- data/.gitignore +48 -0
- data/.tork.rb +2 -0
- data/.travis.yml +2 -0
- data/Gemfile +7 -0
- data/Rakefile +3 -0
- data/app/controllers/admin/whatson/categories_controller.rb +11 -0
- data/app/controllers/admin/whatson/comments_controller.rb +40 -0
- data/app/controllers/admin/whatson/posts_controller.rb +97 -0
- data/app/controllers/admin/whatson/settings_controller.rb +53 -0
- data/app/controllers/whatson/categories_controller.rb +13 -0
- data/app/controllers/whatson/posts_controller.rb +109 -0
- data/app/controllers/whatson_controller.rb +16 -0
- data/app/helpers/whatson_posts_helper.rb +56 -0
- data/app/mailers/whatson/comment_mailer.rb +13 -0
- data/app/models/categorization.rb +7 -0
- data/app/models/whatson/comment_mailer.rb +1 -0
- data/app/models/whatson_category.rb +19 -0
- data/app/models/whatson_comment.rb +137 -0
- data/app/models/whatson_post.rb +114 -0
- data/app/views/admin/whatson/_submenu.html.erb +96 -0
- data/app/views/admin/whatson/categories/_category.html.erb +16 -0
- data/app/views/admin/whatson/categories/_form.html.erb +19 -0
- data/app/views/admin/whatson/categories/_sortable_list.html.erb +7 -0
- data/app/views/admin/whatson/categories/edit.html.erb +1 -0
- data/app/views/admin/whatson/categories/index.html.erb +26 -0
- data/app/views/admin/whatson/categories/new.html.erb +1 -0
- data/app/views/admin/whatson/comments/_comment.html.erb +20 -0
- data/app/views/admin/whatson/comments/_sortable_list.html.erb +7 -0
- data/app/views/admin/whatson/comments/index.html.erb +35 -0
- data/app/views/admin/whatson/comments/show.html.erb +63 -0
- data/app/views/admin/whatson/posts/_form.css.erb +20 -0
- data/app/views/admin/whatson/posts/_form.html.erb +110 -0
- data/app/views/admin/whatson/posts/_form.js.erb +23 -0
- data/app/views/admin/whatson/posts/_form_part.html.erb +3 -0
- data/app/views/admin/whatson/posts/_post.html.erb +24 -0
- data/app/views/admin/whatson/posts/_sortable_list.html.erb +7 -0
- data/app/views/admin/whatson/posts/_teaser_part.html.erb +11 -0
- data/app/views/admin/whatson/posts/edit.html.erb +1 -0
- data/app/views/admin/whatson/posts/index.html.erb +28 -0
- data/app/views/admin/whatson/posts/new.html.erb +1 -0
- data/app/views/admin/whatson/posts/uncategorized.html.erb +26 -0
- data/app/views/admin/whatson/settings/notification_recipients.html.erb +24 -0
- data/app/views/shared/admin/_autocomplete.html.erb +55 -0
- data/app/views/whatson/categories/show.html.erb +21 -0
- data/app/views/whatson/comment_mailer/notification.html.erb +17 -0
- data/app/views/whatson/posts/_comment.html.erb +10 -0
- data/app/views/whatson/posts/_nav.html.erb +11 -0
- data/app/views/whatson/posts/archive.html.erb +20 -0
- data/app/views/whatson/posts/index.html.erb +24 -0
- data/app/views/whatson/posts/index.rss.builder +17 -0
- data/app/views/whatson/posts/show.html.erb +98 -0
- data/app/views/whatson/posts/tagged.html.erb +22 -0
- data/app/views/whatson/shared/_archive_list.html.erb +9 -0
- data/app/views/whatson/shared/_categories.html.erb +10 -0
- data/app/views/whatson/shared/_post.html.erb +46 -0
- data/app/views/whatson/shared/_related_posts.html.erb +10 -0
- data/app/views/whatson/shared/_rss_feed.html.erb +2 -0
- data/app/views/whatson/shared/_tags.html.erb +8 -0
- data/config/locales/bg.yml +158 -0
- data/config/locales/cs.yml +128 -0
- data/config/locales/de.yml +130 -0
- data/config/locales/en.yml +159 -0
- data/config/locales/es.yml +159 -0
- data/config/locales/fr.yml +154 -0
- data/config/locales/it.yml +156 -0
- data/config/locales/ja.yml +159 -0
- data/config/locales/nb.yml +30 -0
- data/config/locales/nl.yml +134 -0
- data/config/locales/pl.yml +134 -0
- data/config/locales/pt-BR.yml +143 -0
- data/config/locales/ru.yml +135 -0
- data/config/locales/sk.yml +128 -0
- data/config/locales/zh-CN.yml +128 -0
- data/config/routes.rb +47 -0
- data/db/migrate/1_create_whatson_structure.rb +54 -0
- data/db/migrate/2_add_user_id_to_whatson_posts.rb +11 -0
- data/db/migrate/3_acts_as_taggable_on_migration.rb +28 -0
- data/db/migrate/4_create_seo_meta_for_whatson.rb +25 -0
- data/db/migrate/5_add_cached_slugs.rb +11 -0
- data/db/migrate/6_add_custom_url_field_to_whatson_posts.rb +9 -0
- data/db/migrate/7_add_custom_teaser_field_to_whatson_posts.rb +10 -0
- data/db/migrate/8_add_primary_key_to_categorizations.rb +12 -0
- data/db/seeds/refinerycms_whatson.rb +20 -0
- data/features/authors.feature +15 -0
- data/features/category.feature +23 -0
- data/features/support/factories/whatson_categories.rb +5 -0
- data/features/support/factories/whatson_comments.rb +8 -0
- data/features/support/factories/whatson_posts.rb +9 -0
- data/features/support/paths.rb +24 -0
- data/features/support/step_definitions/authors_steps.rb +7 -0
- data/features/support/step_definitions/category_steps.rb +11 -0
- data/features/support/step_definitions/tags_steps.rb +13 -0
- data/features/tags.feature +26 -0
- data/lib/gemspec.rb +37 -0
- data/lib/generators/refinerycms_whatson_generator.rb +8 -0
- data/lib/refinery/whatson/tabs.rb +28 -0
- data/lib/refinery/whatson/version.rb +17 -0
- data/lib/refinerycms-whatson.rb +41 -0
- data/public/images/refinerycms-whatson/icons/cog.png +0 -0
- data/public/images/refinerycms-whatson/icons/comment.png +0 -0
- data/public/images/refinerycms-whatson/icons/comment_cross.png +0 -0
- data/public/images/refinerycms-whatson/icons/comment_tick.png +0 -0
- data/public/images/refinerycms-whatson/icons/comments.png +0 -0
- data/public/images/refinerycms-whatson/icons/down.gif +0 -0
- data/public/images/refinerycms-whatson/icons/folder.png +0 -0
- data/public/images/refinerycms-whatson/icons/folder_add.png +0 -0
- data/public/images/refinerycms-whatson/icons/folder_edit.png +0 -0
- data/public/images/refinerycms-whatson/icons/page.png +0 -0
- data/public/images/refinerycms-whatson/icons/page_add.png +0 -0
- data/public/images/refinerycms-whatson/icons/page_copy.png +0 -0
- data/public/images/refinerycms-whatson/icons/up.gif +0 -0
- data/public/images/refinerycms-whatson/rss-feed.png +0 -0
- data/public/javascripts/refinery/refinerycms-whatson.js +50 -0
- data/public/javascripts/refinerycms-whatson.js +25 -0
- data/public/stylesheets/refinery/refinerycms-whatson.css +57 -0
- data/public/stylesheets/refinerycms-whatson.css +93 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css +330 -0
- data/readme.md +41 -0
- data/refinerycms-whatson.gemspec +18 -0
- data/spec/models/whatson_category_spec.rb +41 -0
- data/spec/models/whatson_comment_spec.rb +21 -0
- data/spec/models/whatson_post_spec.rb +217 -0
- metadata +235 -0
data/readme.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Refinery CMS Whatson
|
|
2
|
+
|
|
3
|
+
What's on engine for [Refinery CMS](http://refinerycms.com). It supports posts, categories and comments.
|
|
4
|
+
|
|
5
|
+
This version of `refinerycms-whatson` supports Rails 3.0.x. To use Rails 2.3.x use the [refinerycms-whatson "Rails 2.3.x stable branch"](http://github.com/resolve/refinerycms-whatson/tree/rails2-stable).
|
|
6
|
+
|
|
7
|
+
Options:
|
|
8
|
+
|
|
9
|
+
* Comment moderation
|
|
10
|
+
* [ShareThis.com](http://sharethis.com) support on posts. Set your key in Refinery's settings area to enable this.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
Refinery CMS version 1.0.0 or above.
|
|
15
|
+
Your Rails 3 application should not be called "whatson"
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
Open up your ``Gemfile`` and add at the bottom this line:
|
|
20
|
+
|
|
21
|
+
# You now have two options:
|
|
22
|
+
|
|
23
|
+
## Take the blue pill and stay on 1.7.x
|
|
24
|
+
|
|
25
|
+
gem 'refinerycms-whatson', '~> 1.7.0'
|
|
26
|
+
|
|
27
|
+
## Take the red pill and head up to 1.8.x
|
|
28
|
+
## Where the previous shared/_post.html.erb partial was moved directly into show.html.erb
|
|
29
|
+
## *MEANING:* If you depend on that partial, you'll have to check the changes and merge your customizations back in!
|
|
30
|
+
|
|
31
|
+
gem 'refinerycms-whatson', '~> 1.8.0'
|
|
32
|
+
|
|
33
|
+
Now, run ``bundle install``
|
|
34
|
+
|
|
35
|
+
Next, to install the whatson plugin run:
|
|
36
|
+
|
|
37
|
+
rails generate refinerycms_whatson
|
|
38
|
+
|
|
39
|
+
Finally migrate your database and you're done.
|
|
40
|
+
|
|
41
|
+
rake db:migrate
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = %q{refinerycms-whatson}
|
|
3
|
+
s.version = %q{1.8.0}
|
|
4
|
+
s.description = %q{Straightforward what\'s on engine for RefineryCMS.}
|
|
5
|
+
s.date = %q{2012-02-05}
|
|
6
|
+
s.summary = %q{Ruby on Rails what\'s on engine for RefineryCMS.}
|
|
7
|
+
s.email = %q{xjpablobrx@gmail.com}
|
|
8
|
+
s.homepage = %q{http://github.com/jpablobr/refinerycms-whatson}
|
|
9
|
+
s.authors = ['Jose Pablo Barrantes']
|
|
10
|
+
s.add_dependency 'refinerycms-core', '~> 1.0.3'
|
|
11
|
+
s.add_dependency 'filters_spam', '~> 0.2'
|
|
12
|
+
s.add_dependency 'acts-as-taggable-on'
|
|
13
|
+
s.add_dependency 'seo_meta', '~> 1.1.0'
|
|
14
|
+
s.add_development_dependency 'factory_girl'
|
|
15
|
+
s.files = `git ls-files`.split("\n")
|
|
16
|
+
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
|
17
|
+
s.require_path = 'lib'
|
|
18
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
|
|
3
|
+
|
|
4
|
+
describe WhatsonCategory do
|
|
5
|
+
before(:each) do
|
|
6
|
+
@whatson_category = Factory.create(:whatson_category)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe "validations" do
|
|
10
|
+
it "requires title" do
|
|
11
|
+
Factory.build(:whatson_category, :title => "").should_not be_valid
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "won't allow duplicate titles" do
|
|
15
|
+
Factory.build(:whatson_category, :title => @whatson_category.title).should_not be_valid
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe "whatson posts association" do
|
|
20
|
+
it "has a posts attribute" do
|
|
21
|
+
@whatson_category.should respond_to(:posts)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "returns posts by published_at date in descending order" do
|
|
25
|
+
first_post = @whatson_category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!", :body => "True story.", :published_at => Time.now.yesterday })
|
|
26
|
+
latest_post = @whatson_category.posts.create!({ :title => "parndt is p. okay", :body => "For a Kiwi.", :published_at => Time.now })
|
|
27
|
+
|
|
28
|
+
@whatson_category.posts.first.should == latest_post
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe "#post_count" do
|
|
34
|
+
it "returns post count in category" do
|
|
35
|
+
2.times do
|
|
36
|
+
@whatson_category.posts << Factory.create(:whatson_post)
|
|
37
|
+
end
|
|
38
|
+
@whatson_category.post_count.should == 2
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
|
|
3
|
+
|
|
4
|
+
describe WhatsonComment do
|
|
5
|
+
|
|
6
|
+
context "wiring up" do
|
|
7
|
+
|
|
8
|
+
before(:each) do
|
|
9
|
+
@comment = Factory.create(:whatson_comment)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "saves" do
|
|
13
|
+
@comment.should_not be_nil
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "has a whatson post" do
|
|
17
|
+
@comment.post.should_not be_nil
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
|
|
3
|
+
|
|
4
|
+
describe WhatsonPost do
|
|
5
|
+
let(:whatson_post ) { Factory.create(:whatson_post) }
|
|
6
|
+
|
|
7
|
+
describe "validations" do
|
|
8
|
+
it "requires title" do
|
|
9
|
+
Factory.build(:whatson_post, :title => "").should_not be_valid
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "won't allow duplicate titles" do
|
|
13
|
+
Factory.build(:whatson_post, :title => whatson_post.title).should_not be_valid
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "requires body" do
|
|
17
|
+
Factory.build(:whatson_post, :body => nil).should_not be_valid
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "comments association" do
|
|
22
|
+
|
|
23
|
+
it "have a comments attribute" do
|
|
24
|
+
whatson_post.should respond_to(:comments)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "destroys associated comments" do
|
|
28
|
+
Factory.create(:whatson_comment, :whatson_post_id => whatson_post.id)
|
|
29
|
+
whatson_post.destroy
|
|
30
|
+
WhatsonComment.find_by_whatson_post_id(whatson_post.id).should == nil
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "categories association" do
|
|
35
|
+
it "have categories attribute" do
|
|
36
|
+
whatson_post.should respond_to(:categories)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe "tags" do
|
|
41
|
+
it "acts as taggable" do
|
|
42
|
+
whatson_post.should respond_to(:tag_list)
|
|
43
|
+
|
|
44
|
+
#the factory has default tags, including 'chicago'
|
|
45
|
+
whatson_post.tag_list.should include("chicago")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe "authors" do
|
|
50
|
+
it "are authored" do
|
|
51
|
+
WhatsonPost.instance_methods.map(&:to_sym).should include(:author)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
describe "by_archive scope" do
|
|
56
|
+
before do
|
|
57
|
+
@whatson_post1 = Factory.create(:whatson_post, :published_at => Date.new(2011, 3, 11))
|
|
58
|
+
@whatson_post2 = Factory.create(:whatson_post, :published_at => Date.new(2011, 3, 12))
|
|
59
|
+
|
|
60
|
+
#2 months before
|
|
61
|
+
Factory.create(:whatson_post, :published_at => Date.new(2011, 1, 10))
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "returns all posts from specified month" do
|
|
65
|
+
#check for this month
|
|
66
|
+
date = "03/2011"
|
|
67
|
+
WhatsonPost.by_archive(Time.parse(date)).count.should be == 2
|
|
68
|
+
WhatsonPost.by_archive(Time.parse(date)).should == [@whatson_post2, @whatson_post1]
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
describe "all_previous scope" do
|
|
73
|
+
before do
|
|
74
|
+
@whatson_post1 = Factory.create(:whatson_post, :published_at => Time.now - 2.months)
|
|
75
|
+
@whatson_post2 = Factory.create(:whatson_post, :published_at => Time.now - 1.month)
|
|
76
|
+
Factory.create(:whatson_post, :published_at => Time.now)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it "returns all posts from previous months" do
|
|
80
|
+
WhatsonPost.all_previous.count.should be == 2
|
|
81
|
+
WhatsonPost.all_previous.should == [@whatson_post2, @whatson_post1]
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe "live scope" do
|
|
86
|
+
before do
|
|
87
|
+
@whatson_post1 = Factory.create(:whatson_post, :published_at => Time.now.advance(:minutes => -2))
|
|
88
|
+
@whatson_post2 = Factory.create(:whatson_post, :published_at => Time.now.advance(:minutes => -1))
|
|
89
|
+
Factory.create(:whatson_post, :draft => true)
|
|
90
|
+
Factory.create(:whatson_post, :published_at => Time.now + 1.minute)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "returns all posts which aren't in draft and pub date isn't in future" do
|
|
94
|
+
WhatsonPost.live.count.should be == 2
|
|
95
|
+
WhatsonPost.live.should == [@whatson_post2, @whatson_post1]
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
describe "uncategorized scope" do
|
|
100
|
+
before do
|
|
101
|
+
@uncategorized_whatson_post = Factory.create(:whatson_post)
|
|
102
|
+
@categorized_whatson_post = Factory.create(:whatson_post)
|
|
103
|
+
|
|
104
|
+
@categorized_whatson_post.categories << Factory.create(:whatson_category)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it "returns uncategorized posts if they exist" do
|
|
108
|
+
WhatsonPost.uncategorized.should include @uncategorized_whatson_post
|
|
109
|
+
WhatsonPost.uncategorized.should_not include @categorized_whatson_post
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
describe "#live?" do
|
|
114
|
+
it "returns true if post is not in draft and it's published" do
|
|
115
|
+
Factory.create(:whatson_post).live?.should be_true
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it "returns false if post is in draft" do
|
|
119
|
+
Factory.create(:whatson_post, :draft => true).live?.should be_false
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
it "returns false if post pub date is in future" do
|
|
123
|
+
Factory.create(:whatson_post, :published_at => Time.now.advance(:minutes => 1)).live?.should be_false
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
describe "#next" do
|
|
128
|
+
before do
|
|
129
|
+
Factory.create(:whatson_post, :published_at => Time.now.advance(:minutes => -1))
|
|
130
|
+
@whatson_post = Factory.create(:whatson_post)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
it "returns next article when called on current article" do
|
|
134
|
+
WhatsonPost.last.next.should == @whatson_post
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
describe "#prev" do
|
|
139
|
+
before do
|
|
140
|
+
Factory.create(:whatson_post)
|
|
141
|
+
@whatson_post = Factory.create(:whatson_post, :published_at => Time.now.advance(:minutes => -1))
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
it "returns previous article when called on current article" do
|
|
145
|
+
WhatsonPost.first.prev.should == @whatson_post
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
describe "#category_ids=" do
|
|
150
|
+
before do
|
|
151
|
+
@cat1 = Factory.create(:whatson_category, :id => 1)
|
|
152
|
+
@cat2 = Factory.create(:whatson_category, :id => 2)
|
|
153
|
+
@cat3 = Factory.create(:whatson_category, :id => 3)
|
|
154
|
+
whatson_post.category_ids = [1,2,"","",3]
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
it "rejects blank category ids" do
|
|
158
|
+
whatson_post.categories.count.should == 3
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
it "returns array of categories based on given ids" do
|
|
162
|
+
whatson_post.categories.should == [@cat1, @cat2, @cat3]
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
describe ".comments_allowed?" do
|
|
167
|
+
context "with RefinerySetting comments_allowed set to true" do
|
|
168
|
+
before do
|
|
169
|
+
RefinerySetting.set(:comments_allowed, { :scoping => 'whatson', :value => true })
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
it "should be true" do
|
|
173
|
+
WhatsonPost.comments_allowed?.should be_true
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
context "with RefinerySetting comments_allowed set to false" do
|
|
178
|
+
before do
|
|
179
|
+
RefinerySetting.set(:comments_allowed, { :scoping => 'whatson', :value => false })
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
it "should be false" do
|
|
183
|
+
WhatsonPost.comments_allowed?.should be_false
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
describe "custom teasers" do
|
|
189
|
+
it "should allow a custom teaser" do
|
|
190
|
+
Factory.create(:whatson_post, :custom_teaser => 'This is some custom content').should be_valid
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
describe ".teasers_enabled?" do
|
|
195
|
+
context "with RefinerySetting teasers_enabled set to true" do
|
|
196
|
+
before do
|
|
197
|
+
RefinerySetting.set(:teasers_enabled, { :scoping => 'whatson', :value => true })
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
it "should be true" do
|
|
201
|
+
WhatsonPost.teasers_enabled?.should be_true
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
context "with RefinerySetting teasers_enabled set to false" do
|
|
206
|
+
before do
|
|
207
|
+
RefinerySetting.set(:teasers_enabled, { :scoping => 'whatson', :value => false })
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
it "should be false" do
|
|
211
|
+
WhatsonPost.teasers_enabled?.should be_false
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: refinerycms-whatson
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.8.0
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Jose Pablo Barrantes
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-02-05 00:00:00.000000000Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: refinerycms-core
|
|
16
|
+
requirement: &83216050 !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ~>
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 1.0.3
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: *83216050
|
|
25
|
+
- !ruby/object:Gem::Dependency
|
|
26
|
+
name: filters_spam
|
|
27
|
+
requirement: &83215810 !ruby/object:Gem::Requirement
|
|
28
|
+
none: false
|
|
29
|
+
requirements:
|
|
30
|
+
- - ~>
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0.2'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: *83215810
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: acts-as-taggable-on
|
|
38
|
+
requirement: &83215620 !ruby/object:Gem::Requirement
|
|
39
|
+
none: false
|
|
40
|
+
requirements:
|
|
41
|
+
- - ! '>='
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '0'
|
|
44
|
+
type: :runtime
|
|
45
|
+
prerelease: false
|
|
46
|
+
version_requirements: *83215620
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: seo_meta
|
|
49
|
+
requirement: &83215350 !ruby/object:Gem::Requirement
|
|
50
|
+
none: false
|
|
51
|
+
requirements:
|
|
52
|
+
- - ~>
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 1.1.0
|
|
55
|
+
type: :runtime
|
|
56
|
+
prerelease: false
|
|
57
|
+
version_requirements: *83215350
|
|
58
|
+
- !ruby/object:Gem::Dependency
|
|
59
|
+
name: factory_girl
|
|
60
|
+
requirement: &83215140 !ruby/object:Gem::Requirement
|
|
61
|
+
none: false
|
|
62
|
+
requirements:
|
|
63
|
+
- - ! '>='
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '0'
|
|
66
|
+
type: :development
|
|
67
|
+
prerelease: false
|
|
68
|
+
version_requirements: *83215140
|
|
69
|
+
description: Straightforward what\'s on engine for RefineryCMS.
|
|
70
|
+
email: xjpablobrx@gmail.com
|
|
71
|
+
executables: []
|
|
72
|
+
extensions: []
|
|
73
|
+
extra_rdoc_files: []
|
|
74
|
+
files:
|
|
75
|
+
- .gitignore
|
|
76
|
+
- .tork.rb
|
|
77
|
+
- .travis.yml
|
|
78
|
+
- Gemfile
|
|
79
|
+
- Rakefile
|
|
80
|
+
- app/controllers/admin/whatson/categories_controller.rb
|
|
81
|
+
- app/controllers/admin/whatson/comments_controller.rb
|
|
82
|
+
- app/controllers/admin/whatson/posts_controller.rb
|
|
83
|
+
- app/controllers/admin/whatson/settings_controller.rb
|
|
84
|
+
- app/controllers/whatson/categories_controller.rb
|
|
85
|
+
- app/controllers/whatson/posts_controller.rb
|
|
86
|
+
- app/controllers/whatson_controller.rb
|
|
87
|
+
- app/helpers/whatson_posts_helper.rb
|
|
88
|
+
- app/mailers/whatson/comment_mailer.rb
|
|
89
|
+
- app/models/categorization.rb
|
|
90
|
+
- app/models/whatson/comment_mailer.rb
|
|
91
|
+
- app/models/whatson_category.rb
|
|
92
|
+
- app/models/whatson_comment.rb
|
|
93
|
+
- app/models/whatson_post.rb
|
|
94
|
+
- app/views/admin/whatson/_submenu.html.erb
|
|
95
|
+
- app/views/admin/whatson/categories/_category.html.erb
|
|
96
|
+
- app/views/admin/whatson/categories/_form.html.erb
|
|
97
|
+
- app/views/admin/whatson/categories/_sortable_list.html.erb
|
|
98
|
+
- app/views/admin/whatson/categories/edit.html.erb
|
|
99
|
+
- app/views/admin/whatson/categories/index.html.erb
|
|
100
|
+
- app/views/admin/whatson/categories/new.html.erb
|
|
101
|
+
- app/views/admin/whatson/comments/_comment.html.erb
|
|
102
|
+
- app/views/admin/whatson/comments/_sortable_list.html.erb
|
|
103
|
+
- app/views/admin/whatson/comments/index.html.erb
|
|
104
|
+
- app/views/admin/whatson/comments/show.html.erb
|
|
105
|
+
- app/views/admin/whatson/posts/_form.css.erb
|
|
106
|
+
- app/views/admin/whatson/posts/_form.html.erb
|
|
107
|
+
- app/views/admin/whatson/posts/_form.js.erb
|
|
108
|
+
- app/views/admin/whatson/posts/_form_part.html.erb
|
|
109
|
+
- app/views/admin/whatson/posts/_post.html.erb
|
|
110
|
+
- app/views/admin/whatson/posts/_sortable_list.html.erb
|
|
111
|
+
- app/views/admin/whatson/posts/_teaser_part.html.erb
|
|
112
|
+
- app/views/admin/whatson/posts/edit.html.erb
|
|
113
|
+
- app/views/admin/whatson/posts/index.html.erb
|
|
114
|
+
- app/views/admin/whatson/posts/new.html.erb
|
|
115
|
+
- app/views/admin/whatson/posts/uncategorized.html.erb
|
|
116
|
+
- app/views/admin/whatson/settings/notification_recipients.html.erb
|
|
117
|
+
- app/views/shared/admin/_autocomplete.html.erb
|
|
118
|
+
- app/views/whatson/categories/show.html.erb
|
|
119
|
+
- app/views/whatson/comment_mailer/notification.html.erb
|
|
120
|
+
- app/views/whatson/posts/_comment.html.erb
|
|
121
|
+
- app/views/whatson/posts/_nav.html.erb
|
|
122
|
+
- app/views/whatson/posts/archive.html.erb
|
|
123
|
+
- app/views/whatson/posts/index.html.erb
|
|
124
|
+
- app/views/whatson/posts/index.rss.builder
|
|
125
|
+
- app/views/whatson/posts/show.html.erb
|
|
126
|
+
- app/views/whatson/posts/tagged.html.erb
|
|
127
|
+
- app/views/whatson/shared/_archive_list.html.erb
|
|
128
|
+
- app/views/whatson/shared/_categories.html.erb
|
|
129
|
+
- app/views/whatson/shared/_post.html.erb
|
|
130
|
+
- app/views/whatson/shared/_related_posts.html.erb
|
|
131
|
+
- app/views/whatson/shared/_rss_feed.html.erb
|
|
132
|
+
- app/views/whatson/shared/_tags.html.erb
|
|
133
|
+
- config/locales/bg.yml
|
|
134
|
+
- config/locales/cs.yml
|
|
135
|
+
- config/locales/de.yml
|
|
136
|
+
- config/locales/en.yml
|
|
137
|
+
- config/locales/es.yml
|
|
138
|
+
- config/locales/fr.yml
|
|
139
|
+
- config/locales/it.yml
|
|
140
|
+
- config/locales/ja.yml
|
|
141
|
+
- config/locales/nb.yml
|
|
142
|
+
- config/locales/nl.yml
|
|
143
|
+
- config/locales/pl.yml
|
|
144
|
+
- config/locales/pt-BR.yml
|
|
145
|
+
- config/locales/ru.yml
|
|
146
|
+
- config/locales/sk.yml
|
|
147
|
+
- config/locales/zh-CN.yml
|
|
148
|
+
- config/routes.rb
|
|
149
|
+
- db/migrate/1_create_whatson_structure.rb
|
|
150
|
+
- db/migrate/2_add_user_id_to_whatson_posts.rb
|
|
151
|
+
- db/migrate/3_acts_as_taggable_on_migration.rb
|
|
152
|
+
- db/migrate/4_create_seo_meta_for_whatson.rb
|
|
153
|
+
- db/migrate/5_add_cached_slugs.rb
|
|
154
|
+
- db/migrate/6_add_custom_url_field_to_whatson_posts.rb
|
|
155
|
+
- db/migrate/7_add_custom_teaser_field_to_whatson_posts.rb
|
|
156
|
+
- db/migrate/8_add_primary_key_to_categorizations.rb
|
|
157
|
+
- db/seeds/refinerycms_whatson.rb
|
|
158
|
+
- features/authors.feature
|
|
159
|
+
- features/category.feature
|
|
160
|
+
- features/support/factories/whatson_categories.rb
|
|
161
|
+
- features/support/factories/whatson_comments.rb
|
|
162
|
+
- features/support/factories/whatson_posts.rb
|
|
163
|
+
- features/support/paths.rb
|
|
164
|
+
- features/support/step_definitions/authors_steps.rb
|
|
165
|
+
- features/support/step_definitions/category_steps.rb
|
|
166
|
+
- features/support/step_definitions/tags_steps.rb
|
|
167
|
+
- features/tags.feature
|
|
168
|
+
- lib/gemspec.rb
|
|
169
|
+
- lib/generators/refinerycms_whatson_generator.rb
|
|
170
|
+
- lib/refinery/whatson/tabs.rb
|
|
171
|
+
- lib/refinery/whatson/version.rb
|
|
172
|
+
- lib/refinerycms-whatson.rb
|
|
173
|
+
- public/images/refinerycms-whatson/icons/cog.png
|
|
174
|
+
- public/images/refinerycms-whatson/icons/comment.png
|
|
175
|
+
- public/images/refinerycms-whatson/icons/comment_cross.png
|
|
176
|
+
- public/images/refinerycms-whatson/icons/comment_tick.png
|
|
177
|
+
- public/images/refinerycms-whatson/icons/comments.png
|
|
178
|
+
- public/images/refinerycms-whatson/icons/down.gif
|
|
179
|
+
- public/images/refinerycms-whatson/icons/folder.png
|
|
180
|
+
- public/images/refinerycms-whatson/icons/folder_add.png
|
|
181
|
+
- public/images/refinerycms-whatson/icons/folder_edit.png
|
|
182
|
+
- public/images/refinerycms-whatson/icons/page.png
|
|
183
|
+
- public/images/refinerycms-whatson/icons/page_add.png
|
|
184
|
+
- public/images/refinerycms-whatson/icons/page_copy.png
|
|
185
|
+
- public/images/refinerycms-whatson/icons/up.gif
|
|
186
|
+
- public/images/refinerycms-whatson/rss-feed.png
|
|
187
|
+
- public/javascripts/refinery/refinerycms-whatson.js
|
|
188
|
+
- public/javascripts/refinerycms-whatson.js
|
|
189
|
+
- public/stylesheets/refinery/refinerycms-whatson.css
|
|
190
|
+
- public/stylesheets/refinerycms-whatson.css
|
|
191
|
+
- public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png
|
|
192
|
+
- public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png
|
|
193
|
+
- public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png
|
|
194
|
+
- public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png
|
|
195
|
+
- public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png
|
|
196
|
+
- public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png
|
|
197
|
+
- public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png
|
|
198
|
+
- public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
|
|
199
|
+
- public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
|
|
200
|
+
- public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png
|
|
201
|
+
- public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png
|
|
202
|
+
- public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png
|
|
203
|
+
- public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png
|
|
204
|
+
- public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png
|
|
205
|
+
- public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css
|
|
206
|
+
- readme.md
|
|
207
|
+
- refinerycms-whatson.gemspec
|
|
208
|
+
- spec/models/whatson_category_spec.rb
|
|
209
|
+
- spec/models/whatson_comment_spec.rb
|
|
210
|
+
- spec/models/whatson_post_spec.rb
|
|
211
|
+
homepage: http://github.com/jpablobr/refinerycms-whatson
|
|
212
|
+
licenses: []
|
|
213
|
+
post_install_message:
|
|
214
|
+
rdoc_options: []
|
|
215
|
+
require_paths:
|
|
216
|
+
- lib
|
|
217
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
218
|
+
none: false
|
|
219
|
+
requirements:
|
|
220
|
+
- - ! '>='
|
|
221
|
+
- !ruby/object:Gem::Version
|
|
222
|
+
version: '0'
|
|
223
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
|
+
none: false
|
|
225
|
+
requirements:
|
|
226
|
+
- - ! '>='
|
|
227
|
+
- !ruby/object:Gem::Version
|
|
228
|
+
version: '0'
|
|
229
|
+
requirements: []
|
|
230
|
+
rubyforge_project:
|
|
231
|
+
rubygems_version: 1.8.10
|
|
232
|
+
signing_key:
|
|
233
|
+
specification_version: 3
|
|
234
|
+
summary: Ruby on Rails what\'s on engine for RefineryCMS.
|
|
235
|
+
test_files: []
|