motion-prime 0.1.2 → 0.1.3

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGZjZGVmYWUxZTgzYTU0MTg4ZjZiYjAwOTY5NTMxNTdmNjk5ZDFjZQ==
4
+ Yjc5ZTE2MmM1MzZjZjg1MmY4NzAyZmE1YTk1YTM2YjMxNzcwOTk2Ng==
5
5
  data.tar.gz: !binary |-
6
- ZDM0ZmM0MDg4YTcwYmQ1YjI2OTViZDI2ZjgxMWE0NTBjYWVjMTgwOA==
6
+ MTlkMDA1NjI5ODJiYzEwM2NjM2E4MzUyZWQ5ZDc0N2YzYWY1YzgyMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjBiMzg3NTM2NjY3Y2RkMzA0ODY3OWNkNjRmY2Y3OThiZDBmNmJmYjE3OTcw
10
- NzhlNGMxZjBkYmNkMTc5ODY4Y2VhMzlhZmE2ZDFmNDNiMjUzMWIxMzRhZDA1
11
- YzQxOGZiMGRhZDU3ZmIyZWFhM2ExYjgwYmUxZDljOTZlY2M1N2E=
9
+ NzZiYjU5Yjg0MTY3ZDU3ZThjOGE1MTVjYjRjNWMxZDU3MTg4NTA5ZWIyZTcz
10
+ MTgxNTdkOGNiODI2MTZiZWU1Nzg2ZTYxOWUxZDk0MjM2ZWFhY2UyMzk5YjEw
11
+ NzI4MzRmZWVjOTczYTZlZDE2ZWM3YWI5NjMxMDBjNzA4ODg0MjI=
12
12
  data.tar.gz: !binary |-
13
- Y2M0ZjQzMWU0NjZlYWE5MDg4NzBjYzI0MmRlOWU1MjA1YzFkYzgwMzRjYzFi
14
- OTIzOWVhOGQzMDJiYzFmNTIxZmNmYzJjNGE0N2YyMWI4MDMzNDc2ZGEyMzkx
15
- ZTVlZDZkM2RlMzQyM2FkOGMzZjg5ZGYzY2JiNjg0NGJlMmE3NzM=
13
+ MjY5MDgzMDIxOWViYjVkMWE5MGNlZGQwOWZmOTBlNmI3ZTU4Yzc3YzQwNjg3
14
+ YWI3OGEwMDViMWZjNGEyMWFjNzU3YzZiN2JlODkyOTg2ZDk1NTY5NGNlNzNm
15
+ M2IzODlkNzFiN2IzOWM1ZTBiMTdkNWY1NDhlNWI5NTU4ZTU3MTY=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.1.3
2
+ * added google map element support
3
+ * fixes for tabbed section
4
+
1
5
  === 0.1.2
2
6
  * added tabbed section
3
7
  * draw image element now supports layer. e.g. you can pass layer: {corner_radius: 50} now.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- motion-prime (0.1.2)
4
+ motion-prime (0.1.3)
5
5
  bubble-wrap
6
6
  cocoapods
7
7
  motion-cocoapods
@@ -0,0 +1,7 @@
1
+ module MotionPrime
2
+ class GoogleMapElement < BaseElement
3
+ def view_class
4
+ "GMSMapView"
5
+ end
6
+ end
7
+ end
@@ -11,7 +11,7 @@ module MotionPrime
11
11
  # end
12
12
  #
13
13
 
14
- class_attribute :tabs_options, :tabs_default
14
+ class_attribute :tabs_options, :tabs_default, :tabs_indexes
15
15
  attr_accessor :tab_pages
16
16
 
17
17
  element :control, type: :segmented_control,
@@ -32,28 +32,30 @@ module MotionPrime
32
32
  @tab_default ||= self.class.tabs_default || 0
33
33
  end
34
34
 
35
- def render_tab_pages
36
- @tab_pages = []
37
- index = 0
38
- tab_options.each do |key, options|
39
- section_class = options[:page_section].classify
40
- page = "::#{section_class}Section".constantize.new(model: model)
41
- page.render(to: screen)
42
- page.hide if index != tab_default
43
- @tab_pages << page
44
- index += 1
45
- end
35
+
36
+ # Make tab button disabled by index
37
+ # @param Fixnum index
38
+ def disable_at(index)
39
+ toggle_at(index, false)
46
40
  end
47
41
 
48
- def render_tab_controls
49
- control = element(:control).view
50
- control.addTarget(
51
- self, action: :on_click, forControlEvents: UIControlEventValueChanged
52
- )
53
- control.setSelectedSegmentIndex(tab_default)
42
+ # Make tab button enabled by index
43
+ # @param Fixnum index
44
+ def enable_at(index)
45
+ toggle_at(index, true)
46
+ end
47
+
48
+ # Toggle tab button activity by index
49
+ # @param [Fixnum, String] index or tab id
50
+ # @param Boolean value
51
+ def toggle_at(index, value)
52
+ if index.is_a?(Symbol)
53
+ index = self.class.tabs_indexes[index]
54
+ end
55
+ view(:control).setEnabled value, forSegmentAtIndex: index
54
56
  end
55
57
 
56
- # on clicn to control
58
+ # on click to segment tab
57
59
  # @param UISegemtedControl control
58
60
  def on_click(*control)
59
61
  @tab_pages.each_with_index do |page, i|
@@ -67,10 +69,35 @@ module MotionPrime
67
69
  options[:name] = id.to_s.titleize
68
70
  options[:id] = id
69
71
 
72
+ self.tabs_indexes ||= {}
73
+ self.tabs_indexes[id] = tabs_indexes.length
74
+ self.tabs_default = tabs_indexes.length - 1 if options[:default]
75
+
70
76
  self.tabs_options ||= {}
71
- self.tabs_default = tabs_options.length if options[:default]
72
77
  self.tabs_options[id] = options
73
78
  end
74
79
  end
80
+
81
+ private
82
+ def render_tab_pages
83
+ self.tab_pages = []
84
+ index = 0
85
+ tab_options.each do |key, options|
86
+ section_class = options[:page_section].classify
87
+ page = "::#{section_class}Section".constantize.new(model: model)
88
+ page.render(to: screen)
89
+ page.hide if index != tab_default
90
+ self.tab_pages << page
91
+ index += 1
92
+ end
93
+ end
94
+
95
+ def render_tab_controls
96
+ control = element(:control).view
97
+ control.addTarget(
98
+ self, action: :on_click, forControlEvents: UIControlEventValueChanged
99
+ )
100
+ control.setSelectedSegmentIndex(tab_default)
101
+ end
75
102
  end
76
103
  end
@@ -97,4 +97,7 @@ MotionPrime::Styles.define :base do
97
97
 
98
98
  style :segmented_control,
99
99
  height: 40, width: 320, top: 0
100
+
101
+ style :google_map,
102
+ top: 0, left: 0, right: 0, bottom: 0
100
103
  end
@@ -1,3 +1,3 @@
1
1
  module MotionPrime
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -74,6 +74,11 @@ module MotionPrime
74
74
  search_bar = klass.alloc.init
75
75
  search_bar.autoresizingMask = UIViewAutoresizingFlexibleWidth
76
76
  search_bar
77
+ },
78
+ GMSMapView => Proc.new{|klass, options|
79
+ camera = GMSCameraPosition.cameraWithLatitude(35.689466, longitude: 139.700196, zoom: 15)
80
+ map = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
81
+ map
77
82
  }
78
83
  }
79
84
  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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Haziev
@@ -194,6 +194,7 @@ files:
194
194
  - motion-prime/elements/draw.rb
195
195
  - motion-prime/elements/draw/image.rb
196
196
  - motion-prime/elements/draw/label.rb
197
+ - motion-prime/elements/google_map.rb
197
198
  - motion-prime/elements/image.rb
198
199
  - motion-prime/elements/label.rb
199
200
  - motion-prime/elements/text_field.rb