teacup 1.3.0 → 1.3.1
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.
data/README.md
CHANGED
@@ -3,9 +3,6 @@ Teacup
|
|
3
3
|
|
4
4
|
A community-driven DSL for creating user interfaces on the iphone.
|
5
5
|
|
6
|
-
**Note: for a yet-unknown reason teacup does not compile correctly using ruby
|
7
|
-
2.0. Use 1.9.3 instead please, or help determine what is wrong with 2.0.**
|
8
|
-
|
9
6
|
Using teacup, you can easily create and style layouts while keeping your code
|
10
7
|
dry. The goal is to offer a rubyesque (well, actually a rubymotion-esque) way
|
11
8
|
to create interfaces programmatically.
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class PresentModalController < UIViewController
|
2
|
+
attr :modal
|
2
3
|
|
3
4
|
stylesheet :present_modal
|
4
5
|
|
@@ -8,23 +9,8 @@ class PresentModalController < UIViewController
|
|
8
9
|
end
|
9
10
|
|
10
11
|
def open_modal_button
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
class PresentedController < UIViewController
|
17
|
-
|
18
|
-
stylesheet :present_modal
|
19
|
-
|
20
|
-
layout :root do
|
21
|
-
subview(UIView, :header)
|
22
|
-
subview(UIView, :footer)
|
23
|
-
subview(UIView, :center) do
|
24
|
-
$left = subview(UIView, :left)
|
25
|
-
$top_right = subview(UIView, :top_right)
|
26
|
-
$btm_right = subview(UIView, :btm_right)
|
27
|
-
end
|
12
|
+
@modal = ConstraintsController.new
|
13
|
+
self.presentViewController(@modal, animated:true, completion:nil)
|
28
14
|
end
|
29
15
|
|
30
16
|
end
|
@@ -41,56 +27,4 @@ Teacup::Stylesheet.new :present_modal do
|
|
41
27
|
:centered
|
42
28
|
]
|
43
29
|
|
44
|
-
style :header,
|
45
|
-
backgroundColor: UIColor.blueColor,
|
46
|
-
constraints: [
|
47
|
-
:full_width,
|
48
|
-
:top,
|
49
|
-
constrain_height(52),
|
50
|
-
]
|
51
|
-
|
52
|
-
style :footer,
|
53
|
-
backgroundColor: UIColor.magentaColor,
|
54
|
-
constraints: [
|
55
|
-
:full_width,
|
56
|
-
:bottom,
|
57
|
-
constrain_height(52),
|
58
|
-
]
|
59
|
-
|
60
|
-
style :center,
|
61
|
-
backgroundColor: UIColor.lightGrayColor,
|
62
|
-
constraints: [
|
63
|
-
constrain_below(:header).plus(8),
|
64
|
-
constrain_above(:footer).minus(8),
|
65
|
-
constrain_left(8),
|
66
|
-
constrain_right(-8),
|
67
|
-
]
|
68
|
-
|
69
|
-
style :left,
|
70
|
-
backgroundColor: UIColor.redColor,
|
71
|
-
constraints: [
|
72
|
-
constrain_left(8),
|
73
|
-
constrain_top(8),
|
74
|
-
constrain(:right).plus(8).equals(:top_right, :left),
|
75
|
-
constrain(:right).plus(8).equals(:btm_right, :left),
|
76
|
-
constrain_bottom(-8),
|
77
|
-
constrain(:width).equals(:top_right, :width),
|
78
|
-
constrain(:width).equals(:btm_right, :width),
|
79
|
-
]
|
80
|
-
|
81
|
-
style :top_right,
|
82
|
-
backgroundColor: UIColor.greenColor,
|
83
|
-
constraints: [
|
84
|
-
constrain(:top).equals(:left, :top),
|
85
|
-
constrain_right(-8),
|
86
|
-
constrain(:height).equals(:btm_right, :height),
|
87
|
-
constrain(:bottom).plus(8).equals(:btm_right, :top),
|
88
|
-
]
|
89
|
-
|
90
|
-
style :btm_right,
|
91
|
-
backgroundColor: UIColor.yellowColor,
|
92
|
-
constraints: [
|
93
|
-
constrain(:bottom).equals(:left, :bottom),
|
94
|
-
]
|
95
|
-
|
96
30
|
end
|
data/lib/teacup/version.rb
CHANGED
@@ -256,13 +256,8 @@ class UIViewController
|
|
256
256
|
end
|
257
257
|
|
258
258
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
[target] + target.subviews.map { |subview|
|
264
|
-
get_subviews(subview).select{ |v| v.stylename }
|
265
|
-
}.flatten
|
266
|
-
end
|
267
|
-
|
259
|
+
def Teacup.get_subviews(target)
|
260
|
+
[target] + target.subviews.map { |subview|
|
261
|
+
get_subviews(subview).select{ |v| v.stylename }
|
262
|
+
}.flatten
|
268
263
|
end
|
data/spec/styling_modal_spec.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
describe 'Styling a modal view' do
|
2
2
|
tests PresentModalController
|
3
3
|
|
4
|
-
it 'should
|
4
|
+
it 'should work' do
|
5
5
|
tap 'Open Modal'
|
6
|
-
|
7
|
-
1.should == 1
|
8
|
-
}
|
6
|
+
@controller.modal.view.backgroundColor.should == UIColor.blackColor
|
9
7
|
end
|
10
8
|
|
11
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teacup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'Teacup is a community-driven DSL for making CSS-like styling, and
|
15
15
|
layouts for
|