locomotivecms_mounter 1.0.0.alpha1 → 1.0.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
@@ -32,8 +32,17 @@ module Locomotive
|
|
32
32
|
# @return [ String ] The internal label
|
33
33
|
#
|
34
34
|
def _label
|
35
|
-
|
36
|
-
self.dynamic_getter(name)
|
35
|
+
field = self.content_type.label_field
|
36
|
+
value = self.dynamic_getter(field.name)
|
37
|
+
|
38
|
+
if field.type == :belongs_to
|
39
|
+
value.try(:_label)
|
40
|
+
else
|
41
|
+
value
|
42
|
+
end
|
43
|
+
|
44
|
+
# name = self.content_type.label_field_name
|
45
|
+
# self.dynamic_getter(name)
|
37
46
|
end
|
38
47
|
|
39
48
|
# Process a minimal validation by checking if the required fields
|
@@ -211,8 +220,12 @@ module Locomotive
|
|
211
220
|
def set_slug
|
212
221
|
self.translated_in.each do |locale|
|
213
222
|
Locomotive::Mounter.with_locale(locale) do
|
214
|
-
|
223
|
+
# first attempt from the label
|
224
|
+
if self._slug.blank?
|
225
|
+
self._slug = self._label.try(:dup)
|
226
|
+
end
|
215
227
|
|
228
|
+
# from the content type itself
|
216
229
|
if self._slug.blank?
|
217
230
|
self._slug = self.content_type.send(:label_to_slug)
|
218
231
|
end
|
@@ -14,7 +14,7 @@ module Locomotive
|
|
14
14
|
|
15
15
|
{}.tap do |translations|
|
16
16
|
if File.exists?(config_path)
|
17
|
-
self.read_yaml(config_path).each do |translation|
|
17
|
+
(self.read_yaml(config_path) || []).each do |translation|
|
18
18
|
key, values = translation
|
19
19
|
|
20
20
|
entry = Locomotive::Mounter::Models::Translation.new({
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locomotivecms_mounter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.alpha2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tilt
|
@@ -471,7 +471,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
471
471
|
version: '0'
|
472
472
|
segments:
|
473
473
|
- 0
|
474
|
-
hash: -
|
474
|
+
hash: -91950627589408174
|
475
475
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
476
476
|
none: false
|
477
477
|
requirements:
|