motion-prime/sections/form.rb in motion-prime-0.2.0 vs motion-prime/sections/form.rb in motion-prime-0.2.1
- old
+ new
@@ -15,19 +15,14 @@
# puts "Submitted email: #{email}"
# end
# end
#
- KEYBOARD_HEIGHT_PORTRAIT = 216
- KEYBOARD_HEIGHT_LANDSCAPE = 162
-
class_attribute :text_field_limits, :text_view_limits
class_attribute :fields_options
attr_accessor :fields, :field_indexes, :keyboard_visible
- after_render :bind_keyboard_events
-
def table_data
fields.values
end
def render_table
@@ -88,10 +83,14 @@
# @return MotionPrime::BaseFieldSection field
def field(field_name)
self.fields[field_name.to_sym]
end
+ def fields_hash
+ fields.to_hash
+ end
+
# Set focus on field cell
#
# Examples:
# form.focus_on(:title)
#
@@ -116,34 +115,9 @@
return unless keyboard_visible
self.table_view.height += KEYBOARD_HEIGHT_PORTRAIT
self.keyboard_visible = false
end
-
-
- def on_keyboard_show; end
- def on_keyboard_hide; end
- def keyboard_will_show; end
- def keyboard_will_hide; end
-
- def bind_keyboard_events
- NSNotificationCenter.defaultCenter.addObserver self,
- selector: :on_keyboard_show,
- name: UIKeyboardDidShowNotification,
- object: nil
- NSNotificationCenter.defaultCenter.addObserver self,
- selector: :on_keyboard_hide,
- name: UIKeyboardDidHideNotification,
- object: nil
- NSNotificationCenter.defaultCenter.addObserver self,
- selector: :keyboard_will_show,
- name: UIKeyboardWillShowNotification,
- object: nil
- NSNotificationCenter.defaultCenter.addObserver self,
- selector: :keyboard_will_hide,
- name: UIKeyboardWillHideNotification,
- object: nil
- end
# ALIASES
def on_input_change(text_field); end
def on_input_edit(text_field); end
def on_input_return(text_field)
text_field.resignFirstResponder
\ No newline at end of file