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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2562609e94bd0b3bdf7a9edde2cc5d41f9290848
4
- data.tar.gz: 4986201f074531fdbd1d50e6c733b3c78ba0ec05
3
+ metadata.gz: 8acd5941c7bfd2510ece8281052154171bb70fc0
4
+ data.tar.gz: 286702ccec5063cb93bd649110d152a74234e127
5
5
  SHA512:
6
- metadata.gz: 02b7f851c6a7a66871a3a9f8d4c06b98f16e371925e15e8b42695357c5fffdf8469d409f22d54b89cd29f73a8c79ef16115f074f1cfc7b640036ee0ba2e402d9
7
- data.tar.gz: 0cf587ba0d8b4af332008ccfd88332ed51ef9f9926ae25b519ab0d1946a4d23475fca95ced5dc6d5d0acc0028b6dd66beb27a8a26930ca16781c08f9a05fe008
6
+ metadata.gz: 34c782e41c5fafbc531011fbb5c6bbd7ed538d8e4064d6e049462e1a9c2d1d60d7eb15321fedbf13b9881d976101d0960b1b3a1b732e988c135a4e6709b696bd
7
+ data.tar.gz: 2c15767017d4beeec7cd9c13ebcb830e45d13f295d19aac86ed269eb594dd99d85c9857599b05b3fc349c3344251b4f0b4c09b3c0d0d4025c0b75ad1b11fe15f
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: node_js
2
+ node_js:
3
+ - 0.8
4
+ before_script:
5
+ - npm install -g grunt-cli
6
+ - ./node_modules/.bin/bower install
7
+ script: "grunt test"
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Joosy 1.2: Feather
2
2
 
3
+ [![NPM version](https://badge.fury.io/js/joosy.png)](http://badge.fury.io/js/joosy)
4
+ [![Build Status](https://travis-ci.org/joosy/joosy.png)](https://travis-ci.org/joosy/joosy)
5
+ [![Dependency Status](https://gemnasium.com/joosy/joosy.png)](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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joosy",
3
- "version": "1.2.0-alpha.11",
3
+ "version": "1.2.0-alpha.12",
4
4
  "main": "lib/joosy.js",
5
5
  "ignore": [
6
6
  "bin",
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.replace(/^\#?\!?/, '!');
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 "#!" + url;
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
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "joosy"
6
6
  ],
7
- "version": "1.2.0-alpha.11",
7
+ "version": "1.2.0-alpha.12",
8
8
  "author": "Boris Staal <boris@staal.io>",
9
9
  "bin": {
10
10
  "joosy": "bin/joosy"
@@ -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 '#!test'
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 with shebang (#!) and therefore triggers new route loading
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.replace /^\#?\!?/, '!'
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
- "#!#{url}"
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": "git://github.com/inossidabile/grunt-mincer.git",
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.11
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-25 00:00:00.000000000 Z
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