localizable_value 0.1.25 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aebc35914090f8f056f4d7ba6ed188fd463ca41a
|
4
|
+
data.tar.gz: 86806d352f3f9ffadb33df0bf5915dfc681f9a8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b6a67dc5b9378a17e058753c75c52e36418efc359aad1e6ba83572c16386496e136889aa73f0769fe9b031faa0ab5916e2d5aba3f6718fe48d647343f65a417
|
7
|
+
data.tar.gz: d363d6447816ba3e5cfae7144a67130ac90fdb20f73adf7e9c891005705f006cd2db733afd5118123f97bc80b03e6feb41f1ecf8e9d5f0475383a058f3e63e14
|
@@ -24,79 +24,4 @@ module LocalizableValueHelper
|
|
24
24
|
def localized_value_link_attr(page, key, default_value, attrs)
|
25
25
|
render partial: 'localizable_value/link_attr', :locals => { localized_page: page, key: key, default_value: default_value, attrs: attrs }
|
26
26
|
end
|
27
|
-
|
28
|
-
def content_tag(*args)
|
29
|
-
if block_given?
|
30
|
-
tag = Tag.new(args[0], args[1] || {})
|
31
|
-
old_buf = @output_buffer
|
32
|
-
@output_buffer = ActionView::OutputBuffer.new
|
33
|
-
value = yield(tag)
|
34
|
-
content = tag.render(@output_buffer.presence || value)
|
35
|
-
@output_buffer = old_buf
|
36
|
-
content
|
37
|
-
else
|
38
|
-
super
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class Tag
|
43
|
-
include ActionView::Helpers::CaptureHelper
|
44
|
-
attr_accessor :id
|
45
|
-
attr_reader :name, :css
|
46
|
-
|
47
|
-
def initialize(name, attributes = {})
|
48
|
-
@name = name
|
49
|
-
@attributes = attributes.with_indifferent_access
|
50
|
-
@attributes[:class] = Tag::CSS.new(attributes[:class])
|
51
|
-
end
|
52
|
-
|
53
|
-
def []=(k,v)
|
54
|
-
@attributes[k] = v
|
55
|
-
end
|
56
|
-
|
57
|
-
def [](k)
|
58
|
-
@attributes[k]
|
59
|
-
end
|
60
|
-
|
61
|
-
def render(content)
|
62
|
-
"<#{name}#{render_attributes}>#{content.strip}</#{name}>".html_safe
|
63
|
-
end
|
64
|
-
|
65
|
-
def render_attributes
|
66
|
-
attrs = @attributes.dup
|
67
|
-
if self[:class].empty?
|
68
|
-
attrs.delete :class
|
69
|
-
else
|
70
|
-
attrs[:class] = self[:class].to_s
|
71
|
-
end
|
72
|
-
|
73
|
-
attrs.keys.map do |k|
|
74
|
-
"#{k}='#{ERB::Util.html_escape(attrs[k])}'".html_safe
|
75
|
-
end.join(' ').prepend(' ')
|
76
|
-
end
|
77
|
-
|
78
|
-
class CSS
|
79
|
-
|
80
|
-
def initialize(css)
|
81
|
-
if css.is_a? String
|
82
|
-
@internals = css.split(' ')
|
83
|
-
else
|
84
|
-
@internals = css.to_a
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def to_s
|
89
|
-
@internals.uniq.join(' ')
|
90
|
-
end
|
91
|
-
|
92
|
-
def empty?
|
93
|
-
@internals.empty?
|
94
|
-
end
|
95
|
-
|
96
|
-
def <<(name)
|
97
|
-
@internals << name
|
98
|
-
nil
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
27
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
- local_assigns[:localized_object] = localized_page.get_value(key, default_value) if !local_assigns[:localized_object]
|
2
2
|
- local_assigns[:property] = :value if !local_assigns[:property]
|
3
3
|
|
4
|
-
= element_editor(localized_object, property, local_assigns[:place_holder], local_assigns[:label]) do |args|
|
4
|
+
= element_editor(local_assigns[:localized_object], local_assigns[:property], local_assigns[:place_holder], local_assigns[:label]) do |args|
|
5
5
|
= yield args
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: localizable_value
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrique Rangel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|