motion-prime 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjQ0MTllNzk1MTE2ODViNTZjMDE0NzFhMTU2Nzk1ZjI1Njg3MDhjZQ==
4
+ YTEwYzU5NjkxYjdmZjk4NjU2MGViODJlY2U4YmI5NDBkMDJhNDJmZQ==
5
5
  data.tar.gz: !binary |-
6
- NzQ0YTk2NjA2NWUxOGE5N2NjMjFkZTA2YjJlZTlhNzVkMDQ0M2I2ZA==
6
+ Nzg1YmZmODZiYmM3MTM0NzI5YmExNWExNDdkNmUxN2IwNGRiZGI1MA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MGY3OWE1OTNkNGVjMWQ4NjFiNjgzOGNjMjhiNTQ5ZTUwODEyNmMwMGVlNGIz
10
- NTg2OTM3ZmMyNzcxMDE2YTNkNDJhNTg1MGEzNjE1YjAwNTNlMzljMzdlNjM2
11
- ZTU2NzZlZWNkYmIzZWUxMjMwODg2MWQ1OWYxZjIyOTA2ZjdiNmY=
9
+ YTU0Y2QyNTMyMDlhNzcwMWU3M2RjNmY3OTgyM2Q4NDlhZDNiZTdiMWY4MDk4
10
+ NzdiODU5NzgxODc3NDlhODRlN2EzYzdiNTA2MDQ3YmY0MTQwOWRiYjc2MWRh
11
+ YWI5NjJlOGQ0MmFjNTUwMGVmZWMxYjRjMmY2ZjJhZjQ0NGU2YjA=
12
12
  data.tar.gz: !binary |-
13
- Y2QxNWVhMGRkZTBlMTE2YWM5NzU4MjJhNjMwNGI0ODAwYWVmNTU3NzY2NTU3
14
- YzM2NzJmZGU3ODczYjQ1ZGJlNzllNDgzYmE1OGQ3NjQzY2IyZDdiMjBmOGYx
15
- MDg1YTVmOWM1MGUyMGMwNTkwYTQ4ZmU2N2JhYzIyNjcyOTUyZjI=
13
+ ODJhNDcxMDg5YWE3YjVkOWRlMmQ2MWIzZGFjZjA1NzQ2ZTY5MmFjMGYxNTFj
14
+ NTAxYzljOWZhMWE0NmQ1NmI5YjIxMmRkM2QwYjg5OTdiZTZjZDU2MTM2YzUw
15
+ MTlhYjNiM2Y4NzFkNGY2NzdlYjcwOThlZTYyM2Y4OTJmZGRmODg=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ === 0.9.4
2
+ * Ability to render multiple sections inside screen action.
3
+
1
4
  === 0.9.3
2
5
  * Small refactor required for working prime_awesome
3
6
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- motion-prime (0.9.3)
4
+ motion-prime (0.9.4)
5
5
  activesupport
6
6
  afmotion (~> 2.0.0)
7
7
  bubble-wrap (~> 1.5.0)
data/files/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'motion-cocoapods', '~> 1.4.0'
4
- gem 'motion-prime', '0.9.3'
4
+ gem 'motion-prime', '0.9.4'
5
5
 
6
6
  # add reside menu for sidebar support
7
7
  # gem 'prime_reside_menu', '~> 0.1.4'
@@ -9,52 +9,64 @@ module MotionPrime
9
9
  base.class_attribute :_section_options
10
10
  end
11
11
 
12
- def add_sections
13
- @main_section = nil
14
- create_sections
15
- render_sections
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 create_sections
23
- section_options = self.class._section_options
24
- return unless section_options
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
- def create_section(name, options)
33
- section_class = class_factory("#{name}_section")
34
- options = normalize_options(options).merge(screen: self)
35
- !options.has_key?(:if) || options[:if] ? section_class.new(options) : nil
36
- end
28
+ protected
29
+ def add_sections
30
+ @main_section ||= nil
31
+ create_sections
32
+ render_sections
33
+ end
37
34
 
38
- def set_section(name, options = {})
39
- @main_section = create_section(name, options)
40
- @main_section.render
41
- end
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
- def render_sections
44
- return unless @sections
45
- if all_sections.count > 1
46
- @main_section = MotionPrime::TableSection.new(model: all_sections, screen: self)
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
- def main_section
54
- @main_section || all_sections.first
55
- end
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
@@ -22,7 +22,7 @@ module MotionPrime
22
22
 
23
23
  define_callbacks :render
24
24
 
25
- before_render :add_sections
25
+ after_render :add_sections
26
26
 
27
27
  def render
28
28
  end
@@ -1,3 +1,3 @@
1
1
  module MotionPrime
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.4"
3
3
  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.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Haziev