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 +8 -8
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/motion-prime/elements/google_map.rb +7 -0
- data/motion-prime/sections/tabbed.rb +47 -20
- data/motion-prime/styles/base.rb +3 -0
- data/motion-prime/version.rb +1 -1
- data/motion-prime/views/view_builder.rb +5 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yjc5ZTE2MmM1MzZjZjg1MmY4NzAyZmE1YTk1YTM2YjMxNzcwOTk2Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTlkMDA1NjI5ODJiYzEwM2NjM2E4MzUyZWQ5ZDc0N2YzYWY1YzgyMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzZiYjU5Yjg0MTY3ZDU3ZThjOGE1MTVjYjRjNWMxZDU3MTg4NTA5ZWIyZTcz
|
10
|
+
MTgxNTdkOGNiODI2MTZiZWU1Nzg2ZTYxOWUxZDk0MjM2ZWFhY2UyMzk5YjEw
|
11
|
+
NzI4MzRmZWVjOTczYTZlZDE2ZWM3YWI5NjMxMDBjNzA4ODg0MjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjY5MDgzMDIxOWViYjVkMWE5MGNlZGQwOWZmOTBlNmI3ZTU4Yzc3YzQwNjg3
|
14
|
+
YWI3OGEwMDViMWZjNGEyMWFjNzU3YzZiN2JlODkyOTg2ZDk1NTY5NGNlNzNm
|
15
|
+
M2IzODlkNzFiN2IzOWM1ZTBiMTdkNWY1NDhlNWI5NTU4ZTU3MTY=
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
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
|
data/motion-prime/styles/base.rb
CHANGED
data/motion-prime/version.rb
CHANGED
@@ -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.
|
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
|