ecm_blog 0.0.1 → 0.1.1

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: 0fedf503cacfb14e451b8ab0265fd542add95e46
4
- data.tar.gz: 9009fa4b5106ec11776a7a21eaf3c6dc5cb41d9a
3
+ metadata.gz: '0368f6ac69e1091e9973f636ce90fa2f73b9bcb2'
4
+ data.tar.gz: f6af4fe970680805abbab77b6db19ed7b6e2817e
5
5
  SHA512:
6
- metadata.gz: 9cea6c72c865dcf04f4b68583f6d469519a572d8a8a8eb8fb20d16ae3440f012a555fe85185524a3f0408d98f8b3ae739036584a838b3d499ef931ab8a7718a0
7
- data.tar.gz: 413aaf7322fe7b9d2ba216de7c8c6612ff90e0a57a88431bd98a9560a2acd5dcc9039db90f9906764e80f00832cc185bd01421376d034ba448020c0f66e5fdd1
6
+ metadata.gz: 48cde31153845aa0503d801b22e802ce0c636b61c6184315e2418c6458cff322733a0ae5b4bdb4febe586db9088869d9d4da543f9ec6fe60dc78d0daa21349c8
7
+ data.tar.gz: 18c640b24e82eeeb45f9df0570834759794a07f441018f90d7d6950c4f8aa07b4fdc528395d5783a6aeda45600badaab2005f126b7585bbf8d179f87646cf45f
@@ -15,7 +15,7 @@ module Ecm
15
15
  private
16
16
 
17
17
  def collection_scope
18
- super.published.order(updated_at: :desc)
18
+ super.published.friendly.order(updated_at: :desc)
19
19
  end
20
20
 
21
21
  def load_collection
@@ -23,7 +23,7 @@ module Ecm
23
23
  end
24
24
 
25
25
  def load_scope
26
- super.published
26
+ super.published.friendly
27
27
  end
28
28
  end
29
29
  end
@@ -8,6 +8,10 @@ module Ecm::Blog
8
8
  include ActsAsPublished::ActiveRecord
9
9
  acts_as_published
10
10
 
11
+ # slugs
12
+ extend FriendlyId
13
+ friendly_id :title, use: :slugged
14
+
11
15
  belongs_to :creator, class_name: Ecm::Blog.creator_class_name, foreign_key: 'created_by_id'
12
16
  belongs_to :updater, class_name: Ecm::Blog.creator_class_name, foreign_key: 'updated_by_id', optional: true
13
17
 
@@ -16,7 +20,7 @@ module Ecm::Blog
16
20
  end
17
21
 
18
22
  module Markdown
19
- def body(format: :html)
23
+ def body(format: nil)
20
24
  case format
21
25
  when :html
22
26
  to_markdown(read_attribute(:body))
@@ -6,8 +6,11 @@ class CreateEcmBlogPosts < ActiveRecord::Migration[4.2]
6
6
  t.timestamp :published_at
7
7
  t.integer :created_by_id
8
8
  t.integer :updated_by_id
9
+ t.string :slug
9
10
 
10
11
  t.timestamps null: false
12
+
13
+ t.index :slug, unique: true
11
14
  end
12
15
  end
13
16
  end
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module Blog
3
- VERSION = '0.0.1'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
5
5
  end
data/lib/ecm_blog.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'acts_as_published'
2
+ require 'friendly_id'
2
3
  require 'kaminari'
3
4
  require 'kramdown'
4
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: friendly_id
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Ecm::Blog Module.
70
84
  email:
71
85
  - roberto@vasquez-angel.de