yodel_blog 0.0.1 → 0.0.2
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.
@@ -4,7 +4,7 @@ class ArticleModelMigration < Migration
|
|
4
4
|
add_field :published, :time
|
5
5
|
add_field :tags, :tags
|
6
6
|
add_field :blog, :alias, of: :parent
|
7
|
-
add_field :search_title, :function, fn: 'format("News: {{title}}")'
|
7
|
+
add_field :search_title, :function, fn: 'format("News: {{title}}")', display: false
|
8
8
|
add_one :author, model: :user
|
9
9
|
articles.allowed_parents = [site.blogs]
|
10
10
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class BlogAddAttachmentsToArticleMigration < Migration
|
2
|
+
def self.up(site)
|
3
|
+
site.articles.modify do |articles|
|
4
|
+
add_field :attachment, :attachment
|
5
|
+
remove_field :blog
|
6
|
+
end
|
7
|
+
|
8
|
+
site.blogs.modify do |articles|
|
9
|
+
remove_field :blog
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down(site)
|
14
|
+
site.pages.create_model :articles do |articles|
|
15
|
+
add_field :blog, :alias, of: :parent
|
16
|
+
remove_field :attachment
|
17
|
+
end
|
18
|
+
|
19
|
+
site.blogs.create_model :articles do |articles|
|
20
|
+
add_field :blog, :alias, of: :parent
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/models/blog.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class Blog < Page
|
2
|
+
attr_reader :number_of_pages, :page_params, :tag, :total_articles, :month, :year
|
3
|
+
|
2
4
|
respond_to :get do
|
3
5
|
with :atom do |xml|
|
4
6
|
@xml = xml
|
@@ -33,6 +35,10 @@ class Blog < Page
|
|
33
35
|
query.limit(articles_per_page).skip(page_number * articles_per_page).all
|
34
36
|
end
|
35
37
|
|
38
|
+
def latest_articles(limit = 3)
|
39
|
+
site.articles.where(parent: id).order('published desc').limit(limit).all
|
40
|
+
end
|
41
|
+
|
36
42
|
def first_page?
|
37
43
|
page_number == 0
|
38
44
|
end
|
data/lib/yodel_blog.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yodel_blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-12 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Yodel CMS Blog Extension
|
15
15
|
email:
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- lib/migrations/01_blog_model.rb
|
26
26
|
- lib/migrations/02_article_model.rb
|
27
27
|
- lib/migrations/03_update_blog_fields_for_admin.rb
|
28
|
+
- lib/migrations/04_add_attachment_to_article.rb
|
28
29
|
- lib/models/blog.rb
|
29
30
|
- lib/yodel_blog.rb
|
30
31
|
- yodel_blog.gemspec
|