motion-form 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f41c07e9e040f08b3f7bc096657dd1e8c1eebb92
4
- data.tar.gz: 823bd6e84025e8925182e0d7f66e8c2015ed5cc1
3
+ metadata.gz: 09ef894ca746f523ff535a24fc6a087cea8a81d2
4
+ data.tar.gz: e9f23285416fc9fcdc676952c90fbcd3aa438a5e
5
5
  SHA512:
6
- metadata.gz: e5cc65d90f7082e5beb123c4963a1fc76a1ea7db0f6169fe4e63cb2b674d869a9f4af22ddf483bb1b5461d4dd0d2e1ccc193459dc0a711a65aae1202ac39572d
7
- data.tar.gz: 7013d8b3485a02c3e9c113109b5f237c0b85f8eedaf5393b919a890076fc073e458611d04fc0cfe3836ebae7cf43c6c4899ea1bb1925e10bbbe74debda8e94c9
6
+ metadata.gz: f0971e202bc441add4a481064d56bdb29b2e971fcc79b1b5374ba40fd20250829d66dc1444965c94f81b14d20b06538ddf8a054bee95de96fef35236b72b8711
7
+ data.tar.gz: d12f57fe38dadab75f55d55f2e1d35b9ba9adae4d37649d92cf3a4cae71068512e656e7922271d11cbe158ef1fe301d6fdbd9ac4b9ed7615eabaa4122a5ae1cc
@@ -46,10 +46,12 @@ class ButtonCell < TextFieldCell
46
46
  text_field.rightViewMode = UITextFieldViewModeAlways
47
47
  end
48
48
 
49
+ def accessory=(icon)
50
+ right_view.name = icon
51
+ end
52
+
49
53
  def right_view
50
- @right_view ||= IconView.alloc.init.tap do |icon|
51
- icon.name = :forward_arrow
52
- end
54
+ @right_view ||= IconView.alloc.init
53
55
  end
54
56
 
55
57
  def layoutSubviews
@@ -4,6 +4,7 @@ motion_require './cells/text_field_cell'
4
4
  module MotionForm
5
5
  class << self
6
6
  attr_writer :icon_font,
7
+ :icon_mapper,
7
8
  :section_header_color,
8
9
  :section_header_text_color,
9
10
  :section_header_font,
@@ -52,6 +53,10 @@ module MotionForm
52
53
  @icon_font || UIFont.fontWithName('dscovr', size: 14.0)
53
54
  end
54
55
 
56
+ def icon_mapper
57
+ @icon_mapper || -> (icon_name) { icon_name }
58
+ end
59
+
55
60
  def section_header_color
56
61
  @section_header_color || '#bac3c7'.to_color
57
62
  end
@@ -2,12 +2,13 @@ motion_require '../cells/button_cell'
2
2
  motion_require './text_field_row'
3
3
 
4
4
  class ButtonRow < TextFieldRow
5
- attr_reader :on_tap_callback
5
+ attr_reader :on_tap_callback, :accessory
6
6
 
7
7
  def initialize(key, options)
8
8
  super
9
9
 
10
10
  @on_tap_callback = options.fetch(:action, lambda {})
11
+ @accessory = options.fetch(:accessory, nil)
11
12
  end
12
13
 
13
14
  def cell_type
@@ -29,4 +30,10 @@ class ButtonRow < TextFieldRow
29
30
  on_tap_callback.call
30
31
  end
31
32
  end
33
+
34
+ def update_cell(cell)
35
+ super
36
+
37
+ cell.accessory = accessory
38
+ end
32
39
  end
@@ -13,26 +13,6 @@ class IconView < UILabel
13
13
  def name=(name)
14
14
  @name = name
15
15
 
16
- self.text = hex
17
- end
18
-
19
- def hex
20
- unicode ? unicode.hex.chr(Encoding::UTF_8) : ''
21
- end
22
-
23
- def unicode
24
- icon_mappings[name]
25
- end
26
-
27
- def icon_mappings
28
- @_icon_mappings ||= BW::JSON.parse(json_data.to_str)
29
- end
30
-
31
- def json_data
32
- NSData.dataWithContentsOfFile(json_path)
33
- end
34
-
35
- def json_path
36
- NSBundle.mainBundle.pathForResource('font_icons', ofType: 'json')
16
+ self.text = MotionForm.icon_mapper.call(name)
37
17
  end
38
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Devon Blandin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-16 00:00:00.000000000 Z
11
+ date: 2013-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: motion-keyboard-avoiding