motion-prime 0.1.5 → 0.1.6
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 +8 -8
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/motion-prime/elements/base.rb +4 -11
- data/motion-prime/helpers/has_normalizer.rb +14 -0
- data/motion-prime/models/base.rb +1 -0
- data/motion-prime/sections/base.rb +4 -1
- data/motion-prime/version.rb +1 -1
- data/motion-prime/views/styles.rb +3 -6
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yzc2NmYzMWIzZTRkOTA3ODFjZjc0NTdkYWM0ZmVjMTQ0OTU1OGM4Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWUzZWRiOTRjMmQyOTcyYzQzMjFhZWY4YzM0MDY0MzYwZDkzZThlOA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDNhMTg1MmYxYjhkMTE3MTAzMjAyY2M0NjAzODE4Mjc0ZjZmOTIxMzNkNmQ3
|
10
|
+
Y2Q2MTlmNmYzMGI5YWE5YjExZmUwNWE3N2FkNWY2YzNmMmI5ZDU4OTliZDI2
|
11
|
+
MzUxMzg5NGVmMWVkMjk0MDQxYjlmZWY2OGYzYzUzNGJjMjcyNTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmI1OTU0YTVjYjE1NDY3MzJkMGMwZmJkOGVlZGVlOGJlZTllNjA1ODVjMzg1
|
14
|
+
YWUxMDlhOGE1N2Q2YTY1ODVlNjhiYjVmOGUwN2JmYjYxYjJmZjg2MWU1ZTBi
|
15
|
+
NTMwM2YwYTFkOGRmNmU1NjJhNDc5NjNiYzZmODk3ZTYzYzE2OTA=
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
motion_require '../helpers/has_normalizer'
|
1
2
|
module MotionPrime
|
2
3
|
class BaseElement
|
3
4
|
# MotionPrime::BaseElement is container for UIView class elements with options.
|
4
5
|
# Elements are located inside Sections
|
5
6
|
|
6
7
|
include ::MotionSupport::Callbacks
|
8
|
+
include HasNormalizer
|
9
|
+
|
7
10
|
attr_accessor :options, :section, :name,
|
8
11
|
:view_class, :view, :styles, :screen
|
9
12
|
|
@@ -39,7 +42,7 @@ module MotionPrime
|
|
39
42
|
@computed_options = options
|
40
43
|
compute_block_options
|
41
44
|
compute_style_options
|
42
|
-
@computed_options = normalize_options(@computed_options)
|
45
|
+
@computed_options = normalize_options(@computed_options, section)
|
43
46
|
end
|
44
47
|
|
45
48
|
# Compute options sent inside block, e.g.
|
@@ -63,16 +66,6 @@ module MotionPrime
|
|
63
66
|
Styles.for(styles)
|
64
67
|
end
|
65
68
|
|
66
|
-
def normalize_options(options)
|
67
|
-
options.each do |key, option|
|
68
|
-
options[key] = if option.is_a?(Proc) && key != :block
|
69
|
-
section.send :instance_eval, &option
|
70
|
-
else
|
71
|
-
option
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
69
|
class << self
|
77
70
|
def factory(type, options = {})
|
78
71
|
class_name = "#{type.classify}Element"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module MotionPrime
|
2
|
+
module HasNormalizer
|
3
|
+
def normalize_options(options, receiver = nil)
|
4
|
+
receiver ||= self
|
5
|
+
options.each do |key, option|
|
6
|
+
options[key] = if option.is_a?(Proc)
|
7
|
+
receiver.send :instance_eval, &option
|
8
|
+
else
|
9
|
+
option
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/motion-prime/models/base.rb
CHANGED
@@ -157,6 +157,7 @@ module MotionPrime
|
|
157
157
|
return attributes if self.class.updatable_attributes.blank?
|
158
158
|
self.class.updatable_attributes.to_a.inject({}) do |hash, attribute|
|
159
159
|
key, options = *attribute
|
160
|
+
return hash if options[:if] && !send(options[:if])
|
160
161
|
if block = options[:block]
|
161
162
|
value = instance_eval(&block)
|
162
163
|
else
|
@@ -14,6 +14,7 @@ module MotionPrime
|
|
14
14
|
DEFAULT_CONTENT_HEIGHT = 65
|
15
15
|
include ::MotionSupport::Callbacks
|
16
16
|
include MotionPrime::HasAuthorization
|
17
|
+
include MotionPrime::HasNormalizer
|
17
18
|
|
18
19
|
attr_accessor :screen, :model, :name, :options, :elements
|
19
20
|
class_attribute :elements_options, :container_options
|
@@ -77,7 +78,9 @@ module MotionPrime
|
|
77
78
|
end
|
78
79
|
|
79
80
|
def container_options
|
80
|
-
@container_options ||=
|
81
|
+
@container_options ||= normalize_options(
|
82
|
+
self.class.container_options.try(:clone) || {}
|
83
|
+
)
|
81
84
|
end
|
82
85
|
|
83
86
|
def container_height
|
data/motion-prime/version.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
motion_require '../helpers/has_normalizer'
|
1
2
|
module MotionPrime
|
2
3
|
class Styles
|
3
4
|
@@repo = {}
|
@@ -17,6 +18,8 @@ module MotionPrime
|
|
17
18
|
end
|
18
19
|
|
19
20
|
class << self
|
21
|
+
include HasNormalizer
|
22
|
+
|
20
23
|
def define(namespace = nil, &block)
|
21
24
|
self.new(namespace).instance_eval(&block)
|
22
25
|
end
|
@@ -33,12 +36,6 @@ module MotionPrime
|
|
33
36
|
style_options = self.for(options.delete(:styles))
|
34
37
|
normalize_options(style_options.merge(options))
|
35
38
|
end
|
36
|
-
|
37
|
-
def normalize_options(options)
|
38
|
-
options.each do |key, option|
|
39
|
-
options[key] = option.is_a?(Proc) && key != :block ? instance_eval(&option) : option
|
40
|
-
end
|
41
|
-
end
|
42
39
|
end
|
43
40
|
end
|
44
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-prime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Haziev
|
@@ -201,6 +201,7 @@ files:
|
|
201
201
|
- motion-prime/elements/text_field.rb
|
202
202
|
- motion-prime/elements/text_view.rb
|
203
203
|
- motion-prime/helpers/has_authorization.rb
|
204
|
+
- motion-prime/helpers/has_normalizer.rb
|
204
205
|
- motion-prime/helpers/has_search_bar.rb
|
205
206
|
- motion-prime/models/association.rb
|
206
207
|
- motion-prime/models/bag.rb
|