upjs-rails 0.11.1 → 0.12.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/CHANGELOG.md +50 -0
- data/dist/up-bootstrap.js +9 -17
- data/dist/up-bootstrap.min.js +1 -1
- data/dist/up.js +384 -458
- data/dist/up.min.js +2 -2
- data/lib/assets/javascripts/up/boot.js.coffee +2 -2
- data/lib/assets/javascripts/up/browser.js.coffee +2 -2
- data/lib/assets/javascripts/up/bus.js.coffee +39 -88
- data/lib/assets/javascripts/up/flow.js.coffee +25 -33
- data/lib/assets/javascripts/up/form.js.coffee +2 -2
- data/lib/assets/javascripts/up/history.js.coffee +8 -7
- data/lib/assets/javascripts/up/layout.js.coffee +19 -18
- data/lib/assets/javascripts/up/link.js.coffee +2 -2
- data/lib/assets/javascripts/up/magic.js.coffee +41 -27
- data/lib/assets/javascripts/up/modal.js.coffee +74 -57
- data/lib/assets/javascripts/up/motion.js.coffee +11 -10
- data/lib/assets/javascripts/up/navigation.js.coffee +11 -10
- data/lib/assets/javascripts/up/popup.js.coffee +19 -16
- data/lib/assets/javascripts/up/proxy.js.coffee +17 -16
- data/lib/assets/javascripts/up/tooltip.js.coffee +28 -14
- data/lib/assets/javascripts/up/util.js.coffee +14 -22
- data/lib/assets/javascripts/up-bootstrap/layout-ext.js.coffee +5 -6
- data/lib/assets/javascripts/up-bootstrap/modal-ext.js.coffee +8 -8
- data/lib/assets/javascripts/up-bootstrap/navigation-ext.js.coffee +2 -5
- data/lib/assets/javascripts/up.js.coffee +0 -1
- data/lib/upjs/rails/version.rb +1 -1
- data/spec_app/Gemfile.lock +1 -1
- data/spec_app/spec/javascripts/up/bus_spec.js.coffee +43 -6
- data/spec_app/spec/javascripts/up/flow_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/history_spec.js.coffee +3 -3
- data/spec_app/spec/javascripts/up/layout_spec.js.coffee +9 -11
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +7 -9
- data/spec_app/spec/javascripts/up/magic_spec.js.coffee +5 -5
- data/spec_app/spec/javascripts/up/modal_spec.js.coffee +8 -10
- data/spec_app/spec/javascripts/up/navigation_spec.js.coffee +13 -13
- data/spec_app/spec/javascripts/up/popup_spec.js.coffee +1 -5
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +51 -52
- data/spec_app/spec/javascripts/up/tooltip_spec.js.coffee +19 -5
- data/spec_app/spec/javascripts/up/util_spec.js.coffee +14 -23
- metadata +1 -3
- data/lib/assets/javascripts/up/slot.js.coffee +0 -63
- data/spec_app/spec/javascripts/up/slot_spec.js.coffee +0 -16
@@ -1,18 +1,14 @@
|
|
1
1
|
describe 'up.modal', ->
|
2
2
|
|
3
3
|
describe 'Javascript functions', ->
|
4
|
-
|
5
|
-
describe 'up.modal.defaults', ->
|
6
|
-
|
7
|
-
it 'should have tests'
|
8
|
-
|
9
|
-
describe 'up.modal.open', ->
|
10
4
|
|
11
|
-
|
5
|
+
assumedScrollbarWidth = 15
|
6
|
+
|
7
|
+
describe 'up.modal.follow', ->
|
12
8
|
|
13
9
|
it "loads the given link's destination in a dialog window", (done) ->
|
14
10
|
$link = affix('a[href="/path/to"][up-modal=".middle"]').text('link')
|
15
|
-
promise = up.modal.
|
11
|
+
promise = up.modal.follow($link)
|
16
12
|
request = @lastRequest()
|
17
13
|
expect(request.url).toMatch /\/path\/to$/
|
18
14
|
request.respondWith
|
@@ -33,8 +29,10 @@ describe 'up.modal', ->
|
|
33
29
|
expect($('.up-modal-dialog .after')).not.toExist()
|
34
30
|
done()
|
35
31
|
|
32
|
+
describe 'up.modal.visit', ->
|
33
|
+
|
36
34
|
it "brings its own scrollbar, padding the body on the right in order to prevent jumping", (done) ->
|
37
|
-
promise = up.modal.
|
35
|
+
promise = up.modal.visit('/foo', target: '.container')
|
38
36
|
|
39
37
|
@lastRequest().respondWith
|
40
38
|
status: 200
|
@@ -66,7 +64,7 @@ describe 'up.modal', ->
|
|
66
64
|
top: '0'
|
67
65
|
right: '30px'
|
68
66
|
|
69
|
-
promise = up.modal.
|
67
|
+
promise = up.modal.visit('/foo', target: '.container')
|
70
68
|
|
71
69
|
@lastRequest().respondWith
|
72
70
|
status: 200
|
@@ -4,44 +4,44 @@ describe 'up.navigation', ->
|
|
4
4
|
|
5
5
|
it 'marks a link as .up-current if it links to the current URL', ->
|
6
6
|
spyOn(up.browser, 'url').and.returnValue('/foo')
|
7
|
-
$currentLink = up.
|
8
|
-
$otherLink = up.
|
7
|
+
$currentLink = up.hello(affix('a[href="/foo"]'))
|
8
|
+
$otherLink = up.hello(affix('a[href="/bar"]'))
|
9
9
|
expect($currentLink).toHaveClass('up-current')
|
10
10
|
expect($otherLink).not.toHaveClass('up-current')
|
11
11
|
|
12
12
|
it 'marks any link as .up-current if its up-href attribute matches the current URL', ->
|
13
13
|
spyOn(up.browser, 'url').and.returnValue('/foo')
|
14
|
-
$currentLink = up.
|
15
|
-
$otherLink = up.
|
14
|
+
$currentLink = up.hello(affix('span[up-href="/foo"]'))
|
15
|
+
$otherLink = up.hello(affix('span[up-href="/bar"]'))
|
16
16
|
expect($currentLink).toHaveClass('up-current')
|
17
17
|
expect($otherLink).not.toHaveClass('up-current')
|
18
18
|
|
19
19
|
it 'marks any link as .up-current if any of its space-separated up-alias values matches the current URL', ->
|
20
20
|
spyOn(up.browser, 'url').and.returnValue('/foo')
|
21
|
-
$currentLink = up.
|
22
|
-
$otherLink = up.
|
21
|
+
$currentLink = up.hello(affix('span[up-alias="/aaa /foo /bbb"]'))
|
22
|
+
$otherLink = up.hello(affix('span[up-alias="/bar"]'))
|
23
23
|
expect($currentLink).toHaveClass('up-current')
|
24
24
|
expect($otherLink).not.toHaveClass('up-current')
|
25
25
|
|
26
26
|
it 'does not throw if the current location does not match an up-alias wildcard (bugfix)', ->
|
27
|
-
inserter = -> up.
|
27
|
+
inserter = -> up.hello(affix('a[up-alias="/qqqq*"]'))
|
28
28
|
expect(inserter).not.toThrow()
|
29
29
|
|
30
30
|
it 'does not highlight a link to "#" (commonly used for JS-only buttons)', ->
|
31
|
-
$link = up.
|
31
|
+
$link = up.hello(affix('a[href="#"]'))
|
32
32
|
expect($link).not.toHaveClass('up-current')
|
33
33
|
|
34
34
|
it 'marks URL prefixes as .up-current if an up-alias value ends in *', ->
|
35
35
|
spyOn(up.browser, 'url').and.returnValue('/foo/123')
|
36
|
-
$currentLink = up.
|
37
|
-
$otherLink = up.
|
36
|
+
$currentLink = up.hello(affix('span[up-alias="/aaa /foo/* /bbb"]'))
|
37
|
+
$otherLink = up.hello(affix('span[up-alias="/bar"]'))
|
38
38
|
expect($currentLink).toHaveClass('up-current')
|
39
39
|
expect($otherLink).not.toHaveClass('up-current')
|
40
40
|
|
41
41
|
it 'allows to configure a custom "current" class, but always also sets .up-current', ->
|
42
|
-
up.navigation.
|
42
|
+
up.navigation.config.currentClasses = ['highlight']
|
43
43
|
spyOn(up.browser, 'url').and.returnValue('/foo')
|
44
|
-
$currentLink = up.
|
44
|
+
$currentLink = up.hello(affix('a[href="/foo"]'))
|
45
45
|
expect($currentLink).toHaveClass('highlight up-current')
|
46
46
|
|
47
47
|
if up.browser.canPushState()
|
@@ -101,7 +101,7 @@ describe 'up.navigation', ->
|
|
101
101
|
|
102
102
|
it 'prefers to mark an enclosing [up-expand] click area', ->
|
103
103
|
$area = affix('div[up-expand] a[href="/foo"][up-target=".main"]')
|
104
|
-
up.
|
104
|
+
up.hello($area)
|
105
105
|
$link = $area.find('a')
|
106
106
|
affix('.main')
|
107
107
|
$link.click()
|
@@ -104,27 +104,27 @@ describe 'up.proxy', ->
|
|
104
104
|
describe 'events', ->
|
105
105
|
|
106
106
|
beforeEach ->
|
107
|
-
up.proxy.
|
107
|
+
up.proxy.config.busyDelay = 0
|
108
108
|
@events = []
|
109
|
-
u.each ['proxy:load', 'proxy:receive', 'proxy:busy', 'proxy:idle'], (eventName) =>
|
110
|
-
up.
|
109
|
+
u.each ['up:proxy:load', 'up:proxy:receive', 'up:proxy:busy', 'up:proxy:idle'], (eventName) =>
|
110
|
+
up.on eventName, =>
|
111
111
|
@events.push eventName
|
112
112
|
|
113
|
-
it 'emits an proxy:busy event once the proxy started loading, and proxy:idle if it is done loading', ->
|
113
|
+
it 'emits an up:proxy:busy event once the proxy started loading, and up:proxy:idle if it is done loading', ->
|
114
114
|
|
115
115
|
up.proxy.ajax(url: '/foo')
|
116
116
|
|
117
117
|
expect(@events).toEqual([
|
118
|
-
'proxy:load',
|
119
|
-
'proxy:busy'
|
118
|
+
'up:proxy:load',
|
119
|
+
'up:proxy:busy'
|
120
120
|
])
|
121
121
|
|
122
122
|
up.proxy.ajax(url: '/bar')
|
123
123
|
|
124
124
|
expect(@events).toEqual([
|
125
|
-
'proxy:load',
|
126
|
-
'proxy:busy',
|
127
|
-
'proxy:load'
|
125
|
+
'up:proxy:load',
|
126
|
+
'up:proxy:busy',
|
127
|
+
'up:proxy:load'
|
128
128
|
])
|
129
129
|
|
130
130
|
jasmine.Ajax.requests.at(0).respondWith
|
@@ -133,10 +133,10 @@ describe 'up.proxy', ->
|
|
133
133
|
responseText: 'foo'
|
134
134
|
|
135
135
|
expect(@events).toEqual([
|
136
|
-
'proxy:load',
|
137
|
-
'proxy:busy',
|
138
|
-
'proxy:load',
|
139
|
-
'proxy:receive'
|
136
|
+
'up:proxy:load',
|
137
|
+
'up:proxy:busy',
|
138
|
+
'up:proxy:load',
|
139
|
+
'up:proxy:receive'
|
140
140
|
])
|
141
141
|
|
142
142
|
jasmine.Ajax.requests.at(1).respondWith
|
@@ -145,29 +145,29 @@ describe 'up.proxy', ->
|
|
145
145
|
responseText: 'bar'
|
146
146
|
|
147
147
|
expect(@events).toEqual([
|
148
|
-
'proxy:load',
|
149
|
-
'proxy:busy',
|
150
|
-
'proxy:load',
|
151
|
-
'proxy:receive',
|
152
|
-
'proxy:receive',
|
153
|
-
'proxy:idle'
|
148
|
+
'up:proxy:load',
|
149
|
+
'up:proxy:busy',
|
150
|
+
'up:proxy:load',
|
151
|
+
'up:proxy:receive',
|
152
|
+
'up:proxy:receive',
|
153
|
+
'up:proxy:idle'
|
154
154
|
])
|
155
155
|
|
156
|
-
it 'does not emit an proxy:busy event if preloading', ->
|
156
|
+
it 'does not emit an up:proxy:busy event if preloading', ->
|
157
157
|
|
158
158
|
# A request for preloading preloading purposes
|
159
159
|
# doesn't make us busy.
|
160
160
|
up.proxy.ajax(url: '/foo', preload: true)
|
161
161
|
expect(@events).toEqual([
|
162
|
-
'proxy:load'
|
162
|
+
'up:proxy:load'
|
163
163
|
])
|
164
164
|
expect(up.proxy.busy()).toBe(false)
|
165
165
|
|
166
166
|
# The same request with preloading does make us busy.
|
167
167
|
up.proxy.ajax(url: '/foo')
|
168
168
|
expect(@events).toEqual([
|
169
|
-
'proxy:load',
|
170
|
-
'proxy:busy'
|
169
|
+
'up:proxy:load',
|
170
|
+
'up:proxy:busy'
|
171
171
|
])
|
172
172
|
expect(up.proxy.busy()).toBe(true)
|
173
173
|
|
@@ -178,31 +178,31 @@ describe 'up.proxy', ->
|
|
178
178
|
contentType: 'text/html'
|
179
179
|
responseText: 'foo'
|
180
180
|
expect(@events).toEqual([
|
181
|
-
'proxy:load',
|
182
|
-
'proxy:busy',
|
183
|
-
'proxy:receive',
|
184
|
-
'proxy:idle'
|
181
|
+
'up:proxy:load',
|
182
|
+
'up:proxy:busy',
|
183
|
+
'up:proxy:receive',
|
184
|
+
'up:proxy:idle'
|
185
185
|
])
|
186
186
|
expect(up.proxy.busy()).toBe(false)
|
187
187
|
|
188
|
-
it 'can delay the proxy:busy event to prevent flickering of spinners', ->
|
188
|
+
it 'can delay the up:proxy:busy event to prevent flickering of spinners', ->
|
189
189
|
jasmine.clock().install()
|
190
|
-
up.proxy.
|
190
|
+
up.proxy.config.busyDelay = 100
|
191
191
|
|
192
192
|
up.proxy.ajax(url: '/foo')
|
193
193
|
expect(@events).toEqual([
|
194
|
-
'proxy:load'
|
194
|
+
'up:proxy:load'
|
195
195
|
])
|
196
196
|
|
197
197
|
jasmine.clock().tick(50)
|
198
198
|
expect(@events).toEqual([
|
199
|
-
'proxy:load'
|
199
|
+
'up:proxy:load'
|
200
200
|
])
|
201
201
|
|
202
202
|
jasmine.clock().tick(50)
|
203
203
|
expect(@events).toEqual([
|
204
|
-
'proxy:load',
|
205
|
-
'proxy:busy'
|
204
|
+
'up:proxy:load',
|
205
|
+
'up:proxy:busy'
|
206
206
|
])
|
207
207
|
|
208
208
|
jasmine.Ajax.requests.at(0).respondWith
|
@@ -211,19 +211,19 @@ describe 'up.proxy', ->
|
|
211
211
|
responseText: 'foo'
|
212
212
|
|
213
213
|
expect(@events).toEqual([
|
214
|
-
'proxy:load',
|
215
|
-
'proxy:busy',
|
216
|
-
'proxy:receive',
|
217
|
-
'proxy:idle'
|
214
|
+
'up:proxy:load',
|
215
|
+
'up:proxy:busy',
|
216
|
+
'up:proxy:receive',
|
217
|
+
'up:proxy:idle'
|
218
218
|
])
|
219
219
|
|
220
|
-
it 'does not emit proxy:idle if a delayed proxy:busy was never emitted due to a fast response', ->
|
220
|
+
it 'does not emit up:proxy:idle if a delayed up:proxy:busy was never emitted due to a fast response', ->
|
221
221
|
jasmine.clock().install()
|
222
|
-
up.proxy.
|
222
|
+
up.proxy.config.busyDelay = 100
|
223
223
|
|
224
224
|
up.proxy.ajax(url: '/foo')
|
225
225
|
expect(@events).toEqual([
|
226
|
-
'proxy:load'
|
226
|
+
'up:proxy:load'
|
227
227
|
])
|
228
228
|
|
229
229
|
jasmine.clock().tick(50)
|
@@ -236,17 +236,17 @@ describe 'up.proxy', ->
|
|
236
236
|
jasmine.clock().tick(100)
|
237
237
|
|
238
238
|
expect(@events).toEqual([
|
239
|
-
'proxy:load',
|
240
|
-
'proxy:receive'
|
239
|
+
'up:proxy:load',
|
240
|
+
'up:proxy:receive'
|
241
241
|
])
|
242
242
|
|
243
|
-
it 'emits proxy:idle if a request returned but failed', ->
|
243
|
+
it 'emits up:proxy:idle if a request returned but failed', ->
|
244
244
|
|
245
245
|
up.proxy.ajax(url: '/foo')
|
246
246
|
|
247
247
|
expect(@events).toEqual([
|
248
|
-
'proxy:load',
|
249
|
-
'proxy:busy'
|
248
|
+
'up:proxy:load',
|
249
|
+
'up:proxy:busy'
|
250
250
|
])
|
251
251
|
|
252
252
|
jasmine.Ajax.requests.at(0).respondWith
|
@@ -255,10 +255,10 @@ describe 'up.proxy', ->
|
|
255
255
|
responseText: 'something went wrong'
|
256
256
|
|
257
257
|
expect(@events).toEqual([
|
258
|
-
'proxy:load',
|
259
|
-
'proxy:busy',
|
260
|
-
'proxy:receive',
|
261
|
-
'proxy:idle'
|
258
|
+
'up:proxy:load',
|
259
|
+
'up:proxy:busy',
|
260
|
+
'up:proxy:receive',
|
261
|
+
'up:proxy:idle'
|
262
262
|
])
|
263
263
|
|
264
264
|
|
@@ -306,9 +306,8 @@ describe 'up.proxy', ->
|
|
306
306
|
it 'preloads the link destination on mouseover, after a delay'
|
307
307
|
|
308
308
|
it 'triggers a separate AJAX request with a short cache expiry when hovered multiple times', (done) ->
|
309
|
-
up.proxy.
|
310
|
-
|
311
|
-
preloadDelay: 0
|
309
|
+
up.proxy.config.cacheExpiry = 10
|
310
|
+
up.proxy.config.preloadDelay = 0
|
312
311
|
spyOn(up, 'follow')
|
313
312
|
$element = affix('a[href="/foo"][up-preload]')
|
314
313
|
Trigger.mouseover($element)
|
@@ -2,7 +2,7 @@ describe 'up.tooltip', ->
|
|
2
2
|
|
3
3
|
describe 'Javascript functions', ->
|
4
4
|
|
5
|
-
describe 'up.tooltip.
|
5
|
+
describe 'up.tooltip.attach', ->
|
6
6
|
|
7
7
|
it 'opens a tooltop above the center of the given element', ->
|
8
8
|
$link = affix('span').text('button label')
|
@@ -13,7 +13,7 @@ describe 'up.tooltip', ->
|
|
13
13
|
width: '50px'
|
14
14
|
height: '50px'
|
15
15
|
)
|
16
|
-
up.tooltip.
|
16
|
+
up.tooltip.attach($link, html: 'tooltip text')
|
17
17
|
$tooltip = $('.up-tooltip')
|
18
18
|
expect($tooltip).toBeInDOM()
|
19
19
|
expect($tooltip).toHaveText('tooltip text')
|
@@ -22,8 +22,18 @@ describe 'up.tooltip', ->
|
|
22
22
|
expect(tooltipBox.top).toBeAround(linkBox.top - tooltipBox.height, 15)
|
23
23
|
expect(tooltipBox.left).toBeAround(linkBox.left + 0.5 * (linkBox.width - tooltipBox.width), 15)
|
24
24
|
|
25
|
-
it 'allows HTML for the tooltip text'
|
26
|
-
|
25
|
+
it 'allows HTML for the tooltip text when contents are given as .html option', ->
|
26
|
+
$link = affix('span')
|
27
|
+
up.tooltip.attach($link, html: '<b>text</b>')
|
28
|
+
$tooltip = $('.up-tooltip')
|
29
|
+
expect($tooltip.html()).toEqual('<b>text</b>')
|
30
|
+
|
31
|
+
it 'escapes HTML for the tooltip text when contents given as .html option', ->
|
32
|
+
$link = affix('span')
|
33
|
+
up.tooltip.attach($link, text: '<b>text</b>')
|
34
|
+
$tooltip = $('.up-tooltip')
|
35
|
+
expect($tooltip.html()).toEqual('<b>text</b>')
|
36
|
+
|
27
37
|
it 'closes an existing tooltip'
|
28
38
|
|
29
39
|
describe 'with position option', ->
|
@@ -39,7 +49,11 @@ describe 'up.tooltip', ->
|
|
39
49
|
describe '[up-tooltip]', ->
|
40
50
|
|
41
51
|
it 'should have tests'
|
42
|
-
|
52
|
+
|
53
|
+
describe '[up-tooltip-html]', ->
|
54
|
+
|
55
|
+
it 'should have tests'
|
56
|
+
|
43
57
|
describe 'body', ->
|
44
58
|
|
45
59
|
it 'closes a tooltip when clicked'
|
@@ -2,6 +2,12 @@ describe 'up.util', ->
|
|
2
2
|
|
3
3
|
describe 'Javascript functions', ->
|
4
4
|
|
5
|
+
describe 'up.util.argNames', ->
|
6
|
+
|
7
|
+
it 'returns an array of argument names for the given function', ->
|
8
|
+
fun = ($element, data) ->
|
9
|
+
expect(up.util.argNames(fun)).toEqual(['$element', 'data'])
|
10
|
+
|
5
11
|
describe 'up.util.castedAttr', ->
|
6
12
|
|
7
13
|
it 'returns true if the attribute value is the string "true"', ->
|
@@ -82,38 +88,23 @@ describe 'up.util', ->
|
|
82
88
|
expect(object.a).toBe(1)
|
83
89
|
expect(object.b).toBe(2)
|
84
90
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
object.update(b: 2, c: 3)
|
90
|
-
expect(object.b).toBe(2)
|
91
|
-
expect(object.c).toBe(3)
|
92
|
-
|
93
|
-
it 'returns the current hash when called without arguments', ->
|
94
|
-
object = up.util.config(a: 1, b: 2)
|
95
|
-
result = object.update()
|
96
|
-
expect(result.a).toBe(1)
|
97
|
-
expect(result.b).toBe(2)
|
98
|
-
|
99
|
-
it 'throws an error when setting a key that was not included in the factory settings', ->
|
100
|
-
object = up.util.config(a: 1)
|
101
|
-
update = -> object.update(b: 2)
|
102
|
-
expect(update).toThrowError(/unknown setting/i)
|
91
|
+
it 'does not allow to set a key that was not included in the factory settings', ->
|
92
|
+
object = up.util.config(a: 1)
|
93
|
+
object.b = 2
|
94
|
+
expect(object.b).toBeUndefined()
|
103
95
|
|
104
96
|
describe '#reset', ->
|
105
97
|
|
106
98
|
it 'resets the object to its original state', ->
|
107
99
|
object = up.util.config(a: 1)
|
108
100
|
expect(object.b).toBeUndefined()
|
109
|
-
object.
|
110
|
-
expect(object.
|
101
|
+
object.a = 2
|
102
|
+
expect(object.a).toBe(2)
|
111
103
|
object.reset()
|
112
|
-
expect(object.
|
104
|
+
expect(object.a).toBe(1)
|
113
105
|
|
114
|
-
it 'does not remove #reset or #update
|
106
|
+
it 'does not remove the #reset or #update method from the object', ->
|
115
107
|
object = up.util.config(a: 1)
|
116
108
|
object.b = 2
|
117
109
|
object.reset()
|
118
110
|
expect(object.reset).toBeDefined()
|
119
|
-
expect(object.update).toBeDefined()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
@@ -107,7 +107,6 @@ files:
|
|
107
107
|
- lib/assets/javascripts/up/navigation.js.coffee
|
108
108
|
- lib/assets/javascripts/up/popup.js.coffee
|
109
109
|
- lib/assets/javascripts/up/proxy.js.coffee
|
110
|
-
- lib/assets/javascripts/up/slot.js.coffee
|
111
110
|
- lib/assets/javascripts/up/tooltip.js.coffee
|
112
111
|
- lib/assets/javascripts/up/util.js.coffee
|
113
112
|
- lib/assets/stylesheets/up-bootstrap.css.sass
|
@@ -229,7 +228,6 @@ files:
|
|
229
228
|
- spec_app/spec/javascripts/up/navigation_spec.js.coffee
|
230
229
|
- spec_app/spec/javascripts/up/popup_spec.js.coffee
|
231
230
|
- spec_app/spec/javascripts/up/proxy_spec.js.coffee
|
232
|
-
- spec_app/spec/javascripts/up/slot_spec.js.coffee
|
233
231
|
- spec_app/spec/javascripts/up/tooltip_spec.js.coffee
|
234
232
|
- spec_app/spec/javascripts/up/util_spec.js.coffee
|
235
233
|
- spec_app/test/controllers/.keep
|
@@ -1,63 +0,0 @@
|
|
1
|
-
###*
|
2
|
-
Content slots
|
3
|
-
=============
|
4
|
-
|
5
|
-
It can be useful to mark "slots" in your page layout where you expect
|
6
|
-
content to appear in the future.
|
7
|
-
|
8
|
-
For example, you might have
|
9
|
-
|
10
|
-
<div up-slot class="alerts"></div>
|
11
|
-
|
12
|
-
<script>
|
13
|
-
up.compiler('.alerts', function ($element) {
|
14
|
-
setInterval(3000, function() { up.reload('.alerts') });
|
15
|
-
});
|
16
|
-
</script>
|
17
|
-
|
18
|
-
Seeing that the `.alerts` container is empty, Up.js will hide it:
|
19
|
-
|
20
|
-
<div class="alerts" up-slot style="display: none"></div>
|
21
|
-
|
22
|
-
As soon as you
|
23
|
-
|
24
|
-
<div class="alerts" up-slot>
|
25
|
-
Meeting at 11:30 AM
|
26
|
-
</div>
|
27
|
-
|
28
|
-
|
29
|
-
TODO: Write some documentation
|
30
|
-
|
31
|
-
@class up.slot
|
32
|
-
###
|
33
|
-
up.slot = (->
|
34
|
-
|
35
|
-
u = up.util
|
36
|
-
|
37
|
-
hasContent = ($slot) ->
|
38
|
-
u.trim($slot.html()) != ''
|
39
|
-
|
40
|
-
check = ($element) ->
|
41
|
-
u.findWithSelf($element, '[up-slot]').each ->
|
42
|
-
$slot = $(this)
|
43
|
-
unless hasContent($slot)
|
44
|
-
$slot.hide()
|
45
|
-
|
46
|
-
###*
|
47
|
-
Use this attribute to mark up empty element containers that
|
48
|
-
you plan to update with content in the future.
|
49
|
-
|
50
|
-
An element with this attribute is automatically hidden
|
51
|
-
if it has no content, and is re-shown if it is updated with
|
52
|
-
content.
|
53
|
-
|
54
|
-
This is useful to prevent the element from applying unwanted
|
55
|
-
margins to the surrounding page flow.
|
56
|
-
|
57
|
-
@method [up-slot]
|
58
|
-
@ujs
|
59
|
-
###
|
60
|
-
up.bus.on 'fragment:ready', check
|
61
|
-
|
62
|
-
)()
|
63
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
describe 'up.marker', ->
|
2
|
-
|
3
|
-
describe 'unobtrusive behavior', ->
|
4
|
-
|
5
|
-
describe '[up-slot]', ->
|
6
|
-
|
7
|
-
it 'hides empty containers', ->
|
8
|
-
$element = affix('.element[up-slot]')
|
9
|
-
up.ready($element)
|
10
|
-
expect($element).not.toBeVisible()
|
11
|
-
|
12
|
-
it 'does not hide empty containers', ->
|
13
|
-
$element = affix('.element[up-slot]').text('content')
|
14
|
-
up.ready($element)
|
15
|
-
expect($element).toBeVisible()
|
16
|
-
|