active_permalink 0.5.1 → 0.5.4
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2370858cf54caeaed15d46be78c213318d9c694dd8de649f7d6d89831a4b280
|
4
|
+
data.tar.gz: b65706ee68b73614c6e339615dadb144ee191750abcfe64bd02d1fc4d58a9fbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ab38b002cb0e25c9ec6b5687a9afba16506648a8b241dc040af5e9fb334450c5b1e7d673a2a6dff0f61d9459b4a318bca7ed765b3a7af15769ad484ba7f9a3a
|
7
|
+
data.tar.gz: 33ec5ef0cea62186ea15122f5c40af26d8814e021f0bd5910db02acab6cad1c1d32fd40d71ebc27072251b9e9989593c85fb76775c1544fa1d6aaf25648f60dc
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require '
|
1
|
+
require 'any_ascii'
|
2
2
|
|
3
3
|
module ActivePermalink
|
4
4
|
class Generator
|
5
5
|
class << self
|
6
|
-
def generate(record, value, locale = nil)
|
6
|
+
def generate(record, value, locale = nil, raw: false)
|
7
7
|
return if value.nil? && !record.slug_should_generate?
|
8
8
|
|
9
|
-
options = record.permalink_options.merge(locale: locale)
|
9
|
+
options = record.permalink_options.merge(locale: locale, raw: raw)
|
10
10
|
generator = Generator.new(record, options)
|
11
11
|
generator.generate(value)
|
12
12
|
|
@@ -91,7 +91,12 @@ module ActivePermalink
|
|
91
91
|
def slug_from_column
|
92
92
|
@slug_from_column ||= begin
|
93
93
|
value = @new_value.presence || @record.send(@field)
|
94
|
-
value.
|
94
|
+
return if value.blank?
|
95
|
+
|
96
|
+
return value if @options[:raw] == true
|
97
|
+
|
98
|
+
value = AnyAscii.transliterate(value)
|
99
|
+
value.parameterize
|
95
100
|
end
|
96
101
|
end
|
97
102
|
|
@@ -29,8 +29,8 @@ module ActivePermalink
|
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
-
def _generate_permalink_slug(value)
|
33
|
-
slug_backend.write(value, I18n.locale)
|
32
|
+
def _generate_permalink_slug(value, **options)
|
33
|
+
slug_backend.write(value, I18n.locale, **options)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -60,9 +60,9 @@ module ActivePermalink
|
|
60
60
|
find_slug(locale)
|
61
61
|
end
|
62
62
|
|
63
|
-
def write(value, locale)
|
63
|
+
def write(value, locale, **options)
|
64
64
|
enforce_available_locales!(locale)
|
65
|
-
update_slug(value, locale)
|
65
|
+
update_slug(value, locale, **options)
|
66
66
|
end
|
67
67
|
|
68
68
|
private
|
@@ -97,8 +97,8 @@ module ActivePermalink
|
|
97
97
|
permalink.try(:slug)
|
98
98
|
end
|
99
99
|
|
100
|
-
def update_slug(value, locale)
|
101
|
-
Generator.generate(record, value, locale)
|
100
|
+
def update_slug(value, locale, **options)
|
101
|
+
Generator.generate(record, value, locale, **options)
|
102
102
|
@permalinks = record.permalinks.to_a
|
103
103
|
end
|
104
104
|
end
|
@@ -12,6 +12,10 @@ module ActivePermalink
|
|
12
12
|
on: [:create, :update],
|
13
13
|
if: :slug_needs_generate?
|
14
14
|
|
15
|
+
def raw_slug=(value)
|
16
|
+
_generate_permalink_slug(value, raw: true)
|
17
|
+
end
|
18
|
+
|
15
19
|
def slug=(value)
|
16
20
|
_generate_permalink_slug(value)
|
17
21
|
end
|
@@ -37,8 +41,8 @@ module ActivePermalink
|
|
37
41
|
@slug_should_generate = false
|
38
42
|
end
|
39
43
|
|
40
|
-
def _generate_permalink_slug(value)
|
41
|
-
Generator.generate(self, value)
|
44
|
+
def _generate_permalink_slug(value, **options)
|
45
|
+
Generator.generate(self, value, **options)
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_permalink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonian Guveli
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,35 +29,35 @@ dependencies:
|
|
29
29
|
version: '5.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: active_delegate
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '1.0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: any_ascii
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '0.1'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '0.1'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: bundler
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,7 +127,7 @@ homepage: https://github.com/hardpixel/active-permalink
|
|
127
127
|
licenses:
|
128
128
|
- MIT
|
129
129
|
metadata: {}
|
130
|
-
post_install_message:
|
130
|
+
post_install_message:
|
131
131
|
rdoc_options: []
|
132
132
|
require_paths:
|
133
133
|
- lib
|
@@ -142,8 +142,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
|
-
rubygems_version: 3.1.
|
146
|
-
signing_key:
|
145
|
+
rubygems_version: 3.1.6
|
146
|
+
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: Add permalinks to ActiveRecord models
|
149
149
|
test_files: []
|