chive 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/chive/articles_controller.rb +1 -1
- data/app/helpers/chive/application_helper.rb +1 -1
- data/app/models/chive/article.rb +3 -1
- data/db/migrate/20170407101740_add_status_to_articles.rb +5 -0
- data/lib/chive/engine.rb +2 -0
- data/lib/chive/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4557cde95eb14bb3ccb3266b0b7d8433728bc553
|
4
|
+
data.tar.gz: f815d5f6bcdee6da18e226e844b9f6ee01c326f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af2939a8d283bddcec9479074d69dd4fcaef8e93c61683dd4ddd10c62da399dbe9263b2828d288f50039bf5b68a9be03be03e51654a2949da628e9639073cbc2
|
7
|
+
data.tar.gz: c0dc4312b313d63b1f01461b0d22353cf359806ab71f32ac9b031b2c07caf149cc04cbbb9778dea5d14e487c925458e1bc0d09a29cf7fa2e0b7147f21ef2d6a6
|
@@ -5,7 +5,7 @@ module Chive
|
|
5
5
|
|
6
6
|
def index
|
7
7
|
@articles = Article
|
8
|
-
.where('published_at <= ? AND (expired_at >= ? OR expired_at IS NULL)', DateTime.now, DateTime.now).order(published_at: :desc)
|
8
|
+
.where('published_at <= ? AND (expired_at >= ? OR expired_at IS NULL) AND status = ?', DateTime.now, DateTime.now, 'publish').order(published_at: :desc)
|
9
9
|
.paginate(page: params[:page], per_page: Chive.per_page)
|
10
10
|
end
|
11
11
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Chive
|
2
2
|
module ApplicationHelper
|
3
3
|
def article_list limit: 10, partial: 'chive/articles/list'
|
4
|
-
Article.where('published_at <= ? AND (expired_at >= ? OR expired_at IS NULL)', DateTime.now, DateTime.now).order(published_at: :desc).limit(limit)
|
4
|
+
Article.where('published_at <= ? AND (expired_at >= ? OR expired_at IS NULL) AND status = ?', DateTime.now, DateTime.now, 'publish').order(published_at: :desc).limit(limit)
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
data/app/models/chive/article.rb
CHANGED
@@ -3,9 +3,11 @@ module Chive
|
|
3
3
|
self.per_page = 10
|
4
4
|
belongs_to :author, class_name: 'User'
|
5
5
|
|
6
|
+
#enum status: [:draft, :publish]
|
7
|
+
|
6
8
|
after_initialize :set_default_autosummary, :if => :new_record?
|
7
9
|
before_save :set_published_at, :set_slug, :generate_summary
|
8
|
-
|
10
|
+
|
9
11
|
def to_param
|
10
12
|
slug
|
11
13
|
end
|
data/lib/chive/engine.rb
CHANGED
data/lib/chive/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 4.2.6
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: will_paginate
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ~>
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 3.1.0
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 3.1.0
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: sqlite3
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +89,7 @@ files:
|
|
75
89
|
- db/migrate/20161215020443_add_author_to_articles.rb
|
76
90
|
- db/migrate/20161215021624_change_byline_to_custom_byline_in_articles.rb
|
77
91
|
- db/migrate/20170211231410_articles_published_at_allows_nil.rb
|
92
|
+
- db/migrate/20170407101740_add_status_to_articles.rb
|
78
93
|
- lib/chive.rb
|
79
94
|
- lib/chive/engine.rb
|
80
95
|
- lib/chive/version.rb
|