Skip to content

Commit cc353fb

Browse files
Merge pull request #57 from documize/refactor-folder-routers
Refactor space routes
2 parents b6afd06 + acb83f2 commit cc353fb

33 files changed

+710
-778
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The mission is to bring software dev inspired features (refactoring, testing, li
88

99
## Latest version
1010

11-
v0.29.0
11+
v0.30.0
1212

1313
## OS Support
1414

app/app/components/back-to-home.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/app/components/document/document-sidebar-toc.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
5252
this.destroyTooltips();
5353
},
5454

55-
// positionToc() {
56-
// let s = $(".document-structure");
57-
// let pos = s.position();
58-
//
59-
// $(window).scroll(_.throttle(function() {
60-
// let windowpos = $(window).scrollTop();
61-
// if (windowpos - 200 >= pos.top) {
62-
// s.addClass("stuck-toc");
63-
// s.css('width', s.parent().width());
64-
// } else {
65-
// s.removeClass("stuck-toc");
66-
// s.css('width', 'auto');
67-
// }
68-
// }, 50));
69-
// },
70-
7155
onDocumentPageAdded(pageId) {
7256
this.send('onEntryClick', pageId);
7357
},

app/app/components/folder/folders-list.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
3737
init() {
3838
this._super(...arguments);
3939

40+
if (this.get('noFolder')) {
41+
return;
42+
}
43+
4044
let _this = this;
4145
this.get('templateService').getSavedTemplates().then(function(saved) {
4246
let emptyTemplate = {
@@ -57,12 +61,20 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
5761
},
5862

5963
didRender() {
64+
if (this.get('noFolder')) {
65+
return;
66+
}
67+
6068
if (this.get('folderService').get('canEditCurrentFolder')) {
6169
this.addTooltip(document.getElementById("start-document-button"));
6270
}
6371
},
6472

6573
didInsertElement() {
74+
if (this.get('noFolder')) {
75+
return;
76+
}
77+
6678
this.eventBus.subscribe('resized', this, 'positionTool');
6779
this.eventBus.subscribe('scrolled', this, 'positionTool');
6880
},

app/app/components/folder/start-document.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ export default Ember.Component.extend(NotifierMixin, {
2424
this.setupImport();
2525
},
2626

27+
willDestroyElement() {
28+
if (is.not.null(this.get('drop'))) {
29+
this.get('drop').destroy();
30+
this.set('drop', null);
31+
}
32+
},
33+
2734
setupImport() {
2835
// already done init?
2936
if (is.not.null(this.get('drop'))) {
30-
if (is.not.null(this.get('drop'))) {
31-
this.get('drop').destroy();
32-
this.set('drop', null);
33-
}
37+
this.get('drop').destroy();
38+
this.set('drop', null);
3439
}
3540

3641
let self = this;

app/app/components/layout/zone-container.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

app/app/pods/auth/login/controller.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2016 Documize Inc. <[email protected]>. All rights reserved.
22
//
3-
// This software (Documize Community Edition) is licensed under
3+
// This software (Documize Community Edition) is licensed under
44
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
55
//
66
// You can operate outside the AGPL restrictions by purchasing
77
// Documize Enterprise Edition and obtaining a commercial license
8-
// by contacting <[email protected]>.
8+
// by contacting <[email protected]>.
99
//
1010
// https://documize.com
1111

@@ -38,11 +38,11 @@ export default Ember.Controller.extend({
3838
this.get('session').authenticate('authenticator:documize', creds)
3939
.then((response) => {
4040
this.get('audit').record("logged-in");
41-
this.transitionToRoute('folders.folder');
41+
this.transitionToRoute('folders');
4242
return response;
4343
}).catch(() => {
4444
this.set('invalidCredentials', true);
4545
});
4646
}
4747
}
48-
});
48+
});

app/app/pods/auth/logout/route.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2016 Documize Inc. <[email protected]>. All rights reserved.
22
//
3-
// This software (Documize Community Edition) is licensed under
3+
// This software (Documize Community Edition) is licensed under
44
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
55
//
66
// You can operate outside the AGPL restrictions by purchasing
77
// Documize Enterprise Edition and obtaining a commercial license
8-
// by contacting <[email protected]>.
8+
// by contacting <[email protected]>.
99
//
1010
// https://documize.com
1111

@@ -24,7 +24,11 @@ export default Ember.Route.extend({
2424
if (config.environment === 'test') {
2525
this.transitionTo('auth.login');
2626
} else {
27-
window.document.location = this.get("appMeta.allowAnonymousAccess") ? "/" : "/auth/login";
27+
if (this.get("appMeta.allowAnonymousAccess")) {
28+
this.transitionTo('folders');
29+
} else {
30+
this.transitionTo('auth.login');
31+
}
2832
}
2933
}
30-
});
34+
});

app/app/pods/auth/route.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
// Copyright 2016 Documize Inc. <[email protected]>. All rights reserved.
22
//
3-
// This software (Documize Community Edition) is licensed under
3+
// This software (Documize Community Edition) is licensed under
44
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
55
//
66
// You can operate outside the AGPL restrictions by purchasing
77
// Documize Enterprise Edition and obtaining a commercial license
8-
// by contacting <[email protected]>.
8+
// by contacting <[email protected]>.
99
//
1010
// https://documize.com
1111

1212
import Ember from 'ember';
1313

14-
export default Ember.Route.extend({});
14+
export default Ember.Route.extend({
15+
});

app/app/pods/auth/sso/route.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2016 Documize Inc. <[email protected]>. All rights reserved.
22
//
3-
// This software (Documize Community Edition) is licensed under
3+
// This software (Documize Community Edition) is licensed under
44
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
55
//
66
// You can operate outside the AGPL restrictions by purchasing
77
// Documize Enterprise Edition and obtaining a commercial license
8-
// by contacting <[email protected]>.
8+
// by contacting <[email protected]>.
99
//
1010
// https://documize.com
1111

@@ -17,10 +17,10 @@ export default Ember.Route.extend({
1717
model({ token }) {
1818
this.get("session").authenticate('authenticator:documize', decodeURIComponent(token))
1919
.then(() => {
20-
this.transitionTo('folders.folder');
20+
this.transitionTo('folders');
2121
}, () => {
2222
this.transitionTo('auth.login');
2323
console.log(">>>>> Documize SSO failure");
2424
});
2525
},
26-
});
26+
});

0 commit comments

Comments
 (0)