ProMotion 1.1.2 → 1.2.0
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 +4 -4
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +1 -0
- data/ProMotion.gemspec +14 -14
- data/README.md +26 -46
- data/Rakefile +13 -8
- data/lib/ProMotion.rb +2 -12
- data/lib/ProMotion/cocoatouch/navigation_controller.rb +11 -11
- data/lib/ProMotion/cocoatouch/split_view_controller.rb +4 -4
- data/lib/ProMotion/cocoatouch/tab_bar_controller.rb +5 -5
- data/lib/ProMotion/cocoatouch/table_view_cell.rb +2 -0
- data/lib/ProMotion/containers/split_screen.rb +4 -0
- data/lib/ProMotion/containers/tabs.rb +10 -8
- data/lib/ProMotion/delegate/delegate.rb +3 -0
- data/lib/ProMotion/delegate/delegate_module.rb +5 -0
- data/lib/ProMotion/extensions/conversions.rb +4 -4
- data/lib/ProMotion/map/map_screen.rb +4 -0
- data/lib/ProMotion/map/map_screen_module.rb +1 -1
- data/lib/ProMotion/screen/screen.rb +3 -0
- data/lib/ProMotion/screen/screen_module.rb +25 -1
- data/lib/ProMotion/screen/screen_navigation.rb +3 -3
- data/lib/ProMotion/table/cell/table_view_cell_module.rb +19 -3
- data/lib/ProMotion/table/grouped_table_screen.rb +5 -0
- data/lib/ProMotion/table/table.rb +5 -0
- data/lib/ProMotion/table/table_screen.rb +4 -0
- data/lib/ProMotion/version.rb +1 -1
- data/lib/ProMotion/view/styling.rb +22 -9
- data/lib/ProMotion/web/web_screen.rb +4 -0
- data/lib/ProMotion/web/web_screen_module.rb +1 -1
- data/spec/functional/func_image_title_screen.rb +20 -0
- data/spec/functional/func_image_view_title_screen.rb +20 -0
- data/spec/functional/func_screen_spec.rb +4 -0
- data/spec/functional/func_split_screen_spec.rb +7 -0
- data/spec/functional/func_view_title_screen.rb +21 -0
- data/spec/functional/func_web_screen_spec.rb +3 -3
- data/spec/helpers/image_title_screen.rb +15 -0
- data/spec/helpers/image_view_title_screen.rb +15 -0
- data/spec/helpers/map_screen.rb +4 -2
- data/spec/helpers/view_title_screen.rb +15 -0
- data/spec/helpers/web_screen.rb +7 -6
- data/spec/unit/map_spec.rb +10 -9
- data/spec/unit/screen_helpers_spec.rb +11 -7
- data/spec/unit/tables/table_module_spec.rb +1 -1
- data/spec/unit/view_helper_spec.rb +23 -6
- data/spec/unit/web_spec.rb +5 -5
- metadata +56 -47
- data/lib/ProMotion/thirdparty/formotion_screen.rb +0 -92
- data/spec/helpers/table_screen_formotion.rb +0 -50
- data/spec/unit/tables/formotion_screen_spec.rb +0 -37
@@ -1,92 +0,0 @@
|
|
1
|
-
module ProMotion
|
2
|
-
if defined?(Formotion) && defined?(Formotion::FormController)
|
3
|
-
class FormotionScreen < Formotion::FormController
|
4
|
-
include ProMotion::ScreenModule
|
5
|
-
|
6
|
-
def self.new(args = {})
|
7
|
-
s = self.alloc.initWithStyle(UITableViewStyleGrouped)
|
8
|
-
s.on_create(args) if s.respond_to?(:on_create)
|
9
|
-
|
10
|
-
if s.respond_to?(:table_data)
|
11
|
-
s.form = s.table_data
|
12
|
-
elsif args[:form]
|
13
|
-
s.form = args[:form]
|
14
|
-
else
|
15
|
-
PM.logger.error "PM::FormotionScreen requires a `table_data` method or form: to be passed into `new`."
|
16
|
-
end
|
17
|
-
|
18
|
-
t = s.title # Formotion kills the title when you request tableView.
|
19
|
-
s.tableView.allowsSelectionDuringEditing = true
|
20
|
-
s.title = t
|
21
|
-
|
22
|
-
s.bind_submit
|
23
|
-
|
24
|
-
s
|
25
|
-
end
|
26
|
-
|
27
|
-
def bind_submit
|
28
|
-
self.form.on_submit { |form| self.on_submit(form) if self.respond_to?(:on_submit) }
|
29
|
-
end
|
30
|
-
|
31
|
-
# emulate the ProMotion table update for formotion
|
32
|
-
def update_table_data
|
33
|
-
self.form = table_data
|
34
|
-
self.form.controller = self
|
35
|
-
self.tableView.reloadData
|
36
|
-
self.bind_submit
|
37
|
-
end
|
38
|
-
|
39
|
-
def screen_setup
|
40
|
-
self.title = self.class.send(:get_title)
|
41
|
-
end
|
42
|
-
|
43
|
-
def loadView
|
44
|
-
super
|
45
|
-
self.send(:on_load) if self.respond_to?(:on_load)
|
46
|
-
end
|
47
|
-
|
48
|
-
def viewDidLoad
|
49
|
-
super
|
50
|
-
self.view_did_load if self.respond_to?(:view_did_load)
|
51
|
-
end
|
52
|
-
|
53
|
-
def viewWillAppear(animated)
|
54
|
-
super
|
55
|
-
self.view_will_appear(animated) if self.respond_to?("view_will_appear:")
|
56
|
-
end
|
57
|
-
|
58
|
-
def viewDidAppear(animated)
|
59
|
-
super
|
60
|
-
self.view_did_appear(animated) if self.respond_to?("view_did_appear:")
|
61
|
-
end
|
62
|
-
|
63
|
-
def viewWillDisappear(animated)
|
64
|
-
self.view_will_disappear(animated) if self.respond_to?("view_will_disappear:")
|
65
|
-
super
|
66
|
-
end
|
67
|
-
|
68
|
-
def viewDidDisappear(animated)
|
69
|
-
if self.respond_to?("view_did_disappear:")
|
70
|
-
self.view_did_disappear(animated)
|
71
|
-
end
|
72
|
-
super
|
73
|
-
end
|
74
|
-
|
75
|
-
def shouldAutorotateToInterfaceOrientation(orientation)
|
76
|
-
self.should_rotate(orientation)
|
77
|
-
end
|
78
|
-
|
79
|
-
def shouldAutorotate
|
80
|
-
self.should_autorotate
|
81
|
-
end
|
82
|
-
|
83
|
-
def willRotateToInterfaceOrientation(orientation, duration:duration)
|
84
|
-
self.will_rotate(orientation, duration)
|
85
|
-
end
|
86
|
-
|
87
|
-
def didRotateFromInterfaceOrientation(orientation)
|
88
|
-
self.on_rotate
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
class TestFormotionScreen < PM::FormotionScreen
|
2
|
-
attr_accessor :submitted_form
|
3
|
-
|
4
|
-
title "Formotion Test"
|
5
|
-
|
6
|
-
def table_data
|
7
|
-
@table_data ||= {
|
8
|
-
sections: [{
|
9
|
-
title: "Currency",
|
10
|
-
key: :currency,
|
11
|
-
select_one: true,
|
12
|
-
rows: [{
|
13
|
-
title: "EUR",
|
14
|
-
key: :eur,
|
15
|
-
value: true,
|
16
|
-
type: :check
|
17
|
-
}, {
|
18
|
-
title: "USD",
|
19
|
-
key: :usd,
|
20
|
-
type: :check
|
21
|
-
}]
|
22
|
-
}]
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def on_submit(form)
|
27
|
-
self.submitted_form = form
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_update_table_data
|
31
|
-
@table_data = {
|
32
|
-
sections: [{
|
33
|
-
title: "Updated Data",
|
34
|
-
key: :currency,
|
35
|
-
select_one: true,
|
36
|
-
rows: [{
|
37
|
-
title: "EUR",
|
38
|
-
key: :eur,
|
39
|
-
value: true,
|
40
|
-
type: :check
|
41
|
-
}, {
|
42
|
-
title: "USD",
|
43
|
-
key: :usd,
|
44
|
-
type: :check
|
45
|
-
}]
|
46
|
-
}]
|
47
|
-
}
|
48
|
-
update_table_data
|
49
|
-
end
|
50
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
describe "PM::FormotionScreen" do
|
2
|
-
|
3
|
-
before do
|
4
|
-
@screen = TestFormotionScreen.new
|
5
|
-
end
|
6
|
-
|
7
|
-
it "should store title" do
|
8
|
-
TestFormotionScreen.get_title.should == 'Formotion Test'
|
9
|
-
@screen.class.get_title.should == "Formotion Test"
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should set default title on new instances" do
|
13
|
-
@screen.title.should == "Formotion Test"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should fire the on_submit method when form is submitted" do
|
17
|
-
@screen.form.submit
|
18
|
-
@screen.submitted_form.should.not.be.nil
|
19
|
-
@screen.submitted_form.render.should.be.kind_of(Hash)
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "After update_table_data" do
|
23
|
-
before do
|
24
|
-
@screen.test_update_table_data
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should update the table data" do
|
28
|
-
@screen.table_data[:sections][0][:title].should == "Updated Data"
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should fire the on_submit method when form is submitted" do
|
32
|
-
@screen.form.submit
|
33
|
-
@screen.submitted_form.should.not.be.nil
|
34
|
-
@screen.submitted_form.render.should.be.kind_of(Hash)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|