motion-prime 0.9.3 → 0.9.4
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/files/Gemfile +1 -1
- data/motion-prime/screens/_sections_mixin.rb +44 -32
- data/motion-prime/screens/screen.rb +1 -1
- data/motion-prime/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTEwYzU5NjkxYjdmZjk4NjU2MGViODJlY2U4YmI5NDBkMDJhNDJmZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Nzg1YmZmODZiYmM3MTM0NzI5YmExNWExNDdkNmUxN2IwNGRiZGI1MA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTU0Y2QyNTMyMDlhNzcwMWU3M2RjNmY3OTgyM2Q4NDlhZDNiZTdiMWY4MDk4
|
10
|
+
NzdiODU5NzgxODc3NDlhODRlN2EzYzdiNTA2MDQ3YmY0MTQwOWRiYjc2MWRh
|
11
|
+
YWI5NjJlOGQ0MmFjNTUwMGVmZWMxYjRjMmY2ZjJhZjQ0NGU2YjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODJhNDcxMDg5YWE3YjVkOWRlMmQ2MWIzZGFjZjA1NzQ2ZTY5MmFjMGYxNTFj
|
14
|
+
NTAxYzljOWZhMWE0NmQ1NmI5YjIxMmRkM2QwYjg5OTdiZTZjZDU2MTM2YzUw
|
15
|
+
MTlhYjNiM2Y4NzFkNGY2NzdlYjcwOThlZTYyM2Y4OTJmZGRmODg=
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/files/Gemfile
CHANGED
@@ -9,52 +9,64 @@ module MotionPrime
|
|
9
9
|
base.class_attribute :_section_options
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
attr_accessor :_action_section_options
|
13
|
+
|
14
|
+
def main_section
|
15
|
+
@main_section || all_sections.first
|
16
16
|
end
|
17
17
|
|
18
18
|
def all_sections
|
19
19
|
Array.wrap(@sections.try(:values))
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
@sections = {}
|
26
|
-
section_options.map do |name, options|
|
27
|
-
section = create_section(name, options.clone)
|
28
|
-
@sections[name] = section if section
|
29
|
-
end
|
22
|
+
def set_section(name, options = {})
|
23
|
+
self._action_section_options ||= {}
|
24
|
+
self._action_section_options[name.to_sym] = options
|
30
25
|
end
|
26
|
+
alias_method :section, :set_section
|
31
27
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
protected
|
29
|
+
def add_sections
|
30
|
+
@main_section ||= nil
|
31
|
+
create_sections
|
32
|
+
render_sections
|
33
|
+
end
|
37
34
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
def create_sections
|
36
|
+
section_options = self.class.section_options.merge(action_section_options)
|
37
|
+
return unless section_options
|
38
|
+
@sections = {}
|
39
|
+
section_options.map do |name, options|
|
40
|
+
section = create_section(name, options.clone)
|
41
|
+
@sections[name] = section if section
|
42
|
+
end
|
43
|
+
end
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
@main_section.render
|
48
|
-
else
|
49
|
-
all_sections.first.render
|
45
|
+
def create_section(name, options)
|
46
|
+
section_class = class_factory("#{name}_section")
|
47
|
+
options = normalize_options(options).merge(screen: self)
|
48
|
+
!options.has_key?(:if) || options[:if] ? section_class.new(options) : nil
|
50
49
|
end
|
51
|
-
end
|
52
50
|
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
def action_section_options
|
52
|
+
_action_section_options || {}
|
53
|
+
end
|
54
|
+
|
55
|
+
def render_sections
|
56
|
+
return unless @sections.present?
|
57
|
+
if all_sections.count > 1
|
58
|
+
@main_section = MotionPrime::TableSection.new(model: all_sections, screen: self)
|
59
|
+
@main_section.render
|
60
|
+
else
|
61
|
+
all_sections.first.render
|
62
|
+
end
|
63
|
+
end
|
56
64
|
|
57
65
|
module ClassMethods
|
66
|
+
def section_options
|
67
|
+
_section_options || {}
|
68
|
+
end
|
69
|
+
|
58
70
|
def section(name, options = {})
|
59
71
|
self._section_options ||= {}
|
60
72
|
self._section_options[name.to_sym] = options
|
data/motion-prime/version.rb
CHANGED