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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0918ba231935ceebc2b86039f4991d4a20c57a8a
4
- data.tar.gz: eee8976be2c68928e7c33143d28e29dd45681608
3
+ metadata.gz: 4557cde95eb14bb3ccb3266b0b7d8433728bc553
4
+ data.tar.gz: f815d5f6bcdee6da18e226e844b9f6ee01c326f1
5
5
  SHA512:
6
- metadata.gz: 10fb9a3c735edfec931e90946617db0153efe1f2f2cfbda07dcf54cfa9bd08a4ba955aefe768f017cb62ffdc783e8ba817ad2a0971af1f41001edef50c5351d2
7
- data.tar.gz: ba69a4f6f7cb955ecf6e8f6b325ca1c725ab2c9a6759d52c54e69a5f69864d3207101c7c536d1e12e8db51b6dd9c1a2ac0cf66fdf8b9b8a80464860698675001
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
@@ -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
@@ -0,0 +1,5 @@
1
+ class AddStatusToArticles < ActiveRecord::Migration
2
+ def change
3
+ add_column :chive_articles, :status, :string, default: 'publish'
4
+ end
5
+ end
data/lib/chive/engine.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'will_paginate'
2
+
1
3
  module Chive
2
4
  class Engine < ::Rails::Engine
3
5
  isolate_namespace Chive
data/lib/chive/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chive
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-03-23 00:00:00.000000000 Z
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