editorial_logic 1.3.2 → 1.3.3
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/VERSION +1 -1
- data/app/models/publication.rb +15 -21
- data/editorial_logic.gemspec +2 -2
- data/spec/models/publication_spec.rb +2 -8
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.3
|
data/app/models/publication.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
class Publication
|
2
|
-
|
3
2
|
include EditorialLogic::Base
|
4
3
|
|
5
4
|
# Mongo Config ===================================================================================
|
6
|
-
|
7
5
|
include Mongoid::Document
|
8
6
|
include Mongoid::Timestamps
|
9
7
|
|
@@ -29,15 +27,9 @@ class Publication
|
|
29
27
|
scope :with_faqs, :where => {:content_type => 'FAQs'}
|
30
28
|
scope :with_terms, :where => {:content_type => 'Terms and Definitions'}
|
31
29
|
|
32
|
-
# Relationships ==================================================================================
|
33
|
-
|
34
30
|
# Behavior =======================================================================================
|
35
31
|
attr_accessor :desired_slug
|
36
32
|
has_slug :desired_slug
|
37
|
-
|
38
|
-
# Callbacks ======================================================================================
|
39
|
-
|
40
|
-
# Validations ====================================================================================
|
41
33
|
validates_presence_of :name
|
42
34
|
validates_uniqueness_of :name
|
43
35
|
validates_uniqueness_of :slug
|
@@ -51,12 +43,11 @@ class Publication
|
|
51
43
|
end
|
52
44
|
|
53
45
|
# Instance methods ===============================================================================
|
54
|
-
|
55
46
|
def content_label
|
56
|
-
label =
|
57
|
-
label =
|
58
|
-
label =
|
59
|
-
label =
|
47
|
+
label = 'Content'
|
48
|
+
label = 'Answer' if self.has_faqs?
|
49
|
+
label = 'Definition' if self.has_terms?
|
50
|
+
label = 'Document' if self.has_documents?
|
60
51
|
label
|
61
52
|
end
|
62
53
|
|
@@ -77,19 +68,22 @@ class Publication
|
|
77
68
|
end
|
78
69
|
|
79
70
|
def headline_label
|
80
|
-
label =
|
81
|
-
label =
|
82
|
-
label =
|
83
|
-
label =
|
71
|
+
label = 'Headline'
|
72
|
+
label = 'Question' if self.has_faqs?
|
73
|
+
label = 'Term' if self.has_terms?
|
74
|
+
label = 'Title' if self.has_documents?
|
84
75
|
label
|
85
76
|
end
|
86
77
|
|
87
78
|
def humanize_path
|
88
|
-
|
79
|
+
self.path
|
89
80
|
end
|
90
81
|
|
91
|
-
def
|
92
|
-
"
|
82
|
+
def path
|
83
|
+
"/#{self.slug}".gsub '//', '/'
|
93
84
|
end
|
94
85
|
|
95
|
-
|
86
|
+
def rss_feed_url
|
87
|
+
"#{self.humanize_path}/feed"
|
88
|
+
end
|
89
|
+
end
|
data/editorial_logic.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "editorial_logic"
|
8
|
-
s.version = "1.3.
|
8
|
+
s.version = "1.3.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bantik"]
|
12
|
-
s.date = "2011-09-
|
12
|
+
s.date = "2011-09-28"
|
13
13
|
s.description = "An engine for enabling managed content, including articles, blogs, FAQs and glossaries."
|
14
14
|
s.email = "corey@seologic.com"
|
15
15
|
s.files = [
|
@@ -1,9 +1,7 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
3
|
describe Publication do
|
4
|
-
|
5
4
|
describe 'content types' do
|
6
|
-
|
7
5
|
it 'detects articles' do
|
8
6
|
Publication.new(:content_type => 'Articles').has_articles?.should be_true
|
9
7
|
end
|
@@ -51,18 +49,16 @@ describe Publication do
|
|
51
49
|
it 'returns a label for content appropriate for terms' do
|
52
50
|
Publication.new(:content_type => 'Terms and Definitions').content_label.should == 'Definition'
|
53
51
|
end
|
54
|
-
|
55
52
|
end
|
56
53
|
|
57
54
|
describe 'slug' do
|
58
|
-
|
59
55
|
it 'returns an SEO-friendly URL' do
|
60
56
|
publication = Publication.new(
|
61
57
|
:name => 'FAQs',
|
62
58
|
:desired_slug => 'somewhat-dense'
|
63
59
|
)
|
64
60
|
publication.make_slug
|
65
|
-
publication.humanize_path.should == '/somewhat-dense
|
61
|
+
publication.humanize_path.should == '/somewhat-dense'
|
66
62
|
end
|
67
63
|
|
68
64
|
it 'is generated based on the desired_slug' do
|
@@ -87,11 +83,9 @@ describe Publication do
|
|
87
83
|
publication = Publication.new(:name => 'Blues Brothers?')
|
88
84
|
publication.make_slug.should == 'blues-brothers'
|
89
85
|
end
|
90
|
-
|
91
86
|
end
|
92
87
|
|
93
88
|
it 'returns its feed URL' do
|
94
89
|
Publication.create(:name => 'Blues News', :desired_slug => 'blues-news').rss_feed_url.should == '/blues-news/feed'
|
95
90
|
end
|
96
|
-
|
97
|
-
end
|
91
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: editorial_logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 3
|
10
|
+
version: 1.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bantik
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-28 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: bson_ext
|