mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
code for dashboard page
This commit is contained in:
parent
b6afd0602b
commit
2bfc558e91
24 changed files with 695 additions and 711 deletions
|
@ -37,6 +37,10 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
|||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
if (this.get('noFolder')) {
|
||||
return;
|
||||
}
|
||||
|
||||
let _this = this;
|
||||
this.get('templateService').getSavedTemplates().then(function(saved) {
|
||||
let emptyTemplate = {
|
||||
|
@ -57,12 +61,20 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
|||
},
|
||||
|
||||
didRender() {
|
||||
if (this.get('noFolder')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.get('folderService').get('canEditCurrentFolder')) {
|
||||
this.addTooltip(document.getElementById("start-document-button"));
|
||||
}
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
if (this.get('noFolder')) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.eventBus.subscribe('resized', this, 'positionTool');
|
||||
this.eventBus.subscribe('scrolled', this, 'positionTool');
|
||||
},
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
|
@ -38,11 +38,11 @@ export default Ember.Controller.extend({
|
|||
this.get('session').authenticate('authenticator:documize', creds)
|
||||
.then((response) => {
|
||||
this.get('audit').record("logged-in");
|
||||
this.transitionToRoute('folders.folder');
|
||||
this.transitionToRoute('folders');
|
||||
return response;
|
||||
}).catch(() => {
|
||||
this.set('invalidCredentials', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
|
@ -24,7 +24,11 @@ export default Ember.Route.extend({
|
|||
if (config.environment === 'test') {
|
||||
this.transitionTo('auth.login');
|
||||
} else {
|
||||
window.document.location = this.get("appMeta.allowAnonymousAccess") ? "/" : "/auth/login";
|
||||
if (this.get("appMeta.allowAnonymousAccess")) {
|
||||
this.transitionTo('folders');
|
||||
} else {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({});
|
||||
export default Ember.Route.extend({
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
|
@ -17,10 +17,10 @@ export default Ember.Route.extend({
|
|||
model({ token }) {
|
||||
this.get("session").authenticate('authenticator:documize', decodeURIComponent(token))
|
||||
.then(() => {
|
||||
this.transitionTo('folders.folder');
|
||||
this.transitionTo('folders');
|
||||
}, () => {
|
||||
this.transitionTo('auth.login');
|
||||
console.log(">>>>> Documize SSO failure");
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
{{#each folders as |folder|}}
|
||||
<tr>
|
||||
<td class="bordered">
|
||||
{{#link-to 'folders.folder' folder.id folder.slug class="alt"}}{{folder.name}}{{/link-to}}
|
||||
{{#link-to 'folder' folder.id folder.slug class="alt"}}{{folder.name}}{{/link-to}}
|
||||
</td>
|
||||
<td class="bordered">
|
||||
{{#each folder.sharedWith as |person|}}
|
||||
|
|
|
@ -239,7 +239,7 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
this.get('documentService').deleteDocument(this.get('model.id')).then(function () {
|
||||
self.audit.record("deleted-page");
|
||||
self.send("showNotification", "Deleted");
|
||||
self.transitionToRoute('folders.folder', self.get('folder.id'), self.get('folder.slug'));
|
||||
self.transitionToRoute('folder', self.get('folder.id'), self.get('folder.slug'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
|
@ -71,7 +71,7 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
|
||||
this.get('folderService').add({ name: folder }).then(function (newFolder) {
|
||||
self.get('folderService').setCurrentFolder(newFolder);
|
||||
self.transitionToRoute('folders.folder', newFolder.get('id'), newFolder.get('slug'));
|
||||
self.transitionToRoute('folder', newFolder.get('id'), newFolder.get('slug'));
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,14 +1,29 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend({});
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
folderService: Ember.inject.service('folder'),
|
||||
|
||||
actions: {
|
||||
onFolderAdd(folder) {
|
||||
let self = this;
|
||||
this.showNotification("Added");
|
||||
|
||||
this.get('folderService').add({ name: folder }).then(function (newFolder) {
|
||||
self.get('folderService').setCurrentFolder(newFolder);
|
||||
self.transitionToRoute('folder', newFolder.get('id'), newFolder.get('slug'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -11,74 +11,11 @@
|
|||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
import { isNotFoundError } from 'ember-ajax/errors';
|
||||
|
||||
const {
|
||||
isPresent
|
||||
} = Ember;
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
folderService: Ember.inject.service('folder'),
|
||||
localStorage: Ember.inject.service(),
|
||||
folder: {},
|
||||
|
||||
model: function () {
|
||||
return this.get('folderService').getAll();
|
||||
},
|
||||
|
||||
afterModel: function (model) {
|
||||
let params = this.paramsFor('folders.folder');
|
||||
|
||||
if (is.empty(params)) {
|
||||
let lastFolder = this.get('localStorage').getSessionItem("folder");
|
||||
let self = this;
|
||||
|
||||
//If folder lastFolder is defined
|
||||
if (isPresent(lastFolder)) {
|
||||
return this.get('folderService').getFolder(lastFolder).then((folder) => {
|
||||
//if Response is null or undefined redirect to login else transitionTo dashboard
|
||||
if (Ember.isNone(folder)) {
|
||||
self.get('localStorage').clearSessionItem("folder");
|
||||
this.transitionTo('application');
|
||||
}
|
||||
|
||||
Ember.set(this, 'folder', folder);
|
||||
this.transitionTo('folders.folder', folder.get('id'), folder.get('slug'));
|
||||
}).catch(() => {
|
||||
//if there was an error redirect to login
|
||||
self.get('localStorage').clearSessionItem("folder");
|
||||
this.transitionTo('application');
|
||||
});
|
||||
}
|
||||
|
||||
// If model has any folders redirect to dashboard
|
||||
if (model.get('length') > 0) {
|
||||
let folder = model[0];
|
||||
Ember.set(this, 'folder', folder);
|
||||
this.transitionTo('folders.folder', folder.get('id'), folder.get('slug'));
|
||||
}
|
||||
}
|
||||
|
||||
//If folder route has params
|
||||
if (isPresent(params)) {
|
||||
let self = this;
|
||||
let folderId = this.paramsFor('folders.folder').folder_id;
|
||||
|
||||
return this.get('folderService').getFolder(folderId).then((folder) => {
|
||||
Ember.set(this, 'folder', folder);
|
||||
}).catch(function (error) {
|
||||
if (isNotFoundError(error)) {
|
||||
// handle 404 errors here
|
||||
self.transitionTo('application');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.browser.setMetaDescription();
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.set('folder', this.folder);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1 +1,8 @@
|
|||
{{outlet}}
|
||||
{{layout/zone-navigation}}
|
||||
|
||||
{{#layout/zone-sidebar}}
|
||||
{{folder/folders-list folders=model noFolder=true onFolderAdd=(action 'onFolderAdd')}}
|
||||
{{/layout/zone-sidebar}}
|
||||
|
||||
{{#layout/zone-content}}
|
||||
{{/layout/zone-content}}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
|
||||
const {
|
||||
inject: { service }
|
||||
|
@ -119,7 +119,7 @@ export default Ember.Route.extend(NotifierMixin, {
|
|||
|
||||
this.get('folderService').getFolder(moveId).then((folder) => {
|
||||
this.get('folderService').setCurrentFolder(folder);
|
||||
this.transitionTo('folders.folder', folder.get('id'), folder.get('slug'));
|
||||
this.transitionTo('folder', folder.get('id'), folder.get('slug'));
|
||||
});
|
||||
});
|
||||
},
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
{{#layout/zone-sidebar}}
|
||||
{{#layout/sidebar-intro message='Rename, delete, share and manage space permissions'}}
|
||||
{{#link-to 'folders.folder' model.id model.slug}}
|
||||
{{#link-to 'folder' model.id model.slug}}
|
||||
<i class="material-icons">arrow_back</i> {{model.name}}
|
||||
{{/link-to}}
|
||||
{{/layout/sidebar-intro}}
|
|
@ -19,13 +19,14 @@ var Router = Ember.Router.extend({
|
|||
export default Router.map(function () {
|
||||
this.route('folders', {
|
||||
path: '/'
|
||||
}, function () {
|
||||
this.route('folder', {
|
||||
path: 's/:folder_id/:folder_slug'
|
||||
});
|
||||
this.route('settings', {
|
||||
path: 's/:folder_id/:folder_slug/settings'
|
||||
});
|
||||
});
|
||||
|
||||
this.route('folder', {
|
||||
path: 's/:folder_id/:folder_slug'
|
||||
});
|
||||
|
||||
this.route('settings', {
|
||||
path: 's/:folder_id/:folder_slug/settings'
|
||||
});
|
||||
|
||||
this.route('document', {
|
||||
|
|
|
@ -38,6 +38,8 @@ export default Ember.Route.extend(ApplicationRouteMixin, {
|
|||
|
||||
error(error /*, transition*/ ) {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
|
||||
if (netUtil.isAjaxAccessError(error)) {
|
||||
localStorage.clear();
|
||||
return this.transitionTo('auth.login');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{{#link-to 'folders.folder' folder.id folder.slug}}
|
||||
{{#link-to 'folder' folder.id folder.slug}}
|
||||
<div class="zone-sidebar-title">
|
||||
<i class="material-icons">arrow_back</i> {{folder.name}}
|
||||
</div>
|
||||
|
|
|
@ -29,13 +29,13 @@
|
|||
{{/dropdown-dialog}}
|
||||
{{else}}
|
||||
{{#if isFolderOwner}}
|
||||
{{#link-to 'folders.settings' folder.id folder.slug (query-params tab="tabShare")}}
|
||||
{{#link-to 'settings' folder.id folder.slug (query-params tab="tabShare")}}
|
||||
<div class="round-button-mono" id="folder-share-button" data-tooltip="Share" data-tooltip-position="top center">
|
||||
<i class="material-icons color-gray">share</i>
|
||||
</div>
|
||||
{{/link-to}}
|
||||
<div class="button-gap"></div>
|
||||
{{#link-to 'folders.settings' folder.id folder.slug}}
|
||||
{{#link-to 'settings' folder.id folder.slug}}
|
||||
<div class="round-button-mono" id="folder-settings-button" data-tooltip="Settings" data-tooltip-position="top center">
|
||||
<i class="material-icons color-gray">settings</i>
|
||||
</div>
|
||||
|
|
|
@ -1,30 +1,32 @@
|
|||
<div class="space-tools">
|
||||
{{#if showingDocument}}
|
||||
{{layout/sidebar-intro title=folder.name message='Import files or start with a template'}}
|
||||
<div {{action 'showList'}} id="cancel-tool" class="round-button round-button-mono button-white doc-tool">
|
||||
<i class="material-icons color-gray">close</i>
|
||||
</div>
|
||||
{{#unless noFolder}}
|
||||
<div class="space-tools">
|
||||
{{#if showingDocument}}
|
||||
{{layout/sidebar-intro title=folder.name message='Import files or start with a template'}}
|
||||
<div {{action 'showList'}} id="cancel-tool" class="round-button round-button-mono button-white doc-tool">
|
||||
<i class="material-icons color-gray">close</i>
|
||||
</div>
|
||||
|
||||
{{folder/start-document savedTemplates=savedTemplates folder=folder editor=folderService.canEditCurrentFolder
|
||||
onImport=(action 'onImport')
|
||||
onEditTemplate=(action 'onEditTemplate')
|
||||
onDocumentTemplate=(action 'onDocumentTemplate')}}
|
||||
{{/if}}
|
||||
{{folder/start-document savedTemplates=savedTemplates folder=folder editor=folderService.canEditCurrentFolder
|
||||
onImport=(action 'onImport')
|
||||
onEditTemplate=(action 'onEditTemplate')
|
||||
onDocumentTemplate=(action 'onDocumentTemplate')}}
|
||||
{{/if}}
|
||||
|
||||
{{#if showScrollTool}}
|
||||
<div {{action 'scrollTop'}} id="scroll-space-tool" class="round-button round-button-mono button-white scroll-space-tool" data-tooltip="Back to top" data-tooltip-position="top center">
|
||||
<i class="material-icons color-gray">vertical_align_top</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if showingList}}
|
||||
{{#if folderService.canEditCurrentFolder}}
|
||||
<div {{action 'showDocument'}} class="round-button button-green doc-tool" data-tooltip="Document" data-tooltip-position="top center">
|
||||
<i class="material-icons">add</i>
|
||||
{{#if showScrollTool}}
|
||||
<div {{action 'scrollTop'}} id="scroll-space-tool" class="round-button round-button-mono button-white scroll-space-tool" data-tooltip="Back to top" data-tooltip-position="top center">
|
||||
<i class="material-icons color-gray">vertical_align_top</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#if showingList}}
|
||||
{{#if folderService.canEditCurrentFolder}}
|
||||
<div {{action 'showDocument'}} class="round-button button-green doc-tool" data-tooltip="Document" data-tooltip-position="top center">
|
||||
<i class="material-icons">add</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
||||
<div class="folders-list">
|
||||
{{#if showingList}}
|
||||
|
@ -52,7 +54,7 @@
|
|||
{{/unless}}
|
||||
<ul class="list">
|
||||
{{#each publicFolders as |folder|}}
|
||||
{{#link-to 'folders.folder' folder.id folder.slug class="link" activeClass='selected' }}
|
||||
{{#link-to 'folder' folder.id folder.slug class="link" activeClass='selected' }}
|
||||
<li class="item">{{ folder.name }}</li>
|
||||
{{/link-to}}
|
||||
{{/each}}
|
||||
|
@ -67,7 +69,7 @@
|
|||
{{/unless}}
|
||||
<ul class="list">
|
||||
{{#each protectedFolders as |folder|}}
|
||||
{{#link-to 'folders.folder' folder.id folder.slug class="link" activeClass='selected' }}
|
||||
{{#link-to 'folder' folder.id folder.slug class="link" activeClass='selected' }}
|
||||
<li class="item">{{ folder.name }}</li>
|
||||
{{/link-to}}
|
||||
{{/each}}
|
||||
|
@ -81,7 +83,7 @@
|
|||
{{/unless}}
|
||||
<ul class="list">
|
||||
{{#each privateFolders as |folder|}}
|
||||
{{#link-to 'folders.folder' folder.id folder.slug class="link" activeClass='selected' }}
|
||||
{{#link-to 'folder' folder.id folder.slug class="link" activeClass='selected' }}
|
||||
<li class="item">{{ folder.name }}</li>
|
||||
{{/link-to}}
|
||||
{{/each}}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</li>
|
||||
{{else}}
|
||||
<li>
|
||||
{{#link-to 'application' class='title'}}
|
||||
{{#link-to 'folders' class='title'}}
|
||||
<div class="filled-tool" title={{appMeta.title}}>
|
||||
<i class="material-icons">apps</i>
|
||||
</div>
|
||||
|
|
|
@ -32,8 +32,8 @@ module.exports = function (environment) {
|
|||
},
|
||||
'ember-simple-auth': {
|
||||
authenticationRoute: 'auth.login',
|
||||
routeAfterAuthentication: 'folders.folder',
|
||||
routeIfAlreadyAuthenticated: 'folders.folder'
|
||||
routeAfterAuthentication: 'folders',
|
||||
routeIfAlreadyAuthenticated: 'folders'
|
||||
},
|
||||
APP: {
|
||||
// Allows to disable audit service in tests
|
||||
|
@ -45,6 +45,9 @@ module.exports = function (environment) {
|
|||
if (environment === 'development') {
|
||||
ENV.APP.LOG_TRANSITIONS = true;
|
||||
ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
||||
ENV.APP.LOG_RESOLVER = false;
|
||||
ENV.APP.LOG_ACTIVE_GENERATION = false;
|
||||
ENV.APP.LOG_VIEW_LOOKUPS = false;
|
||||
ENV['ember-cli-mirage'] = {
|
||||
enabled: false
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue