motion-prime 0.7.1 → 0.7.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 +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -4
- data/ROADMAP.md +3 -0
- data/files/Gemfile +1 -1
- data/motion-prime/api_client.rb +2 -0
- data/motion-prime/elements/web_view.rb +12 -0
- data/motion-prime/models/_sync_mixin.rb +1 -1
- data/motion-prime/screens/_base_mixin.rb +2 -0
- data/motion-prime/screens/_sections_mixin.rb +57 -0
- data/motion-prime/screens/screen.rb +2 -0
- data/motion-prime/sections/table.rb +1 -1
- data/motion-prime/styles/form.rb +1 -2
- data/motion-prime/support/mp_spinner.rb +1 -1
- data/motion-prime/version.rb +1 -1
- data/motion-prime/views/_frame_calculator_mixin.rb +12 -4
- data/motion-prime/views/view_builder.rb +5 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDk3ZTI2ODAzMjJjMmRlMTRlMDUyZjY5YTZkNjM0MWY0N2ExM2E3MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGRmNjY2MGU2ODE4MThhNTVhYzc4NTQ0YzA0NjI2NDNlMTdiN2E0Mw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTA5NmMwMDhkN2U0OGZhZjgxYzJlOTQ4MTY1ZTYyZTNmNzM1NTM5MTVlZjY4
|
10
|
+
NjJmMjgxYjg4NTk0ZDRiNjEwODg5YjJmNzliZGZhNDIyMWQyZjNhYjY1ZTFj
|
11
|
+
NzQ5ZmRmNmQyMDZiY2NiZDA2ODMxNWYxNDVjOGZlNWQxMjBlNDY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmJmNWQxNDFjM2RhZTQwZTMyNWRiYzJjYTFkNDIyNjg4Nzg3ZTVhOTQxZDYy
|
14
|
+
ZTg5MDYwMDA4YzViZGIwOTJmNDMyYjA5MDNlZTJmMzg3MTg1MDcxZDUwZDkw
|
15
|
+
MDFjYWIxOWEzNWNlMmZlZjgwMTk2MmZiMmY3ZTFiZjdjZmNhYWY=
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -42,10 +42,7 @@ MotionPrime is yet another framework written on RubyMotion for creating really f
|
|
42
42
|
class MainScreen < Prime::Screen
|
43
43
|
title 'Main screen'
|
44
44
|
|
45
|
-
|
46
|
-
@main_section = MyProfileSection.new(screen: self)
|
47
|
-
@main_section.render
|
48
|
-
end
|
45
|
+
section :my_profile
|
49
46
|
end
|
50
47
|
|
51
48
|
# app/sections/my_profile.rb
|
data/ROADMAP.md
CHANGED
@@ -4,14 +4,17 @@
|
|
4
4
|
* rename submit element in submit field to button element
|
5
5
|
* rename date_picker element in date_picker field to input element
|
6
6
|
* add more and better default options for fields
|
7
|
+
* Rename model to data in sections.
|
7
8
|
|
8
9
|
=== 0.9.0
|
9
10
|
* bug: if mp label do not have text and was set as hidden, it should unhide after setting text
|
11
|
+
* bug: size_to_fit works incorrect with relative width.
|
10
12
|
* add cleanup for section events
|
11
13
|
* add dsl for push notifications
|
12
14
|
* add some extensions/middleware system, at least for networking.
|
13
15
|
* create "display_network_error" extension.
|
14
16
|
* add different templates. some templates should be more like final app.
|
17
|
+
* add size_to_fit support for images.
|
15
18
|
|
16
19
|
=== 1.0.0
|
17
20
|
* add sections/screens/models generator
|
data/files/Gemfile
CHANGED
data/motion-prime/api_client.rb
CHANGED
@@ -68,6 +68,8 @@ class ApiClient
|
|
68
68
|
# handle progress
|
69
69
|
elsif !response.success? && options[:allow_queue] && config.allow_queue?
|
70
70
|
add_to_queue(method: method, path: path, params: params)
|
71
|
+
elsif response.operation.response.nil?
|
72
|
+
block.call if use_callback
|
71
73
|
else
|
72
74
|
block.call(prepared_object(response.object), response.operation.response.statusCode) if use_callback
|
73
75
|
process_queue
|
@@ -244,7 +244,7 @@ module MotionPrime
|
|
244
244
|
def fetch_has_many_with_attributes(key, data, sync_options = {})
|
245
245
|
old_collection = self.send(key)
|
246
246
|
model_class = key.classify.constantize
|
247
|
-
self.store.save_interval = data.count
|
247
|
+
self.store.save_interval = data.present? ? data.count : 1
|
248
248
|
# Update/Create existing records
|
249
249
|
track_changed_attributes do
|
250
250
|
data.each do |attributes|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
motion_require "./_aliases_mixin"
|
2
2
|
motion_require "./_orientations_mixin"
|
3
3
|
motion_require "./_navigation_mixin"
|
4
|
+
motion_require "./_sections_mixin"
|
4
5
|
module MotionPrime
|
5
6
|
module ScreenBaseMixin
|
6
7
|
extend ::MotionSupport::Concern
|
@@ -9,6 +10,7 @@ module MotionPrime
|
|
9
10
|
include MotionPrime::ScreenAliasesMixin
|
10
11
|
include MotionPrime::ScreenOrientationsMixin
|
11
12
|
include MotionPrime::ScreenNavigationMixin
|
13
|
+
include MotionPrime::ScreenSectionsMixin
|
12
14
|
|
13
15
|
attr_accessor :parent_screen, :modal, :params, :main_section, :options, :tab_bar
|
14
16
|
class_attribute :current_screen
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module MotionPrime
|
2
|
+
module ScreenSectionsMixin
|
3
|
+
extend ::MotionSupport::Concern
|
4
|
+
|
5
|
+
include HasClassFactory
|
6
|
+
include HasNormalizer
|
7
|
+
|
8
|
+
def self.included(base)
|
9
|
+
base.class_attribute :_section_options
|
10
|
+
end
|
11
|
+
|
12
|
+
def add_sections
|
13
|
+
create_sections
|
14
|
+
render_sections
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_sections
|
18
|
+
section_options = self.class._section_options
|
19
|
+
return unless section_options
|
20
|
+
@sections = {}
|
21
|
+
section_options.map do |name, options|
|
22
|
+
@sections[name] = create_section(options.clone)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_section(options)
|
27
|
+
section_class = class_factory("#{options.delete(:name)}_section")
|
28
|
+
options = normalize_options(options).merge(screen: self)
|
29
|
+
section_class.new(options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def render_sections
|
33
|
+
return unless @sections
|
34
|
+
if @sections.count > 1
|
35
|
+
@main_section = MotionPrime::TableSection.new(model: @sections.values, screen: self)
|
36
|
+
@main_section.render
|
37
|
+
else
|
38
|
+
@sections.first.render
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def main_section
|
43
|
+
@main_section || @sections.first
|
44
|
+
end
|
45
|
+
|
46
|
+
module ClassMethods
|
47
|
+
def section(name, options = {})
|
48
|
+
self._section_options ||= {}
|
49
|
+
self._section_options[name.to_sym] = options.merge(name: name)
|
50
|
+
|
51
|
+
define_method name do
|
52
|
+
@sections[name]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/motion-prime/styles/form.rb
CHANGED
@@ -69,9 +69,8 @@ MotionPrime::Styles.define :base_form do
|
|
69
69
|
right: 0,
|
70
70
|
top: 30,
|
71
71
|
height: 35,
|
72
|
-
title_color: 0x16759a,
|
73
72
|
title_shadow_color: :white,
|
74
|
-
|
73
|
+
content_horizontal_alignment: :left,
|
75
74
|
layer: {
|
76
75
|
border_color: :gray,
|
77
76
|
border_width: 1
|
@@ -2,7 +2,7 @@ class MPSpinner < MBRoundProgressView
|
|
2
2
|
def init_animation
|
3
3
|
return if @firstTimestamp
|
4
4
|
displayLink = CADisplayLink.displayLinkWithTarget(self, selector: :"handleDisplayLink:")
|
5
|
-
displayLink.addToRunLoop(NSRunLoop.currentRunLoop, forMode:NSDefaultRunLoopMode)
|
5
|
+
displayLink.addToRunLoop(NSRunLoop.currentRunLoop, forMode: NSDefaultRunLoopMode)
|
6
6
|
end
|
7
7
|
|
8
8
|
def handleDisplayLink(displayLink)
|
data/motion-prime/version.rb
CHANGED
@@ -21,18 +21,26 @@ module MotionPrime
|
|
21
21
|
width = 0.0 if width.nil?
|
22
22
|
height = 0.0 if height.nil?
|
23
23
|
|
24
|
+
if left && left > 0 && left <= 1 && value_type != 'absolute' && left.is_a?(Float)
|
25
|
+
left = max_width * left
|
26
|
+
end
|
27
|
+
|
28
|
+
if right && right > 0 && right <= 1 && value_type != 'absolute' && right.is_a?(Float)
|
29
|
+
right = max_width * right
|
30
|
+
end
|
31
|
+
|
24
32
|
# calculate left and right if width is relative, e.g 0.7
|
25
|
-
if width && width > 0 && width <= 1 && value_type != 'absolute'
|
33
|
+
if width && width > 0 && width <= 1 && value_type != 'absolute' && width.is_a?(Float)
|
26
34
|
if right.nil?
|
27
35
|
left ||= 0
|
28
|
-
right = max_width - max_width * width
|
36
|
+
right = max_width - max_width * width - left
|
29
37
|
else
|
30
|
-
left = max_width - max_width * width
|
38
|
+
left = max_width - max_width * width - right
|
31
39
|
end
|
32
40
|
end
|
33
41
|
|
34
42
|
# calculate top and bottom if height is relative, e.g 0.7
|
35
|
-
if height && height > 0 && height <= 1 && value_type != 'absolute'
|
43
|
+
if height && height > 0 && height <= 1 && value_type != 'absolute' && width.is_a?(Float)
|
36
44
|
if bottom.nil?
|
37
45
|
top ||= 0
|
38
46
|
bottom = max_height - max_height * height
|
@@ -120,7 +120,11 @@ module MotionPrime
|
|
120
120
|
'UIWebView' => Proc.new{|klass, options|
|
121
121
|
web_view = klass.alloc.initWithFrame CGRectZero
|
122
122
|
if delegate = options.delete(:delegate)
|
123
|
-
|
123
|
+
if delegate == :section
|
124
|
+
web_view.setDelegate options[:section].strong_ref
|
125
|
+
else
|
126
|
+
web_view.setDelegate delegate
|
127
|
+
end
|
124
128
|
end
|
125
129
|
if url = options.delete(:url)
|
126
130
|
request = NSURLRequest.requestWithURL url.nsurl
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-prime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Haziev
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -279,6 +279,7 @@ files:
|
|
279
279
|
- motion-prime/elements/text_field.rb
|
280
280
|
- motion-prime/elements/text_view.rb
|
281
281
|
- motion-prime/elements/view_with_section.rb
|
282
|
+
- motion-prime/elements/web_view.rb
|
282
283
|
- motion-prime/env.rb
|
283
284
|
- motion-prime/helpers/has_authorization.rb
|
284
285
|
- motion-prime/helpers/has_class_factory.rb
|
@@ -304,6 +305,7 @@ files:
|
|
304
305
|
- motion-prime/screens/_base_mixin.rb
|
305
306
|
- motion-prime/screens/_navigation_mixin.rb
|
306
307
|
- motion-prime/screens/_orientations_mixin.rb
|
308
|
+
- motion-prime/screens/_sections_mixin.rb
|
307
309
|
- motion-prime/screens/extensions/_indicators_mixin.rb
|
308
310
|
- motion-prime/screens/extensions/_navigation_bar_mixin.rb
|
309
311
|
- motion-prime/screens/screen.rb
|