motion-prime 0.3.1 → 0.3.2
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 +7 -3
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/ROADMAP.md +12 -0
- data/motion-prime/api_client.rb +1 -0
- data/motion-prime/app_delegate.rb +1 -1
- data/motion-prime/elements/_content_padding_mixin.rb +49 -0
- data/motion-prime/elements/_field_dimensions_mixin.rb +37 -21
- data/motion-prime/elements/_text_dimensions_mixin.rb +0 -4
- data/motion-prime/elements/base.rb +20 -7
- data/motion-prime/elements/button.rb +2 -1
- data/motion-prime/elements/draw/label.rb +19 -8
- data/motion-prime/elements/error_message.rb +2 -1
- data/motion-prime/elements/image.rb +1 -0
- data/motion-prime/elements/label.rb +10 -10
- data/motion-prime/elements/text_field.rb +2 -0
- data/motion-prime/models/bag.rb +8 -3
- data/motion-prime/models/model.rb +1 -1
- data/motion-prime/models/sync.rb +17 -8
- data/motion-prime/screens/_aliases_mixin.rb +2 -0
- data/motion-prime/screens/_base_mixin.rb +19 -52
- data/motion-prime/screens/_navigation_mixin.rb +31 -29
- data/motion-prime/screens/base_screen.rb +8 -0
- data/motion-prime/screens/extensions/_indicators_mixin.rb +26 -0
- data/motion-prime/screens/{_navigation_bar_mixin.rb → extensions/_navigation_bar_mixin.rb} +0 -0
- data/motion-prime/screens/sidebar_container_screen.rb +1 -1
- data/motion-prime/sections/base.rb +1 -1
- data/motion-prime/sections/form.rb +5 -2
- data/motion-prime/sections/form/base_field_section.rb +2 -2
- data/motion-prime/support/_key_value_store.rb +1 -1
- data/motion-prime/support/_padding_attribute.rb +60 -0
- data/motion-prime/support/dm_button.rb +20 -20
- data/motion-prime/support/dm_text_field.rb +12 -17
- data/motion-prime/support/dm_text_view.rb +1 -1
- data/motion-prime/support/mp_label.rb +9 -0
- data/motion-prime/version.rb +1 -1
- data/motion-prime/views/layout.rb +1 -0
- data/motion-prime/views/styles.rb +1 -1
- data/motion-prime/views/view_styler.rb +5 -1
- data/spec/helpers/models.rb +8 -1
- data/travis.sh +1 -3
- metadata +8 -3
@@ -1,7 +1,7 @@
|
|
1
1
|
class DMButton < UIButton
|
2
|
-
include MotionPrime::
|
3
|
-
|
4
|
-
attr_accessor :
|
2
|
+
include MotionPrime::SupportKeyValueStore
|
3
|
+
include MotionPrime::SupportPaddingAttribute
|
4
|
+
attr_accessor :sizeToFit
|
5
5
|
|
6
6
|
def setTitle(value)
|
7
7
|
setTitle value, forState: UIControlStateNormal
|
@@ -16,35 +16,35 @@ class DMButton < UIButton
|
|
16
16
|
super
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
|
19
|
+
def self.default_padding_left
|
20
|
+
5
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
|
23
|
+
def self.default_padding_right
|
24
|
+
5
|
25
25
|
end
|
26
26
|
|
27
|
-
def padding_top
|
28
|
-
self.paddingTop || self.padding ||
|
27
|
+
def padding_top # to center title label
|
28
|
+
self.paddingTop || self.padding || begin
|
29
|
+
single_line_height = self.font.pointSize
|
30
|
+
(self.bounds.size.height - single_line_height)/2 + 1
|
31
|
+
end
|
29
32
|
end
|
30
33
|
|
31
|
-
def
|
32
|
-
|
33
|
-
(self.bounds.size.height - single_line_height)/2 + 1
|
34
|
+
def padding_bottom
|
35
|
+
self.bounds.size.height - (self.font.pointSize + padding_top)
|
34
36
|
end
|
35
37
|
|
36
|
-
def
|
37
|
-
|
38
|
+
def apply_padding!(rect)
|
39
|
+
self.setTitleEdgeInsets(padding_insets)
|
40
|
+
end
|
38
41
|
|
39
|
-
|
40
|
-
|
41
|
-
padding_top, padding_left,
|
42
|
-
padding_top + height_diff, padding_right
|
43
|
-
)
|
42
|
+
def apply_padding?
|
43
|
+
super && !@custom_title_inset_drawn
|
44
44
|
end
|
45
45
|
|
46
46
|
def drawRect(rect)
|
47
|
-
|
47
|
+
apply_padding(rect)
|
48
48
|
super
|
49
49
|
end
|
50
50
|
end
|
@@ -2,11 +2,9 @@
|
|
2
2
|
# * support padding, padding_left, padding_right options
|
3
3
|
# * support placeholder_color, placeholder_font options
|
4
4
|
class DMTextField < UITextField
|
5
|
-
|
6
|
-
include MotionPrime::
|
7
|
-
|
8
|
-
attr_accessor :paddingLeft, :paddingRight, :paddingTop, :padding,
|
9
|
-
:placeholderColor, :placeholderFont
|
5
|
+
include MotionPrime::SupportKeyValueStore
|
6
|
+
include MotionPrime::SupportPaddingAttribute
|
7
|
+
attr_accessor :placeholderColor, :placeholderFont
|
10
8
|
|
11
9
|
# placeholder position
|
12
10
|
def textRectForBounds(bounds)
|
@@ -25,21 +23,19 @@ class DMTextField < UITextField
|
|
25
23
|
self.placeholder.drawInRect(rect, withFont: font)
|
26
24
|
end
|
27
25
|
|
28
|
-
def
|
29
|
-
self.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
self.paddingRight || self.padding_left
|
26
|
+
def padding_top # to center title label
|
27
|
+
self.paddingTop || self.padding || begin
|
28
|
+
single_line_height = self.font.pointSize
|
29
|
+
(self.bounds.size.height - single_line_height)/2 + 2
|
30
|
+
end
|
34
31
|
end
|
35
32
|
|
36
|
-
def
|
37
|
-
|
33
|
+
def self.default_padding_left
|
34
|
+
5
|
38
35
|
end
|
39
36
|
|
40
|
-
def
|
41
|
-
|
42
|
-
(self.bounds.size.height - single_line_height)/2 + 2
|
37
|
+
def self.default_padding_right
|
38
|
+
5
|
43
39
|
end
|
44
40
|
|
45
41
|
private
|
@@ -50,5 +46,4 @@ class DMTextField < UITextField
|
|
50
46
|
bounds.origin.x + padding_left, bounds.origin.y + padding_top,
|
51
47
|
bounds.size.width - (padding_left + padding_right), bounds.size.height - padding_top*2)
|
52
48
|
end
|
53
|
-
|
54
49
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# * support padding, padding_left, padding_right options
|
3
3
|
# * support placeholder, placeholder_color, placeholder_font options
|
4
4
|
class DMTextView < UITextView
|
5
|
-
include MotionPrime::
|
5
|
+
include MotionPrime::SupportKeyValueStore
|
6
6
|
DEFAULT_PADDING_LEFT = 7
|
7
7
|
|
8
8
|
attr_accessor :paddingLeft, :paddingTop, :padding,
|
data/motion-prime/version.rb
CHANGED
@@ -11,6 +11,7 @@ module MotionPrime
|
|
11
11
|
options = builder.options.merge(calculate_frame: true, bounds: bounds)
|
12
12
|
view = builder.view
|
13
13
|
if render_target = options.delete(:render_target)
|
14
|
+
options[:bounds] = render_target.bounds
|
14
15
|
render_target.addSubview(view)
|
15
16
|
elsif view_stack.any?
|
16
17
|
view_stack.last.addSubview(view)
|
@@ -14,7 +14,7 @@ module MotionPrime
|
|
14
14
|
if block_given?
|
15
15
|
raise "Only style names are available for nested styles, received: `#{args.inspect}`. Namespace: `#{@namespace}`" if options.present?
|
16
16
|
names.each do |name|
|
17
|
-
|
17
|
+
namespace = [@namespace, name].compact.join('_')
|
18
18
|
self.class.new(namespace).instance_eval(&block)
|
19
19
|
end
|
20
20
|
else
|
@@ -36,6 +36,7 @@ module MotionPrime
|
|
36
36
|
options[:frame] = bounds
|
37
37
|
else
|
38
38
|
frame = CGRectZero
|
39
|
+
|
39
40
|
max_width = bounds.size.width
|
40
41
|
max_height = bounds.size.height
|
41
42
|
width = 0.0 if width.nil?
|
@@ -107,7 +108,10 @@ module MotionPrime
|
|
107
108
|
# ignore options
|
108
109
|
return if key == 'size_to_fit' && view.is_a?(UILabel)
|
109
110
|
return if (key == 'url' || key == 'default') && view.is_a?(UIImageView)
|
110
|
-
return if %w[
|
111
|
+
return if %w[
|
112
|
+
max_width max_outer_width min_width min_outer_width
|
113
|
+
max_height max_outer_height min_height min_outer_width
|
114
|
+
height_to_fit container].include? key.to_s
|
111
115
|
|
112
116
|
# apply options
|
113
117
|
if key.end_with?('title_color')
|
data/spec/helpers/models.rb
CHANGED
@@ -3,38 +3,45 @@ class User < MotionPrime::BaseModel
|
|
3
3
|
end
|
4
4
|
|
5
5
|
class Plane < MotionPrime::BaseModel
|
6
|
-
attributes :name, :age
|
6
|
+
attributes :id, :name, :age
|
7
7
|
end
|
8
8
|
|
9
9
|
class Listing < MotionPrime::BaseModel
|
10
|
+
attribute :id
|
10
11
|
attribute :name
|
11
12
|
end
|
12
13
|
|
13
14
|
class Todo < MotionPrime::BaseModel
|
15
|
+
attribute :id
|
14
16
|
attribute :title
|
15
17
|
bag :items
|
16
18
|
end
|
17
19
|
|
18
20
|
class TodoItem < MotionPrime::BaseModel
|
21
|
+
attribute :id
|
19
22
|
attribute :completed
|
20
23
|
attribute :text
|
21
24
|
end
|
22
25
|
|
23
26
|
class Page < MotionPrime::BaseModel
|
27
|
+
attribute :id
|
24
28
|
attribute :text
|
25
29
|
attribute :index
|
26
30
|
end
|
27
31
|
|
28
32
|
class Animal < MotionPrime::BaseModel
|
33
|
+
attribute :id
|
29
34
|
attribute :name
|
30
35
|
end
|
31
36
|
|
32
37
|
class Autobot < MotionPrime::BaseModel
|
38
|
+
attribute :id
|
33
39
|
attribute :name
|
34
40
|
end
|
35
41
|
|
36
42
|
module CustomModule; end
|
37
43
|
class CustomModule::Car < MotionPrime::BaseModel
|
44
|
+
attribute :id
|
38
45
|
attribute :name
|
39
46
|
attribute :created_at
|
40
47
|
end
|
data/travis.sh
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-prime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Haziev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- Gemfile
|
179
179
|
- Gemfile.lock
|
180
180
|
- README.md
|
181
|
+
- ROADMAP.md
|
181
182
|
- Rakefile
|
182
183
|
- app/app_delegate.rb
|
183
184
|
- bin/prime
|
@@ -209,6 +210,7 @@ files:
|
|
209
210
|
- motion-prime/config/base.rb
|
210
211
|
- motion-prime/config/config.rb
|
211
212
|
- motion-prime/core_ext/kernel.rb
|
213
|
+
- motion-prime/elements/_content_padding_mixin.rb
|
212
214
|
- motion-prime/elements/_field_dimensions_mixin.rb
|
213
215
|
- motion-prime/elements/_text_dimensions_mixin.rb
|
214
216
|
- motion-prime/elements/base.rb
|
@@ -243,10 +245,11 @@ files:
|
|
243
245
|
- motion-prime/mp.rb
|
244
246
|
- motion-prime/screens/_aliases_mixin.rb
|
245
247
|
- motion-prime/screens/_base_mixin.rb
|
246
|
-
- motion-prime/screens/_navigation_bar_mixin.rb
|
247
248
|
- motion-prime/screens/_navigation_mixin.rb
|
248
249
|
- motion-prime/screens/_orientations_mixin.rb
|
249
250
|
- motion-prime/screens/base_screen.rb
|
251
|
+
- motion-prime/screens/extensions/_indicators_mixin.rb
|
252
|
+
- motion-prime/screens/extensions/_navigation_bar_mixin.rb
|
250
253
|
- motion-prime/screens/sidebar_container_screen.rb
|
251
254
|
- motion-prime/sections/base.rb
|
252
255
|
- motion-prime/sections/draw.rb
|
@@ -268,12 +271,14 @@ files:
|
|
268
271
|
- motion-prime/styles/base.rb
|
269
272
|
- motion-prime/styles/form.rb
|
270
273
|
- motion-prime/support/_key_value_store.rb
|
274
|
+
- motion-prime/support/_padding_attribute.rb
|
271
275
|
- motion-prime/support/dm_button.rb
|
272
276
|
- motion-prime/support/dm_cell_with_section.rb
|
273
277
|
- motion-prime/support/dm_text_field.rb
|
274
278
|
- motion-prime/support/dm_text_view.rb
|
275
279
|
- motion-prime/support/dm_view_controller.rb
|
276
280
|
- motion-prime/support/dm_view_with_section.rb
|
281
|
+
- motion-prime/support/mp_label.rb
|
277
282
|
- motion-prime/support/navigation_controller.rb
|
278
283
|
- motion-prime/support/ui_search_bar_custom.rb
|
279
284
|
- motion-prime/support/ui_view.rb
|