motion-prime 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/motion-prime/sections/form.rb +30 -7
- data/motion-prime/sections/form/base_field_section.rb +8 -0
- data/motion-prime/sections/form/password_field_section.rb +1 -8
- data/motion-prime/sections/form/select_field_section.rb +2 -2
- data/motion-prime/sections/form/string_field_section.rb +1 -8
- data/motion-prime/sections/form/submit_field_section.rb +2 -2
- data/motion-prime/sections/form/text_field_section.rb +1 -8
- data/motion-prime/sections/table.rb +12 -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
|
+
Nzg0M2M3MWY1OWZhOTU1NDkwOWY3MzllNTY1NTJlZDc3YWY1ZDg5Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjAxODM0OTk4NDg1NGMwMTE1OGZlYTI2NTc5NTVjMmNiZmJiZDQxZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTQzYjI2NDYxMmNjY2Y1ZmQxMGZjOWI2ZTUyMGQ3YmE3ZWM5MjBhMzU3YjUy
|
10
|
+
Y2RlZWU2ZmVlYmZhNzhjNmMyYTU3ZDhlYTkyYWQzNjhhYzhjNjU3YTJlNzBm
|
11
|
+
NzI2OTc1MWM0ZGU1ZWNiYjE3MjMzYTU2YTFkZjNmMzE0ODJmMzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTM5NTA1YjlhNmQ1NTZlN2M4MWQ5ODhkNTEwYmM1ZDBlOTQ3MmFhMjRkZTRk
|
14
|
+
OWFiY2M4OWZlZTU4Y2UyNjk2MWNiNmQ3MGJlMWMxOTBjNzI3OWNkOGQ1YWVl
|
15
|
+
Mzg0MTFlZTI5YTU1YzYyMjRkZGY0MmNmMDJjMzJiMjBiMDg4OTM=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 0.1.5
|
2
|
+
* MP::FormSection#on_edit renamed to on_input_edit
|
3
|
+
* MP::FormSection#on_input_change callback added
|
4
|
+
* MP::FormSection#on_input_return callback added, hides keyboard by default
|
5
|
+
* MP::FormSection#keyboard_will_show callback added
|
6
|
+
* MP::FormSection#keyboard_will_hide callback added
|
7
|
+
* MP::TableSection#on_appear callback added
|
8
|
+
|
1
9
|
=== 0.1.4 (Breaking changes)
|
2
10
|
* MotionPrime::BaseModel#sync_with_url renamed to fetch_with_url
|
3
11
|
* MotionPrime::BaseModel#sync_with_attributes renamed to fetch_with_attributes
|
data/Gemfile.lock
CHANGED
@@ -54,7 +54,11 @@ module MotionPrime
|
|
54
54
|
# @return MotionPrime::BaseElement element
|
55
55
|
def element(name)
|
56
56
|
field_name, element_name = name.split(':')
|
57
|
-
|
57
|
+
if element_name.present?
|
58
|
+
field(field_name).element(element_name.to_sym)
|
59
|
+
else
|
60
|
+
super(field_name)
|
61
|
+
end
|
58
62
|
end
|
59
63
|
|
60
64
|
# Returns field by name
|
@@ -84,8 +88,6 @@ module MotionPrime
|
|
84
88
|
field(field_name).focus
|
85
89
|
end
|
86
90
|
|
87
|
-
def on_edit(field); end
|
88
|
-
|
89
91
|
class << self
|
90
92
|
def field(name, options = {})
|
91
93
|
options[:name] = name
|
@@ -108,11 +110,12 @@ module MotionPrime
|
|
108
110
|
self.keyboard_visible = false
|
109
111
|
end
|
110
112
|
|
111
|
-
def on_keyboard_show
|
112
|
-
end
|
113
113
|
|
114
|
-
|
115
|
-
end
|
114
|
+
|
115
|
+
def on_keyboard_show; end
|
116
|
+
def on_keyboard_hide; end
|
117
|
+
def keyboard_will_show; end
|
118
|
+
def keyboard_will_hide; end
|
116
119
|
|
117
120
|
def bind_keyboard_events
|
118
121
|
NSNotificationCenter.defaultCenter.addObserver self,
|
@@ -123,6 +126,26 @@ module MotionPrime
|
|
123
126
|
selector: :on_keyboard_hide,
|
124
127
|
name: UIKeyboardDidHideNotification,
|
125
128
|
object: nil
|
129
|
+
NSNotificationCenter.defaultCenter.addObserver self,
|
130
|
+
selector: :keyboard_will_show,
|
131
|
+
name: UIKeyboardWillShowNotification,
|
132
|
+
object: nil
|
133
|
+
NSNotificationCenter.defaultCenter.addObserver self,
|
134
|
+
selector: :keyboard_will_hide,
|
135
|
+
name: UIKeyboardWillHideNotification,
|
136
|
+
object: nil
|
137
|
+
end
|
138
|
+
# ALIASES
|
139
|
+
def on_input_change(text_field); end
|
140
|
+
def on_input_edit(text_field); end
|
141
|
+
def on_input_return(text_field)
|
142
|
+
text_field.resignFirstResponder
|
143
|
+
end;
|
144
|
+
def textFieldShouldReturn(text_field)
|
145
|
+
on_input_return(text_field)
|
146
|
+
end
|
147
|
+
def textFieldDidBeginEditing(text_field)
|
148
|
+
on_input_edit(text_field)
|
126
149
|
end
|
127
150
|
|
128
151
|
private
|
@@ -48,5 +48,13 @@ module MotionPrime
|
|
48
48
|
rescue
|
49
49
|
puts "can't blur on element #{self.class.name}"
|
50
50
|
end
|
51
|
+
|
52
|
+
def bind_text_input
|
53
|
+
view(:input).on :change do |view|
|
54
|
+
focus
|
55
|
+
form.on_input_change(view(:input))
|
56
|
+
end
|
57
|
+
view(:input).delegate = self.form
|
58
|
+
end
|
51
59
|
end
|
52
60
|
end
|
@@ -21,13 +21,6 @@ module MotionPrime
|
|
21
21
|
secureTextEntry: true
|
22
22
|
}.merge(options[:input] || {})
|
23
23
|
end
|
24
|
-
after_render :
|
25
|
-
|
26
|
-
def render_input
|
27
|
-
view(:input).on :editing_did_begin do |view|
|
28
|
-
focus
|
29
|
-
form.on_edit(self)
|
30
|
-
end
|
31
|
-
end
|
24
|
+
after_render :bind_text_input
|
32
25
|
end
|
33
26
|
end
|
@@ -29,9 +29,9 @@ module MotionPrime
|
|
29
29
|
}.merge(options[:arrow] || {})
|
30
30
|
end
|
31
31
|
|
32
|
-
after_render :
|
32
|
+
after_render :bind_select_button
|
33
33
|
|
34
|
-
def
|
34
|
+
def bind_select_button
|
35
35
|
view(:button).on :touch do
|
36
36
|
form.send(options[:action]) if options[:action]
|
37
37
|
end
|
@@ -20,13 +20,6 @@ module MotionPrime
|
|
20
20
|
],
|
21
21
|
}.merge(options[:input] || {})
|
22
22
|
end
|
23
|
-
after_render :
|
24
|
-
|
25
|
-
def render_input
|
26
|
-
view(:input).on :editing_did_begin do |view|
|
27
|
-
focus
|
28
|
-
form.on_edit(self)
|
29
|
-
end
|
30
|
-
end
|
23
|
+
after_render :bind_text_input
|
31
24
|
end
|
32
25
|
end
|
@@ -21,13 +21,6 @@ module MotionPrime
|
|
21
21
|
editable: true
|
22
22
|
}.merge(options[:input] || {})
|
23
23
|
end
|
24
|
-
after_render :
|
25
|
-
|
26
|
-
def render_input
|
27
|
-
view(:input).on :editing_did_begin do |view|
|
28
|
-
focus
|
29
|
-
form.on_edit(self)
|
30
|
-
end
|
31
|
-
end
|
24
|
+
after_render :bind_text_input
|
32
25
|
end
|
33
26
|
end
|
@@ -4,7 +4,7 @@ module MotionPrime
|
|
4
4
|
include TableSectionRefreshMixin
|
5
5
|
include HasSearchBar
|
6
6
|
|
7
|
-
attr_accessor :table_view
|
7
|
+
attr_accessor :table_view, :did_appear
|
8
8
|
before_render :render_table
|
9
9
|
|
10
10
|
def table_data
|
@@ -18,6 +18,7 @@ module MotionPrime
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def reload_data
|
21
|
+
@did_appear = false
|
21
22
|
@data = nil
|
22
23
|
@data_stamp = Time.now.to_i
|
23
24
|
table_view.reloadData
|
@@ -59,6 +60,9 @@ module MotionPrime
|
|
59
60
|
def on_click(table, index)
|
60
61
|
end
|
61
62
|
|
63
|
+
def on_appear
|
64
|
+
end
|
65
|
+
|
62
66
|
def cell_name(table, index)
|
63
67
|
record = data[index.row]
|
64
68
|
if record && record.model &&
|
@@ -79,6 +83,13 @@ module MotionPrime
|
|
79
83
|
|
80
84
|
def tableView(table, cellForRowAtIndexPath:index)
|
81
85
|
cell = cached_cell(index, table) || render_cell(index, table)
|
86
|
+
|
87
|
+
# run table view is appeared callback if needed
|
88
|
+
if index.row == data.size - 1 && !@did_appear
|
89
|
+
@did_appear = true
|
90
|
+
on_appear
|
91
|
+
end
|
92
|
+
|
82
93
|
cell.is_a?(UIView) ? cell : cell.view
|
83
94
|
end
|
84
95
|
|
data/motion-prime/version.rb
CHANGED