ember-auth-module-action_redirectable-source 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7f90bd0a338cde705fbeb22a2d8406d012b7f625
4
+ data.tar.gz: a54f7e72ab588e6259ed7c78df6ff618dec770e4
5
+ SHA512:
6
+ metadata.gz: cd343006f64bde474dda3f4215f5bc9da1bd9fd296cfcf59b22683c143ab06cacde2395c5a314d980054a37665b4276964c24fa8eb49e739ef4ce29bfba22d95
7
+ data.tar.gz: 202bac743d6e105d003b552ac9e250952835337c60a4d3ab75d05f256a2877129627000678ebb44b31707b3dc6119cdf5b34b8308f94d93ddc98f478c74e0bcf
@@ -0,0 +1,115 @@
1
+ // Generated by EmberScript 0.0.7
2
+ var get$ = Ember.get;
3
+ Em.onLoad('Ember.Application', function (application) {
4
+ return application.initializer({
5
+ name: 'ember-auth.module.action-redirectable',
6
+ before: 'ember-auth-load',
7
+ initialize: function (container, app) {
8
+ return app.register('authModule:actionRedirectable', get$(get$(Em, 'Auth'), 'ActionRedirectableAuthModule'));
9
+ }
10
+ });
11
+ });
12
+ Em.onLoad('Ember.Application', function (application) {
13
+ return application.initializer({
14
+ name: 'ember-auth.module.action-redirectable.inject',
15
+ after: 'ember-auth.module.action-redirectable',
16
+ initialize: function (container, app) {
17
+ app.inject('authModule:actionRedirectable', 'router', 'router:main');
18
+ return get$(Em, 'Route').reopen({
19
+ beforeModel: function (queryParams, transition) {
20
+ if (!(null != transition))
21
+ transition = queryParams;
22
+ get$(get$(get$(this, 'auth'), 'module'), 'actionRedirectable').registerRedirect(transition);
23
+ return this._super.apply(this, arguments);
24
+ }
25
+ });
26
+ }
27
+ });
28
+ });// Generated by EmberScript 0.0.7
29
+ var get$ = Ember.get;
30
+ var set$ = Ember.set;
31
+ set$(get$(Em, 'Auth'), 'ActionRedirectableAuthModule', Ember.Object.extend({
32
+ init: function () {
33
+ null != get$(this, 'config') || set$(this, 'config', get$(get$(this, 'auth'), 'actionRedirectable'));
34
+ get$(this, 'auth').addHandler('signInSuccess', get$(this, 'redirect'));
35
+ return get$(this, 'auth').addHandler('signOutSuccess', get$(this, 'redirect'));
36
+ },
37
+ signInRedir: null,
38
+ signOutRedir: null,
39
+ registerRedirect: function (transition) {
40
+ var routeName;
41
+ routeName = this.canonicalizeRoute(get$(transition, 'targetName'));
42
+ if (!in$(routeName, this.getBlacklist('signIn')))
43
+ set$(this, 'signInRedir', transition);
44
+ if (!in$(routeName, this.getBlacklist('signOut')))
45
+ return set$(this, 'signOutRedir', transition);
46
+ },
47
+ canonicalizeRoute: function (route) {
48
+ var endsWith;
49
+ if (!(typeof route === 'string'))
50
+ return '';
51
+ endsWith = function (haystack, needle) {
52
+ var d;
53
+ d = get$(haystack, 'length') - get$(needle, 'length');
54
+ return d >= 0 && haystack.lastIndexOf(needle) === d;
55
+ };
56
+ if (!endsWith(route, '.index'))
57
+ return route;
58
+ return route.substr(0, route.lastIndexOf('.index'));
59
+ },
60
+ getBlacklist: function (env) {
61
+ var blacklist;
62
+ if (!(blacklist = get$(this, 'config')['' + env + 'Blacklist']))
63
+ return [];
64
+ return function (accum$) {
65
+ var route;
66
+ for (var i$ = 0, length$ = blacklist.length; i$ < length$; ++i$) {
67
+ route = blacklist[i$];
68
+ accum$.push(this.canonicalizeRoute(route));
69
+ }
70
+ return accum$;
71
+ }.call(this, []);
72
+ },
73
+ resolveRedirect: function (env) {
74
+ var fallback, isSmart;
75
+ if (!(env === 'signIn' || env === 'signOut'))
76
+ return null;
77
+ isSmart = get$(this, 'config')['' + env + 'Smart'];
78
+ fallback = this.canonicalizeRoute(get$(this, 'config')['' + env + 'Route']);
79
+ if (!fallback)
80
+ return null;
81
+ if (!isSmart)
82
+ return fallback;
83
+ return this.get('' + env + 'Redir') || fallback;
84
+ },
85
+ redirect: function () {
86
+ var env, result;
87
+ env = get$(get$(this, 'auth'), 'signedIn') ? 'signIn' : 'signOut';
88
+ if (!(result = this.resolveRedirect(env)))
89
+ return;
90
+ switch (typeof result) {
91
+ case 'object':
92
+ return result.retry();
93
+ case 'string':
94
+ return get$(this, 'router').transitionTo(result);
95
+ }
96
+ }
97
+ }));
98
+ function in$(member, list) {
99
+ for (var i = 0, length = list.length; i < length; ++i)
100
+ if (i in list && list[i] === member)
101
+ return true;
102
+ return false;
103
+ };
104
+ // Generated by EmberScript 0.0.7
105
+ var get$ = Ember.get;
106
+ get$(Em, 'Auth').reopen({
107
+ actionRedirectable: {
108
+ signInRoute: false,
109
+ signOutRoute: false,
110
+ signInSmart: false,
111
+ signOutSmart: false,
112
+ signInBlacklist: [],
113
+ signOutBlacklist: []
114
+ }
115
+ });
@@ -0,0 +1,15 @@
1
+ module Ember
2
+ module Auth
3
+ module Module
4
+ module ActionRedirectable
5
+ module Source
6
+ def self.bundled_path
7
+ path = File.join '..', '..', '..', '..', '..', '..', \
8
+ 'dist', 'ember-auth-module-action-redirectable.js'
9
+ File.expand_path path, __FILE__
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ember-auth-module-action_redirectable-source
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - heartsentwined
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ember-source
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ember-auth-source
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '9.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '9.0'
41
+ description: Ember-auth action redirectable module source code wrapper for ruby libs.
42
+ email:
43
+ - heartsentwined.me@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - dist/ember-auth-module-action-redirectable.js
49
+ - lib/ember/auth/module/action_redirectable/source.rb
50
+ homepage: https://github.com/heartsentwined/ember-auth-module-action-redirectable
51
+ licenses:
52
+ - MIT
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.0.3
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: Ember-auth action redirectable module source code wrapper
74
+ test_files: []