joosy 1.2.0.alpha.11 → 1.2.0.alpha.12
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/.travis.yml +7 -0
- data/README.md +4 -0
- data/bower.json +1 -1
- data/lib/joosy.js +13 -4
- data/package.json +1 -1
- data/spec/joosy/core/router_spec.coffee +2 -1
- data/src/joosy/core/router.coffee +13 -5
- data/src/joosy/core/widget.coffee +1 -0
- data/templates/application/standalone/package.json +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8acd5941c7bfd2510ece8281052154171bb70fc0
|
4
|
+
data.tar.gz: 286702ccec5063cb93bd649110d152a74234e127
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34c782e41c5fafbc531011fbb5c6bbd7ed538d8e4064d6e049462e1a9c2d1d60d7eb15321fedbf13b9881d976101d0960b1b3a1b732e988c135a4e6709b696bd
|
7
|
+
data.tar.gz: 2c15767017d4beeec7cd9c13ebcb830e45d13f295d19aac86ed269eb594dd99d85c9857599b05b3fc349c3344251b4f0b4c09b3c0d0d4025c0b75ad1b11fe15f
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Joosy 1.2: Feather
|
2
2
|
|
3
|
+
[](http://badge.fury.io/js/joosy)
|
4
|
+
[](https://travis-ci.org/joosy/joosy)
|
5
|
+
[](https://gemnasium.com/joosy/joosy)
|
6
|
+
|
3
7
|
## WARNING!!!
|
4
8
|
|
5
9
|
Master branch is currently totally incompatible with the stable 1.1 and 1.0 branches. 1.2 features
|
data/bower.json
CHANGED
data/lib/joosy.js
CHANGED
@@ -3266,6 +3266,7 @@ Joosy.Router = {
|
|
3266
3266
|
restrictPattern: false,
|
3267
3267
|
__namespace: "",
|
3268
3268
|
__asNamespace: "",
|
3269
|
+
prefix: '',
|
3269
3270
|
restrict: function(restrictPattern) {
|
3270
3271
|
this.restrictPattern = restrictPattern;
|
3271
3272
|
},
|
@@ -3289,7 +3290,13 @@ Joosy.Router = {
|
|
3289
3290
|
if (options == null) {
|
3290
3291
|
options = {};
|
3291
3292
|
}
|
3292
|
-
path = to
|
3293
|
+
path = to;
|
3294
|
+
if (path[0] === '#') {
|
3295
|
+
path = path.substr(1);
|
3296
|
+
}
|
3297
|
+
if (!path.startsWith(this.prefix)) {
|
3298
|
+
path = this.prefix + path;
|
3299
|
+
}
|
3293
3300
|
if (options.respond !== false) {
|
3294
3301
|
return location.hash = path;
|
3295
3302
|
} else {
|
@@ -3402,7 +3409,7 @@ Joosy.Router = {
|
|
3402
3409
|
__respondRoute: function(hash) {
|
3403
3410
|
var found, fullPath, params, path, queryArray, regex, route, urlParams, vals, _ref;
|
3404
3411
|
Joosy.Modules.Log.debug("Router> Answering '" + hash + "'");
|
3405
|
-
fullPath = hash.replace(
|
3412
|
+
fullPath = hash.replace(RegExp("^(" + this.prefix + ")?"), '');
|
3406
3413
|
if (this.restrictPattern && fullPath.match(this.restrictPattern) === null) {
|
3407
3414
|
this.trigger('restricted', fullPath);
|
3408
3415
|
return;
|
@@ -3464,7 +3471,8 @@ Joosy.Router = {
|
|
3464
3471
|
return params;
|
3465
3472
|
},
|
3466
3473
|
__injectReverseUrl: function(as, route) {
|
3467
|
-
var fnc
|
3474
|
+
var fnc,
|
3475
|
+
_this = this;
|
3468
3476
|
if (as === void 0) {
|
3469
3477
|
return;
|
3470
3478
|
}
|
@@ -3474,7 +3482,7 @@ Joosy.Router = {
|
|
3474
3482
|
(route.match(/\/:[^\/]+/g) || []).each(function(str) {
|
3475
3483
|
return url = url.replace(str.substr(1), options[str.substr(2)]);
|
3476
3484
|
});
|
3477
|
-
return "
|
3485
|
+
return "#" + _this.prefix + url;
|
3478
3486
|
};
|
3479
3487
|
Joosy.Helpers.Application["" + as + "Path"] = function(options) {
|
3480
3488
|
return fnc(options);
|
@@ -3539,6 +3547,7 @@ Joosy.Widget = (function(_super) {
|
|
3539
3547
|
if (render == null) {
|
3540
3548
|
render = true;
|
3541
3549
|
}
|
3550
|
+
this.__runBeforeLoads();
|
3542
3551
|
if (render && this.__renderer) {
|
3543
3552
|
this.swapContainer(this.container, this.__renderer(this.data || {}));
|
3544
3553
|
}
|
data/package.json
CHANGED
@@ -17,6 +17,7 @@ describe "Joosy.Router", ->
|
|
17
17
|
|
18
18
|
beforeEach ->
|
19
19
|
Joosy.Router.reset()
|
20
|
+
Joosy.Router.prefix = '!'
|
20
21
|
|
21
22
|
afterEach ->
|
22
23
|
$(window).unbind 'hashchange'
|
@@ -117,7 +118,7 @@ describe "Joosy.Router", ->
|
|
117
118
|
|
118
119
|
it "should navigate", ->
|
119
120
|
Joosy.Router.navigate 'test'
|
120
|
-
expect(location.hash).toEqual
|
121
|
+
expect(location.hash).toEqual "#!test"
|
121
122
|
Joosy.Router.navigate ''
|
122
123
|
expect(location.hash).toEqual '#!'
|
123
124
|
location.hash = ''
|
@@ -38,6 +38,11 @@ Joosy.Router =
|
|
38
38
|
#
|
39
39
|
__namespace: ""
|
40
40
|
__asNamespace: ""
|
41
|
+
|
42
|
+
#
|
43
|
+
# Global url prefix
|
44
|
+
#
|
45
|
+
prefix: ''
|
41
46
|
|
42
47
|
#
|
43
48
|
# Set the restriction pattern. If the requested url does not match this it
|
@@ -74,7 +79,7 @@ Joosy.Router =
|
|
74
79
|
Joosy.Module.merge @rawRoutes, routes
|
75
80
|
|
76
81
|
#
|
77
|
-
# Changes current hash
|
82
|
+
# Changes current hash and therefore triggers new route loading
|
78
83
|
# to be loaded
|
79
84
|
#
|
80
85
|
# @param [String] to Route to navigate to
|
@@ -83,7 +88,10 @@ Joosy.Router =
|
|
83
88
|
# @option options [Boolean] replaceState If true uses replaces history entry instead of adding. Works only in browsers supporting history.pushState
|
84
89
|
#
|
85
90
|
navigate: (to, options={}) ->
|
86
|
-
path = to
|
91
|
+
path = to
|
92
|
+
path = path.substr(1) if path[0] == '#'
|
93
|
+
path = @prefix + path unless path.startsWith(@prefix)
|
94
|
+
|
87
95
|
if options.respond != false
|
88
96
|
location.hash = path
|
89
97
|
else
|
@@ -213,7 +221,7 @@ Joosy.Router =
|
|
213
221
|
#
|
214
222
|
__respondRoute: (hash) ->
|
215
223
|
Joosy.Modules.Log.debug "Router> Answering '#{hash}'"
|
216
|
-
fullPath = hash.replace
|
224
|
+
fullPath = hash.replace ///^(#{@prefix})?///, ''
|
217
225
|
|
218
226
|
if (@restrictPattern && fullPath.match(@restrictPattern) == null)
|
219
227
|
@trigger 'restricted', fullPath
|
@@ -291,11 +299,11 @@ Joosy.Router =
|
|
291
299
|
__injectReverseUrl: (as, route) ->
|
292
300
|
return if as == undefined
|
293
301
|
|
294
|
-
fnc = (options)
|
302
|
+
fnc = (options) =>
|
295
303
|
url = route
|
296
304
|
(route.match(/\/:[^\/]+/g) || []).each (str) ->
|
297
305
|
url = url.replace(str.substr(1), options[str.substr(2)])
|
298
|
-
"
|
306
|
+
"##{@prefix}#{url}"
|
299
307
|
|
300
308
|
Joosy.Helpers.Application["#{as}Path"] = (options) ->
|
301
309
|
fnc(options)
|
@@ -66,6 +66,7 @@ class Joosy.Widget extends Joosy.Module
|
|
66
66
|
# @param [jQuery] container Container to attach to
|
67
67
|
#
|
68
68
|
__load: (@parent, @container, render=true) ->
|
69
|
+
@__runBeforeLoads()
|
69
70
|
if render && @__renderer
|
70
71
|
@swapContainer @container, @__renderer(@data || {})
|
71
72
|
@refreshElements()
|
@@ -9,7 +9,7 @@
|
|
9
9
|
"nib": "~0.9.1",
|
10
10
|
"haml-coffee": "~1.11.1",
|
11
11
|
"grunt": "~0.4.1",
|
12
|
-
"grunt-mincer": "
|
12
|
+
"grunt-mincer": "~0.3.2",
|
13
13
|
"grunt-contrib-connect": "~0.3.0",
|
14
14
|
"grunt-contrib-uglify": "~0.2.2",
|
15
15
|
"grunt-contrib-watch": "~0.4.4",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: joosy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.0.alpha.
|
4
|
+
version: 1.2.0.alpha.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Staal
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-06-
|
14
|
+
date: 2013-06-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: sprockets
|
@@ -48,6 +48,7 @@ extensions: []
|
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
50
|
- .gitignore
|
51
|
+
- .travis.yml
|
51
52
|
- Gemfile
|
52
53
|
- Gruntfile.coffee
|
53
54
|
- README.md
|