rocket_cms_mongoid 0.5.12 → 0.5.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +4 -5
- data/lib/rocket_cms_mongoid/manual_slug.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80f4f9ac9e944f3e2b8ab561fdfcb7841e8972ba
|
4
|
+
data.tar.gz: ab02393dd1a959876beb4914014347eb256e6264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8b85fa119315387114e49d1a18ef630a65656484ce628c424d4e2f6aa0867b2f47468e5b4c44c236b23b22ccc840bcb5e4e3a12719aa7cb5f9f8e8fa85df44d
|
7
|
+
data.tar.gz: 39f73aec4e9cfb771baed2f0149ce1a117590378dd787ee147f66a4de7c59a6a3e004c23e689a78d84aad9da9d511e7e7b4272a6ab99214cb822a66402f31f08
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocket_cms_mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebtv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.5.
|
75
|
+
version: 0.5.14
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.5.
|
82
|
+
version: 0.5.14
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: glebtv-mongoid_nested_set
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,7 +144,6 @@ extensions: []
|
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
146
|
- lib/rocket_cms_mongoid.rb
|
147
|
-
- lib/rocket_cms_mongoid/manual_slug.rb
|
148
147
|
homepage: https://github.com/rs-pro/rocket_cms
|
149
148
|
licenses:
|
150
149
|
- MIT
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module ManualSlug
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
include Mongoid::Slug
|
4
|
-
|
5
|
-
def text_slug
|
6
|
-
self._slugs.empty? ? '' : self._slugs.last
|
7
|
-
end
|
8
|
-
def text_slug=(slug)
|
9
|
-
if slug.blank?
|
10
|
-
self._slugs = []
|
11
|
-
else
|
12
|
-
self._slugs.delete(slug)
|
13
|
-
self._slugs << slug
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
module ClassMethods
|
18
|
-
def manual_slug(field, options = {}, callback = true)
|
19
|
-
options.merge!(permanent: true, history: true)
|
20
|
-
slug field, options
|
21
|
-
|
22
|
-
# we will create slugs manually when needed
|
23
|
-
skip_callback :create, :before, :build_slug
|
24
|
-
|
25
|
-
before_validation do
|
26
|
-
self._slugs = self._slugs.map{ |s| s.strip }.select {|s| !s.blank? }
|
27
|
-
|
28
|
-
if self._slugs.empty?
|
29
|
-
self.build_slug
|
30
|
-
end
|
31
|
-
|
32
|
-
true
|
33
|
-
end if callback
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|