ende 0.4.9 → 0.4.10
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: 0fc9c6c31d442ac247768f50ad286ad4e8dbce85
|
4
|
+
data.tar.gz: 489e144991e680cc2c4acd0a88d86f00a3b848f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43c4843d241235d9a3436c959b48a43e5cf23adf9596de3c1949769b59e741405f147a5694a5bcfedae5c08b1151949e77416e603b1fcdf8c2defd22ef44e1bf
|
7
|
+
data.tar.gz: d6161fd43cf529c16e4245172ab8c41dd05edf22a3c6ce248a9e877ab64a99563b5cbd5d5b3b9e5d0d9114df7c4a663aa600f87f515b3050d28d0fdee6083abe
|
@@ -135,23 +135,26 @@ define 'aura/extensions/devise', ->
|
|
135
135
|
# TODO better resource deletion control, create interface to
|
136
136
|
# make delete requests
|
137
137
|
|
138
|
-
|
139
|
-
.
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
138
|
+
succeeded = (response, status, xhr) ->
|
139
|
+
sandbox.current_user = null
|
140
|
+
sandbox.signed_in = false
|
141
|
+
mediator.emit 'user.signed_out', @
|
142
|
+
|
143
|
+
# When the user logs in, the csrf token changes, so we need
|
144
|
+
# to update it too! The ende gem extends the controller when
|
145
|
+
# devise is included to send it to us
|
146
|
+
# TODO implement as a indemma extension
|
147
|
+
token = xhr.getResponseHeader 'X-CSRF-Token'
|
148
|
+
console.warn "Server did not send the new csrf token.\n User may not be able to log in again!" unless token
|
149
|
+
$('meta[name="csrf-token"]').attr 'content', token
|
150
|
+
|
151
|
+
session.instance.destroy().done(succeeded)
|
152
|
+
.fail (xhr, status) ->
|
153
|
+
switch (xhr.status)
|
154
|
+
when 12152
|
155
|
+
succeeded.call @, xhr.responseText, status, xhr
|
156
|
+
else
|
157
|
+
mediator.emit 'session.destruction_failed', @
|
155
158
|
|
156
159
|
|
157
160
|
# user_password POST /users/password(.:format) devise/passwords#create
|
@@ -1,100 +1,98 @@
|
|
1
|
-
|
2
|
-
'use strict';
|
1
|
+
'use strict';
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
define('aura/extensions/mediator', {
|
4
|
+
name: 'mediator',
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
},
|
12
|
-
shim: {
|
13
|
-
underscore: {
|
14
|
-
exports: '_'
|
15
|
-
}
|
16
|
-
}
|
6
|
+
require: {
|
7
|
+
paths: {
|
8
|
+
eventemitter: 'components/eventemitter2/lib/eventemitter2',
|
9
|
+
underscore: 'components/underscore/underscore'
|
17
10
|
},
|
11
|
+
shim: {
|
12
|
+
underscore: {
|
13
|
+
exports: '_'
|
14
|
+
}
|
15
|
+
}
|
16
|
+
},
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
app.config.mediator = _.defaults(app.config.mediator || {}, {
|
26
|
-
wildcard: true,
|
27
|
-
delimiter: '.',
|
28
|
-
newListener: true,
|
29
|
-
maxListeners: 20
|
30
|
-
});
|
31
|
-
|
32
|
-
var mediator = new EventEmitter(app.config.mediator);
|
18
|
+
initialize: function (app) {
|
19
|
+
var with_aura = 'eventemitter';
|
20
|
+
var EventEmitter = require(with_aura);
|
21
|
+
with_aura = 'underscore'
|
22
|
+
var _ = require(with_aura);
|
33
23
|
|
34
|
-
|
24
|
+
app.config.mediator = _.defaults(app.config.mediator || {}, {
|
25
|
+
wildcard: true,
|
26
|
+
delimiter: '.',
|
27
|
+
newListener: true,
|
28
|
+
maxListeners: 20
|
29
|
+
});
|
35
30
|
|
36
|
-
|
37
|
-
return function (name, listener, context) {
|
38
|
-
if (!_.isFunction(listener) || !_.isString(name)) {
|
39
|
-
throw new Error('Invalid arguments passed to sandbox.' + listenerType);
|
40
|
-
}
|
41
|
-
context = context || this;
|
42
|
-
var callback = function() {
|
43
|
-
var args = Array.prototype.slice.call(arguments);
|
44
|
-
try {
|
45
|
-
listener.apply(context, args);
|
46
|
-
} catch(e) {
|
47
|
-
var message = "Event emission error on context: " + (context._ref || context) + "\n";
|
48
|
-
message += "With message " + (e.message || e) + "\n";
|
49
|
-
message += "Trying to emit event " + name + "\n";
|
50
|
-
message += "Failed on listener: \n " + (listener.name || listener) + "\n";
|
51
|
-
e.stack && (message += e.stack);
|
31
|
+
var mediator = new EventEmitter(app.config.mediator);
|
52
32
|
|
53
|
-
|
54
|
-
app.logger.error("emission.error", message, 'Context:', context, 'Exception:', e);
|
55
|
-
}
|
56
|
-
};
|
33
|
+
app.core.mediator = mediator;
|
57
34
|
|
58
|
-
|
59
|
-
|
35
|
+
var attachListener = function(listenerType) {
|
36
|
+
return function (name, listener, context) {
|
37
|
+
if (!_.isFunction(listener) || !_.isString(name)) {
|
38
|
+
throw new Error('Invalid arguments passed to sandbox.' + listenerType);
|
39
|
+
}
|
40
|
+
context = context || this;
|
41
|
+
var callback = function() {
|
42
|
+
var args = Array.prototype.slice.call(arguments);
|
43
|
+
try {
|
44
|
+
listener.apply(context, args);
|
45
|
+
} catch(e) {
|
46
|
+
var message = "Event emission error on context: " + (context._ref || context) + "\n";
|
47
|
+
message += "With message " + (e.message || e) + "\n";
|
48
|
+
message += "Trying to emit event " + name + "\n";
|
49
|
+
message += "Failed on listener: \n " + (listener.name || listener) + "\n";
|
50
|
+
e.stack && (message += e.stack);
|
60
51
|
|
61
|
-
|
52
|
+
mediator.emit("emission.error", context);
|
53
|
+
app.logger.error("emission.error", message, 'Context:', context, 'Exception:', e);
|
54
|
+
}
|
62
55
|
};
|
63
|
-
};
|
64
56
|
|
65
|
-
|
66
|
-
|
57
|
+
this._events = this._events || [];
|
58
|
+
this._events.push({ name: name, listener: listener, callback: callback });
|
67
59
|
|
68
|
-
|
69
|
-
if(!this._events) { return; }
|
70
|
-
this._events = _.reject(this._events, function (evt) {
|
71
|
-
var ret = (evt.name === name && evt.listener === listener);
|
72
|
-
if (ret) { mediator.off(name, evt.callback); }
|
73
|
-
return ret;
|
74
|
-
});
|
60
|
+
mediator[listenerType](name, callback);
|
75
61
|
};
|
62
|
+
};
|
76
63
|
|
77
|
-
|
78
|
-
|
79
|
-
if(debug.enable && (debug.components.length === 0 || debug.components.indexOf("aura:mediator") !== -1)){
|
80
|
-
var eventData = Array.prototype.slice.call(arguments);
|
81
|
-
eventData.unshift('Event emitted');
|
82
|
-
app.logger.log.apply(app.logger, eventData);
|
83
|
-
}
|
84
|
-
mediator.emit.apply(mediator, arguments);
|
85
|
-
};
|
64
|
+
app.sandbox.on = attachListener('on');
|
65
|
+
app.sandbox.once = attachListener('once');
|
86
66
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
67
|
+
app.sandbox.off = function (name, listener) {
|
68
|
+
if(!this._events) { return; }
|
69
|
+
this._events = _.reject(this._events, function (evt) {
|
70
|
+
var ret = (evt.name === name && evt.listener === listener);
|
71
|
+
if (ret) { mediator.off(name, evt.callback); }
|
72
|
+
return ret;
|
73
|
+
});
|
74
|
+
};
|
93
75
|
|
94
|
-
|
95
|
-
app.
|
96
|
-
|
76
|
+
app.sandbox.emit = function () {
|
77
|
+
var debug = app.config.debug;
|
78
|
+
if(debug.enable && (debug.components.length === 0 || debug.components.indexOf("aura:mediator") !== -1)){
|
79
|
+
var eventData = Array.prototype.slice.call(arguments);
|
80
|
+
eventData.unshift('Event emitted');
|
81
|
+
app.logger.log.apply(app.logger, eventData);
|
82
|
+
}
|
83
|
+
mediator.emit.apply(mediator, arguments);
|
84
|
+
};
|
85
|
+
|
86
|
+
app.sandbox.stopListening = function () {
|
87
|
+
if (!this._events) { return; }
|
88
|
+
_.each(this._events, function (evt) {
|
89
|
+
mediator.off(evt.name, evt.callback);
|
97
90
|
});
|
98
|
-
}
|
99
|
-
|
91
|
+
};
|
92
|
+
|
93
|
+
var eventName = ['aura', 'sandbox', 'stop'].join(app.config.mediator.delimiter);
|
94
|
+
app.core.mediator.on(eventName, function (sandbox) {
|
95
|
+
sandbox.stopListening();
|
96
|
+
});
|
97
|
+
}
|
100
98
|
});
|
@@ -82,13 +82,14 @@ define
|
|
82
82
|
# abort
|
83
83
|
when 0
|
84
84
|
# TODO default abort message
|
85
|
-
|
85
|
+
# TODO better abort check: http://ilikestuffblog.com/2009/11/30/how-to-distinguish-a-user-aborted-ajax-call-from-an-error/
|
86
|
+
@sandbox.emit "content.#{@identifier}.loading_aborted", @
|
86
87
|
# forbidden
|
87
88
|
when 401
|
88
89
|
# TODO default forbidden message
|
89
|
-
@sandbox.emit "content.#{@identifier}.loading_unauthorized"
|
90
|
+
@sandbox.emit "content.#{@identifier}.loading_unauthorized", @
|
90
91
|
else
|
91
|
-
@sandbox.emit "content.#{@identifier}.loading_failed"
|
92
|
+
@sandbox.emit "content.#{@identifier}.loading_failed", @
|
92
93
|
|
93
94
|
# TODO better debugging code location
|
94
95
|
if @sandbox.debug.enabled
|
data/lib/ende/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ende
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heitor Salazar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|