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
@@ -6,37 +6,37 @@ This modules contains functions to scroll the viewport and reveal contained elem
|
|
6
6
|
|
7
7
|
@class up.layout
|
8
8
|
###
|
9
|
-
up.layout = (->
|
9
|
+
up.layout = (($) ->
|
10
10
|
|
11
11
|
u = up.util
|
12
12
|
|
13
13
|
###*
|
14
14
|
Configures the application layout.
|
15
15
|
|
16
|
-
@method up.layout.
|
17
|
-
@param {Array<String>} [
|
16
|
+
@method up.layout.config
|
17
|
+
@param {Array<String>} [config.viewports]
|
18
18
|
An array of CSS selectors that find viewports
|
19
19
|
(containers that scroll their contents).
|
20
|
-
@param {Array<String>} [
|
20
|
+
@param {Array<String>} [config.fixedTop]
|
21
21
|
An array of CSS selectors that find elements fixed to the
|
22
22
|
top edge of the screen (using `position: fixed`).
|
23
|
-
@param {Array<String>} [
|
23
|
+
@param {Array<String>} [config.fixedBottom]
|
24
24
|
An array of CSS selectors that find elements fixed to the
|
25
25
|
bottom edge of the screen (using `position: fixed`).
|
26
|
-
@param {Array<String>} [
|
26
|
+
@param {Array<String>} [config.anchoredRight]
|
27
27
|
An array of CSS selectors that find elements anchored to the
|
28
28
|
right edge of the screen (using `position: fixed` or `position: absolute`).
|
29
|
-
@param {Number} [
|
29
|
+
@param {Number} [config.duration]
|
30
30
|
The duration of the scrolling animation in milliseconds.
|
31
31
|
Setting this to `0` will disable scrolling animations.
|
32
|
-
@param {String} [
|
32
|
+
@param {String} [config.easing]
|
33
33
|
The timing function that controls the animation's acceleration.
|
34
34
|
See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
|
35
35
|
for a list of pre-defined timing functions.
|
36
|
-
@param {Number} [
|
36
|
+
@param {Number} [config.snap]
|
37
37
|
When [revealing](#up.reveal) elements, Up.js will scroll an viewport
|
38
|
-
to the top when the revealed element is closer to the top than `
|
39
|
-
@param {Number} [
|
38
|
+
to the top when the revealed element is closer to the top than `config.snap`.
|
39
|
+
@param {Number} [config.substance]
|
40
40
|
A number indicating how many top pixel rows of an element to [reveal](#up.reveal).
|
41
41
|
###
|
42
42
|
config = u.config
|
@@ -182,7 +182,7 @@ up.layout = (->
|
|
182
182
|
- the currently open [modal](/up.modal)
|
183
183
|
- an element with the attribute `[up-viewport]`
|
184
184
|
- the `<body>` element
|
185
|
-
- an element matching the selector you have configured using `up.viewport.
|
185
|
+
- an element matching the selector you have configured using `up.viewport.config.viewports.push('my-custom-selector')`
|
186
186
|
|
187
187
|
\#\#\#\# Fixed elements obstruction the viewport
|
188
188
|
|
@@ -192,7 +192,7 @@ up.layout = (->
|
|
192
192
|
To make `up.aware` of these fixed elements you can either:
|
193
193
|
|
194
194
|
- give the element an attribute [`up-fixed="top"`](#up-fixed-top) or [`up-fixed="bottom"`](up-fixed-bottom)
|
195
|
-
- [configure default options](#up.layout.
|
195
|
+
- [configure default options](#up.layout.config) for `fixedTop` or `fixedBottom`
|
196
196
|
|
197
197
|
@method up.reveal
|
198
198
|
@param {String|Element|jQuery} element
|
@@ -336,7 +336,7 @@ up.layout = (->
|
|
336
336
|
|
337
337
|
###*
|
338
338
|
Saves the top scroll positions of all the
|
339
|
-
viewports configured in `up.layout.
|
339
|
+
viewports configured in [`up.layout.config.viewports`](#up.layout.config).
|
340
340
|
The saved scroll positions can be restored by calling
|
341
341
|
[`up.layout.restoreScroll()`](#up.layout.restoreScroll).
|
342
342
|
|
@@ -352,7 +352,7 @@ up.layout = (->
|
|
352
352
|
|
353
353
|
###*
|
354
354
|
Restores the top scroll positions of all the
|
355
|
-
viewports configured in `up.layout.
|
355
|
+
viewports configured in [`up.layout.config.viewports`](#up.layout.config).
|
356
356
|
|
357
357
|
@method up.layout.restoreScroll
|
358
358
|
@param {jQuery} [options.around]
|
@@ -458,12 +458,13 @@ up.layout = (->
|
|
458
458
|
@ujs
|
459
459
|
###
|
460
460
|
|
461
|
-
up.
|
461
|
+
up.on 'up:framework:reset', reset
|
462
462
|
|
463
463
|
reveal: reveal
|
464
464
|
scroll: scroll
|
465
465
|
finishScrolling: finishScrolling
|
466
|
-
|
466
|
+
config: config
|
467
|
+
defaults: -> u.error('up.layout.defaults(...) no longer exists. Set values on he up.layout.config property instead.')
|
467
468
|
viewportOf: viewportOf
|
468
469
|
viewportsWithin: viewportsWithin
|
469
470
|
viewports: viewports
|
@@ -473,7 +474,7 @@ up.layout = (->
|
|
473
474
|
anchoredRight: anchoredRight
|
474
475
|
fixedChildren: fixedChildren
|
475
476
|
|
476
|
-
)()
|
477
|
+
)(jQuery)
|
477
478
|
|
478
479
|
up.scroll = up.layout.scroll
|
479
480
|
up.reveal = up.layout.reveal
|
@@ -82,7 +82,7 @@ Read on
|
|
82
82
|
@class up.link
|
83
83
|
###
|
84
84
|
|
85
|
-
up.link = (->
|
85
|
+
up.link = (($) ->
|
86
86
|
|
87
87
|
u = up.util
|
88
88
|
|
@@ -409,7 +409,7 @@ up.link = (->
|
|
409
409
|
childClicked: childClicked
|
410
410
|
followMethod: followMethod
|
411
411
|
|
412
|
-
)()
|
412
|
+
)(jQuery)
|
413
413
|
|
414
414
|
up.visit = up.link.visit
|
415
415
|
up.follow = up.link.follow
|
@@ -14,7 +14,7 @@ We need to work on this page:
|
|
14
14
|
|
15
15
|
@class up.magic
|
16
16
|
###
|
17
|
-
up.magic = (->
|
17
|
+
up.magic = (($) ->
|
18
18
|
|
19
19
|
u = up.util
|
20
20
|
|
@@ -69,8 +69,10 @@ up.magic = (->
|
|
69
69
|
@method up.on
|
70
70
|
@param {String} events
|
71
71
|
A space-separated list of event names to bind.
|
72
|
-
@param {String} selector
|
73
|
-
The selector an on which the event must be triggered.
|
72
|
+
@param {String} [selector]
|
73
|
+
The selector of an element on which the event must be triggered.
|
74
|
+
Omit the selector to listen to all events with that name, regardless
|
75
|
+
of the event target.
|
74
76
|
@param {Function(event, $element, data)} behavior
|
75
77
|
The handler that should be called.
|
76
78
|
The function takes the affected element as the first argument (as a jQuery object).
|
@@ -80,16 +82,28 @@ up.magic = (->
|
|
80
82
|
liveDescriptions = []
|
81
83
|
defaultLiveDescriptions = null
|
82
84
|
|
83
|
-
|
85
|
+
###*
|
86
|
+
# Convert an Up.js style listener (second argument is the event target
|
87
|
+
# as a jQuery collection) to a vanilla jQuery listener
|
88
|
+
###
|
89
|
+
upListenerToJqueryListener = (upListener) ->
|
90
|
+
(event) ->
|
91
|
+
$me = event.$element || $(this)
|
92
|
+
upListener.apply($me.get(0), [event, $me, data($me)])
|
93
|
+
|
94
|
+
live = (args...) ->
|
84
95
|
# Silently discard any event handlers that are registered on unsupported browsers
|
85
96
|
return unless up.browser.isSupported()
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
97
|
+
|
98
|
+
description = u.copy(args)
|
99
|
+
lastIndex = description.length - 1
|
100
|
+
behavior = description[lastIndex]
|
101
|
+
description[lastIndex] = upListenerToJqueryListener(behavior)
|
102
|
+
|
103
|
+
# Remember the descriptions we registered, so we can
|
104
|
+
# clean up after ourselves during a reset
|
92
105
|
liveDescriptions.push(description)
|
106
|
+
|
93
107
|
$(document).on(description...)
|
94
108
|
|
95
109
|
###*
|
@@ -326,13 +340,13 @@ up.magic = (->
|
|
326
340
|
other Up.js methods. You will only need to call this if you
|
327
341
|
manipulate the DOM without going through Up.js.
|
328
342
|
|
329
|
-
@method up.
|
330
|
-
@param {String|Element|jQuery}
|
343
|
+
@method up.hello
|
344
|
+
@param {String|Element|jQuery} selectorOrElement
|
331
345
|
###
|
332
|
-
|
333
|
-
$
|
334
|
-
up.bus.emit('fragment:
|
335
|
-
$
|
346
|
+
hello = (selectorOrElement) ->
|
347
|
+
$element = $(selectorOrElement)
|
348
|
+
up.bus.emit('up:fragment:inserted', $element: $element)
|
349
|
+
$element
|
336
350
|
|
337
351
|
onEscape = (handler) ->
|
338
352
|
live('keydown', 'body', (event) ->
|
@@ -340,23 +354,23 @@ up.magic = (->
|
|
340
354
|
handler(event)
|
341
355
|
)
|
342
356
|
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
357
|
+
live 'ready', (-> hello(document.body))
|
358
|
+
live 'up:fragment:inserted', (event) -> compile(event.$element)
|
359
|
+
live 'up:fragment:destroy', (event) -> destroy(event.$element)
|
360
|
+
live 'up:framework:boot', snapshot
|
361
|
+
live 'up:framework:reset', reset
|
348
362
|
|
349
363
|
compiler: compiler
|
350
364
|
on: live
|
351
|
-
|
365
|
+
hello: hello
|
352
366
|
onEscape: onEscape
|
353
367
|
data: data
|
354
368
|
|
355
|
-
)()
|
369
|
+
)(jQuery)
|
356
370
|
|
357
371
|
up.compiler = up.magic.compiler
|
358
372
|
up.on = up.magic.on
|
359
|
-
up.
|
360
|
-
|
361
|
-
|
362
|
-
|
373
|
+
up.hello = up.magic.hello
|
374
|
+
|
375
|
+
up.ready = -> up.util.error('up.ready no longer exists. Please use up.hello instead.')
|
376
|
+
up.awaken = -> up.util.error('up.awaken no longer exists. Please use up.compiler instead.')
|
@@ -9,30 +9,30 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
9
9
|
|
10
10
|
@class up.modal
|
11
11
|
###
|
12
|
-
up.modal = (->
|
12
|
+
up.modal = (($) ->
|
13
13
|
|
14
14
|
u = up.util
|
15
15
|
|
16
16
|
###*
|
17
17
|
Sets default options for future modals.
|
18
18
|
|
19
|
-
@method up.modal.
|
20
|
-
@param {Number} [
|
19
|
+
@method up.modal.config
|
20
|
+
@param {Number} [config.width]
|
21
21
|
The width of the dialog as a CSS value like `'400px'` or `50%`.
|
22
22
|
|
23
23
|
Defaults to `undefined`, meaning that the dialog will grow to fit its contents
|
24
|
-
until it reaches `
|
24
|
+
until it reaches `config.maxWidth`. Leaving this as `undefined` will
|
25
25
|
also allow you to control the width using CSS on `.up-modal-dialog´.
|
26
|
-
@param {Number} [
|
26
|
+
@param {Number} [config.maxWidth]
|
27
27
|
The width of the dialog as a CSS value like `'400px'` or `50%`.
|
28
28
|
You can set this to `undefined` to make the dialog fit its contents.
|
29
29
|
Be aware however, that e.g. Bootstrap stretches input elements
|
30
30
|
to `width: 100%`, meaning the dialog will also stretch to the full
|
31
31
|
width of the screen.
|
32
|
-
@param {Number} [
|
32
|
+
@param {Number} [config.height='auto']
|
33
33
|
The height of the dialog in pixels.
|
34
34
|
Defaults to `undefined`, meaning that the dialog will grow to fit its contents.
|
35
|
-
@param {String|Function(config)} [
|
35
|
+
@param {String|Function(config)} [config.template]
|
36
36
|
A string containing the HTML structure of the modal.
|
37
37
|
You can supply an alternative template string, but make sure that it
|
38
38
|
defines tag with the classes `up-modal`, `up-modal-dialog` and `up-modal-content`.
|
@@ -40,12 +40,12 @@ up.modal = (->
|
|
40
40
|
You can also supply a function that returns a HTML string.
|
41
41
|
The function will be called with the modal options (merged from these defaults
|
42
42
|
and any per-open overrides) whenever a modal opens.
|
43
|
-
@param {String} [
|
43
|
+
@param {String} [config.closeLabel='X']
|
44
44
|
The label of the button that closes the dialog.
|
45
|
-
@param {String} [
|
45
|
+
@param {String} [config.openAnimation='fade-in']
|
46
46
|
The animation used to open the modal. The animation will be applied
|
47
47
|
to both the dialog box and the overlay dimming the page.
|
48
|
-
@param {String} [
|
48
|
+
@param {String} [config.closeAnimation='fade-out']
|
49
49
|
The animation used to close the modal. The animation will be applied
|
50
50
|
to both the dialog box and the overlay dimming the page.
|
51
51
|
###
|
@@ -134,29 +134,27 @@ up.modal = (->
|
|
134
134
|
unshiftElements.push(unshiftElement)
|
135
135
|
|
136
136
|
updated = ($modal, animation, animateOptions) ->
|
137
|
-
up.bus.emit('modal:open')
|
138
137
|
shiftElements()
|
139
138
|
$modal.show()
|
140
|
-
|
141
|
-
|
142
|
-
promise
|
139
|
+
deferred = up.animate($modal, animation, animateOptions)
|
140
|
+
deferred.then -> up.bus.emit('up:modal:opened')
|
143
141
|
|
144
142
|
###*
|
145
143
|
Opens the given link's destination in a modal overlay:
|
146
144
|
|
147
145
|
var $link = $('...');
|
148
|
-
up.modal.
|
146
|
+
up.modal.follow($link);
|
149
147
|
|
150
148
|
Any option attributes for [`a[up-modal]`](#a.up-modal) will be honored.
|
151
149
|
|
152
150
|
\#\#\#\# Events
|
153
151
|
|
154
|
-
- Emits an [event](/up.bus) `modal:open` when the modal
|
152
|
+
- Emits an [event](/up.bus) `up:modal:open` when the modal
|
155
153
|
is starting to open.
|
156
|
-
- Emits an [event](/up.bus) `modal:opened` when the opening
|
154
|
+
- Emits an [event](/up.bus) `up:modal:opened` when the opening
|
157
155
|
animation has finished and the modal contents are fully visible.
|
158
156
|
|
159
|
-
@method up.modal.
|
157
|
+
@method up.modal.follow
|
160
158
|
@param {Element|jQuery|String} elementOrSelector
|
161
159
|
The link to follow.
|
162
160
|
@param {String} [options.target]
|
@@ -183,19 +181,24 @@ up.modal = (->
|
|
183
181
|
@return {Promise}
|
184
182
|
A promise that will be resolved when the modal has finished loading.
|
185
183
|
###
|
184
|
+
follow = ($link, options) ->
|
185
|
+
options = u.options(options)
|
186
|
+
options.$link = $link
|
187
|
+
open(options)
|
188
|
+
|
186
189
|
|
187
190
|
###*
|
188
191
|
Opens a modal for the given URL.
|
189
192
|
|
190
193
|
Example:
|
191
194
|
|
192
|
-
up.modal.
|
195
|
+
up.modal.visit('/foo', { target: '.list' })
|
193
196
|
|
194
197
|
This will request `/foo`, extract the `.list` selector from the response
|
195
198
|
and open the selected container in a modal dialog.
|
196
199
|
|
197
|
-
@method up.modal.
|
198
|
-
@param {String}
|
200
|
+
@method up.modal.visit
|
201
|
+
@param {String} url
|
199
202
|
The URL to load.
|
200
203
|
@param {String} options.target
|
201
204
|
The CSS selector to extract from the response.
|
@@ -203,15 +206,18 @@ up.modal = (->
|
|
203
206
|
@param {Object} options
|
204
207
|
See options for [previous `up.modal.open` variant](#up.modal.open).
|
205
208
|
###
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
$link = $(args[0])
|
212
|
-
options = args[1]
|
209
|
+
visit = (url, options) ->
|
210
|
+
options = u.options(options)
|
211
|
+
options.url = url
|
212
|
+
open(options)
|
213
|
+
|
213
214
|
|
215
|
+
###*
|
216
|
+
@private
|
217
|
+
###
|
218
|
+
open = (options) ->
|
214
219
|
options = u.options(options)
|
220
|
+
$link = u.option(options.$link, u.nullJquery())
|
215
221
|
url = u.option(options.url, $link.attr('up-href'), $link.attr('href'))
|
216
222
|
selector = u.option(options.target, $link.attr('up-modal'), 'body')
|
217
223
|
width = u.option(options.width, $link.attr('up-width'), config.width)
|
@@ -226,17 +232,21 @@ up.modal = (->
|
|
226
232
|
animateOptions = up.motion.animateOptions(options, $link)
|
227
233
|
|
228
234
|
close()
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
235
|
+
|
236
|
+
if up.bus.nobodyPrevents('up:modal:open', url: url)
|
237
|
+
$modal = createHiddenModal
|
238
|
+
selector: selector
|
239
|
+
width: width
|
240
|
+
maxWidth: maxWidth
|
241
|
+
height: height
|
242
|
+
sticky: sticky
|
243
|
+
up.replace selector, url,
|
244
|
+
history: history
|
245
|
+
insert: -> updated($modal, animation, animateOptions)
|
246
|
+
else
|
247
|
+
# Although someone prevented the destruction, keep a uniform API for
|
248
|
+
# callers by returning a Deferred that will never be resolved.
|
249
|
+
$.Deferred()
|
240
250
|
|
241
251
|
###*
|
242
252
|
Returns the source URL for the fragment displayed in the current modal overlay,
|
@@ -267,18 +277,22 @@ up.modal = (->
|
|
267
277
|
close = (options) ->
|
268
278
|
$modal = $('.up-modal')
|
269
279
|
if $modal.length
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
280
|
+
if up.bus.nobodyPrevents('up:modal:close', $element: $modal)
|
281
|
+
options = u.options(options,
|
282
|
+
animation: config.closeAnimation,
|
283
|
+
url: $modal.attr('up-previous-url')
|
284
|
+
title: $modal.attr('up-previous-title')
|
285
|
+
)
|
286
|
+
currentSource = undefined
|
287
|
+
deferred = up.destroy($modal, options)
|
288
|
+
deferred.then ->
|
289
|
+
unshifter() while unshifter = unshiftElements.pop()
|
290
|
+
up.bus.emit('up:modal:closed')
|
291
|
+
deferred
|
292
|
+
else
|
293
|
+
# Although someone prevented the destruction, keep a uniform API for
|
294
|
+
# callers by returning a Deferred that will never be resolved.
|
295
|
+
$.Deferred()
|
282
296
|
else
|
283
297
|
u.resolvedDeferred()
|
284
298
|
|
@@ -339,7 +353,7 @@ up.modal = (->
|
|
339
353
|
</div>
|
340
354
|
|
341
355
|
If you want to change the design beyond CSS, you can
|
342
|
-
configure Up.js to [use a different HTML structure](#up.modal.
|
356
|
+
configure Up.js to [use a different HTML structure](#up.modal.config).
|
343
357
|
|
344
358
|
|
345
359
|
\#\#\#\# Closing behavior
|
@@ -379,7 +393,7 @@ up.modal = (->
|
|
379
393
|
close()
|
380
394
|
)
|
381
395
|
|
382
|
-
up.
|
396
|
+
up.on('up:fragment:inserted', (event, $fragment) ->
|
383
397
|
if contains($fragment)
|
384
398
|
if newSource = $fragment.attr('up-source')
|
385
399
|
currentSource = newSource
|
@@ -407,12 +421,15 @@ up.modal = (->
|
|
407
421
|
)
|
408
422
|
|
409
423
|
# The framework is reset between tests
|
410
|
-
up.
|
424
|
+
up.on 'up:framework:reset', reset
|
411
425
|
|
412
|
-
|
426
|
+
visit: visit
|
427
|
+
follow: follow
|
428
|
+
open: -> up.error('up.modal.open no longer exists. Please use either up.modal.follow or up.modal.visit.')
|
413
429
|
close: close
|
414
430
|
source: source
|
415
|
-
|
431
|
+
config: config
|
432
|
+
defaults: -> u.error('up.modal.defaults(...) no longer exists. Set values on he up.modal.config property instead.')
|
416
433
|
contains: contains
|
417
434
|
|
418
|
-
)()
|
435
|
+
)(jQuery)
|
@@ -25,7 +25,7 @@ We need to work on this page:
|
|
25
25
|
|
26
26
|
@class up.motion
|
27
27
|
###
|
28
|
-
up.motion = (->
|
28
|
+
up.motion = (($) ->
|
29
29
|
|
30
30
|
u = up.util
|
31
31
|
|
@@ -37,10 +37,10 @@ up.motion = (->
|
|
37
37
|
###*
|
38
38
|
Sets default options for animations and transitions.
|
39
39
|
|
40
|
-
@method up.motion.
|
41
|
-
@param {Number} [
|
42
|
-
@param {Number} [
|
43
|
-
@param {String} [
|
40
|
+
@method up.motion.config
|
41
|
+
@param {Number} [config.duration=300]
|
42
|
+
@param {Number} [config.delay=0]
|
43
|
+
@param {String} [config.easing='ease']
|
44
44
|
###
|
45
45
|
config = u.config
|
46
46
|
duration: 300
|
@@ -151,7 +151,7 @@ up.motion = (->
|
|
151
151
|
options
|
152
152
|
|
153
153
|
findAnimation = (name) ->
|
154
|
-
animations[name] or u.error("Unknown animation %o",
|
154
|
+
animations[name] or u.error("Unknown animation %o", name)
|
155
155
|
|
156
156
|
GHOSTING_PROMISE_KEY = 'up-ghosting-promise'
|
157
157
|
|
@@ -577,8 +577,8 @@ up.motion = (->
|
|
577
577
|
)
|
578
578
|
)
|
579
579
|
|
580
|
-
up.
|
581
|
-
up.
|
580
|
+
up.on 'up:framework:boot', snapshot
|
581
|
+
up.on 'up:framework:reset', reset
|
582
582
|
|
583
583
|
morph: morph
|
584
584
|
animate: animate
|
@@ -586,12 +586,13 @@ up.motion = (->
|
|
586
586
|
finish: finish
|
587
587
|
transition: transition
|
588
588
|
animation: animation
|
589
|
-
|
589
|
+
config: config
|
590
|
+
defaults: -> u.error('up.motion.defaults(...) no longer exists. Set values on he up.motion.config property instead.')
|
590
591
|
none: none
|
591
592
|
when: resolvableWhen
|
592
593
|
prependCopy: prependCopy
|
593
594
|
|
594
|
-
)()
|
595
|
+
)(jQuery)
|
595
596
|
|
596
597
|
up.transition = up.motion.transition
|
597
598
|
up.animation = up.motion.animation
|
@@ -11,16 +11,16 @@ by providing instant feedback for user interactions.
|
|
11
11
|
|
12
12
|
@class up.navigation
|
13
13
|
###
|
14
|
-
up.navigation = (->
|
14
|
+
up.navigation = (($) ->
|
15
15
|
|
16
16
|
u = up.util
|
17
17
|
|
18
18
|
###*
|
19
19
|
Sets default options for this module.
|
20
20
|
|
21
|
-
@method up.navigation.
|
22
|
-
@param {Number} [
|
23
|
-
|
21
|
+
@method up.navigation.config
|
22
|
+
@param {Number} [config.currentClasses]
|
23
|
+
An array of classes to set on [links that point the current location](#up-current).
|
24
24
|
###
|
25
25
|
config = u.config
|
26
26
|
currentClasses: ['up-current']
|
@@ -189,17 +189,17 @@ up.navigation = (->
|
|
189
189
|
@method [up-current]
|
190
190
|
@ujs
|
191
191
|
###
|
192
|
-
up.
|
192
|
+
up.on 'up:fragment:inserted', ->
|
193
193
|
# If a new fragment is inserted, it's likely to be the result
|
194
194
|
# of the active action. So we can remove the active marker.
|
195
195
|
unmarkActive()
|
196
|
-
# When a fragment is
|
196
|
+
# When a fragment is inserted it might either have brought a location change
|
197
197
|
# with it, or it might have opened a modal / popup which we consider
|
198
198
|
# to be secondary location sources (the primary being the browser's
|
199
199
|
# location bar).
|
200
200
|
locationChanged()
|
201
201
|
|
202
|
-
up.
|
202
|
+
up.on 'up:fragment:destroy', (event, $fragment) ->
|
203
203
|
# If the destroyed fragment is a modal or popup container
|
204
204
|
# this changes which URLs we consider currents.
|
205
205
|
# Also modals and popups restore their previous history
|
@@ -208,8 +208,9 @@ up.navigation = (->
|
|
208
208
|
locationChanged()
|
209
209
|
|
210
210
|
# The framework is reset between tests
|
211
|
-
up.
|
211
|
+
up.on 'up:framework:reset', reset
|
212
212
|
|
213
|
-
|
213
|
+
config: config
|
214
|
+
defaults: -> u.error('up.navigation.defaults(...) no longer exists. Set values on he up.navigation.config property instead.')
|
214
215
|
|
215
|
-
)()
|
216
|
+
)(jQuery)
|