js_stack 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29fee1a219a33e885c5cb97a2f3ba363a7363def
|
4
|
+
data.tar.gz: 3b650964d38c3be35eebd251eca344b66bf05531
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 467e50a12a2bfdf01d68eba11a13e04fc77760b34db8af895b304d0ad727047ddb3b4d87f9e965e4841e9b9439a67d2200cdf58d362ad7be696c70fe1c3abd34
|
7
|
+
data.tar.gz: de943f1dc183ea9626a38e575850b1326a7b827a69a06065922d8709a5e519ed25ce779814166b2d126f3facd7b7398b3be331d2baaa9921482ce4ab61cdfb99
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -66,6 +66,7 @@ Examples:
|
|
66
66
|
| backbone deepmodel | **0.10.4** | [changelog](https://github.com/powmedia/backbone-deep-model#changelog) | [homepage](https://github.com/powmedia/backbone-deep-model) | Yes
|
67
67
|
| backbone mutators | **0.4.1** | [changelog](https://github.com/asciidisco/Backbone.Mutators#changelog) | [homepage](https://github.com/asciidisco/Backbone.Mutators) | No
|
68
68
|
| backbone pageable | **1.4.5**, 1.3.2 | [changelog](https://github.com/backbone-paginator/backbone-pageable#change-log) | [homepage](https://github.com/wyuenho/backbone-pageable) | Yes
|
69
|
+
| backbone routefilter | **0.2.0** | [changelog](https://github.com/boazsender/backbone.routefilter#release-history) | [homepage](https://github.com/boazsender/backbone.routefilter) | No
|
69
70
|
| backbone stickit | **0.7.0**, 0.6.3 | [changelog](http://nytimes.github.io/backbone.stickit/#change-log) | [homepage](http://nytimes.github.io/backbone.stickit/) | Yes
|
70
71
|
| backbone validation | **0.9.1**, 0.8.1 | [changelog](https://github.com/thedersen/backbone.validation#release-notes) | [homepage](https://github.com/thedersen/backbone.validation) | Yes
|
71
72
|
| backbone virtualcollection | **0.4.8**, 0.4.5 | [changelog](https://github.com/p3drosola/Backbone.VirtualCollection#changelog) | [homepage](https://github.com/p3drosola/Backbone.VirtualCollection) | Yes
|
data/lib/js_stack/version.rb
CHANGED
@@ -0,0 +1,120 @@
|
|
1
|
+
/*! backbone.routefilter - v0.2.0 - 2013-02-16
|
2
|
+
* https://github.com/boazsender/backbone.routefilter
|
3
|
+
* Copyright (c) 2013 Boaz Sender; Licensed MIT */
|
4
|
+
|
5
|
+
(function(Backbone, _) {
|
6
|
+
|
7
|
+
// Save a reference to the original route method to be called
|
8
|
+
// after we pave it over.
|
9
|
+
var originalRoute = Backbone.Router.prototype.route;
|
10
|
+
|
11
|
+
// Create a reusable no operation func for the case where a before
|
12
|
+
// or after filter is not set. Backbone or Underscore should have
|
13
|
+
// a global one of these in my opinion.
|
14
|
+
var nop = function(){};
|
15
|
+
|
16
|
+
// Extend the router prototype with a default before function,
|
17
|
+
// a default after function, and a pave over of _bindRoutes.
|
18
|
+
_.extend(Backbone.Router.prototype, {
|
19
|
+
|
20
|
+
// Add default before filter.
|
21
|
+
before: nop,
|
22
|
+
|
23
|
+
// Add default after filter.
|
24
|
+
after: nop,
|
25
|
+
|
26
|
+
// Pave over Backbone.Router.prototype.route, the public method used
|
27
|
+
// for adding routes to a router instance on the fly, and the
|
28
|
+
// method which backbone uses internally for binding routes to handlers
|
29
|
+
// on the Backbone.history singleton once it's instantiated.
|
30
|
+
route: function(route, name, callback) {
|
31
|
+
|
32
|
+
// If there is no callback present for this route, then set it to
|
33
|
+
// be the name that was set in the routes property of the constructor,
|
34
|
+
// or the name arguement of the route method invocation. This is what
|
35
|
+
// Backbone.Router.route already does. We need to do it again,
|
36
|
+
// because we are about to wrap the callback in a function that calls
|
37
|
+
// the before and after filters as well as the original callback that
|
38
|
+
// was passed in.
|
39
|
+
if( !callback ){
|
40
|
+
callback = this[ name ];
|
41
|
+
}
|
42
|
+
|
43
|
+
// Create a new callback to replace the original callback that calls
|
44
|
+
// the before and after filters as well as the original callback
|
45
|
+
// internally.
|
46
|
+
var wrappedCallback = _.bind( function() {
|
47
|
+
|
48
|
+
// Call the before filter and if it returns false, run the
|
49
|
+
// route's original callback, and after filter. This allows
|
50
|
+
// the user to return false from within the before filter
|
51
|
+
// to prevent the original route callback and after
|
52
|
+
// filter from running.
|
53
|
+
var callbackArgs = [ route, _.toArray(arguments) ];
|
54
|
+
var beforeCallback;
|
55
|
+
|
56
|
+
if ( _.isFunction(this.before) ) {
|
57
|
+
|
58
|
+
// If the before filter is just a single function, then call
|
59
|
+
// it with the arguments.
|
60
|
+
beforeCallback = this.before;
|
61
|
+
} else if ( typeof this.before[route] !== "undefined" ) {
|
62
|
+
|
63
|
+
// otherwise, find the appropriate callback for the route name
|
64
|
+
// and call that.
|
65
|
+
beforeCallback = this.before[route];
|
66
|
+
} else {
|
67
|
+
|
68
|
+
// otherwise, if we have a hash of routes, but no before callback
|
69
|
+
// for this route, just use a nop function.
|
70
|
+
beforeCallback = nop;
|
71
|
+
}
|
72
|
+
|
73
|
+
// If the before callback fails during its execusion (by returning)
|
74
|
+
// false, then do not proceed with the route triggering.
|
75
|
+
if ( beforeCallback.apply(this, callbackArgs) === false ) {
|
76
|
+
return;
|
77
|
+
}
|
78
|
+
|
79
|
+
// If the callback exists, then call it. This means that the before
|
80
|
+
// and after filters will be called whether or not an actual
|
81
|
+
// callback function is supplied to handle a given route.
|
82
|
+
if( callback ) {
|
83
|
+
callback.apply( this, arguments );
|
84
|
+
}
|
85
|
+
|
86
|
+
var afterCallback;
|
87
|
+
if ( _.isFunction(this.after) ) {
|
88
|
+
|
89
|
+
// If the after filter is a single funciton, then call it with
|
90
|
+
// the proper arguments.
|
91
|
+
afterCallback = this.after;
|
92
|
+
|
93
|
+
} else if ( typeof this.after[route] !== "undefined" ) {
|
94
|
+
|
95
|
+
// otherwise if we have a hash of routes, call the appropriate
|
96
|
+
// callback based on the route name.
|
97
|
+
afterCallback = this.after[route];
|
98
|
+
|
99
|
+
} else {
|
100
|
+
|
101
|
+
// otherwise, if we have a has of routes but no after callback
|
102
|
+
// for this route, just use the nop function.
|
103
|
+
afterCallback = nop;
|
104
|
+
}
|
105
|
+
|
106
|
+
// Call the after filter.
|
107
|
+
afterCallback.apply( this, callbackArgs );
|
108
|
+
|
109
|
+
}, this);
|
110
|
+
|
111
|
+
// Call our original route, replacing the callback that was originally
|
112
|
+
// passed in when Backbone.Router.route was invoked with our wrapped
|
113
|
+
// callback that calls the before and after callbacks as well as the
|
114
|
+
// original callback.
|
115
|
+
return originalRoute.call( this, route, name, wrappedCallback );
|
116
|
+
}
|
117
|
+
|
118
|
+
});
|
119
|
+
|
120
|
+
}(Backbone, _));
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require js_stack/plugins/backbone/routefilter/0.2.0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js_stack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Pewiński
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml_coffee_assets
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- vendor/assets/javascripts/js_stack/plugins/backbone.deepmodel.js
|
123
123
|
- vendor/assets/javascripts/js_stack/plugins/backbone.mutators.js
|
124
124
|
- vendor/assets/javascripts/js_stack/plugins/backbone.pageable.js
|
125
|
+
- vendor/assets/javascripts/js_stack/plugins/backbone.routefilter.js
|
125
126
|
- vendor/assets/javascripts/js_stack/plugins/backbone.stickit.js
|
126
127
|
- vendor/assets/javascripts/js_stack/plugins/backbone.validation.js
|
127
128
|
- vendor/assets/javascripts/js_stack/plugins/backbone.virtualcollection.js
|
@@ -133,6 +134,7 @@ files:
|
|
133
134
|
- vendor/assets/javascripts/js_stack/plugins/backbone/mutators/0.4.1.js
|
134
135
|
- vendor/assets/javascripts/js_stack/plugins/backbone/pageable/1.3.2.js
|
135
136
|
- vendor/assets/javascripts/js_stack/plugins/backbone/pageable/1.4.5.js
|
137
|
+
- vendor/assets/javascripts/js_stack/plugins/backbone/routefilter/0.2.0.js
|
136
138
|
- vendor/assets/javascripts/js_stack/plugins/backbone/stickit/0.6.3.js
|
137
139
|
- vendor/assets/javascripts/js_stack/plugins/backbone/stickit/0.7.0.js
|
138
140
|
- vendor/assets/javascripts/js_stack/plugins/backbone/validation/0.8.1.js
|