Sha256: c82ac2da013317bf3dd4786d4c05e44e1b4764596ade3aae9040236460313231
Contents?: true
Size: 966 Bytes
Versions: 2
Compression:
Stored size: 966 Bytes
Contents
# # A little trait to handle the common editable fields API # module UnderOs::UI::Editable KEYBOARDS = { default: UIKeyboardTypeDefault, ascii: UIKeyboardTypeASCIICapable, numeric: UIKeyboardTypeNumbersAndPunctuation, url: UIKeyboardTypeURL, numbers: UIKeyboardTypeNumberPad, phone: UIKeyboardTypePhonePad, name: UIKeyboardTypeNamePhonePad, email: UIKeyboardTypeEmailAddress, decimal: UIKeyboardTypeDecimalPad, twitter: UIKeyboardTypeTwitter, search: UIKeyboardTypeWebSearch } def value @_.text end def value=(value) @_.text = value end def placeholder @_.placeholder end def placeholder=(value) @_.placeholder = value end def keyboard KEYBOARDS.detect{|n,v| v == @_.keyboardType }[0] end def keyboard=(keyboard) keyboard = keyboard.to_sym if keyboard.is_a?(String) @_.keyboardType = KEYBOARDS[keyboard] || keyboard end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
under-os-1.1.0 | lib/under_os/ui/utils/editable.rb |
under-os-1.0.0 | lib/under_os/ui/utils/editable.rb |