mirror of
https://github.com/documize/community.git
synced 2025-07-24 07:39:43 +02:00
user/account store loading
This commit is contained in:
parent
620fe28b27
commit
f5f30d2322
27 changed files with 238 additions and 221 deletions
|
@ -11,11 +11,12 @@
|
|||
|
||||
import Ember from 'ember';
|
||||
import AuthProvider from '../../mixins/auth';
|
||||
import DropdownMixin from '../../mixins/dropdown';
|
||||
|
||||
export default Ember.Component.extend(AuthProvider, {
|
||||
export default Ember.Component.extend(AuthProvider, DropdownMixin, {
|
||||
editUser: null,
|
||||
deleteUser: null,
|
||||
drop: null,
|
||||
dropdown: null,
|
||||
password: {},
|
||||
filter: '',
|
||||
filteredUsers: [],
|
||||
|
@ -23,20 +24,22 @@ export default Ember.Component.extend(AuthProvider, {
|
|||
hasSelectedUsers: false,
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.users.forEach(user => {
|
||||
this._super(...arguments);
|
||||
|
||||
let users = this.get('users');
|
||||
|
||||
users.forEach(user => {
|
||||
user.set('me', user.get('id') === this.get('session.session.authenticated.user.id'));
|
||||
user.set('selected', false);
|
||||
});
|
||||
|
||||
this.set('filteredUsers', this.users);
|
||||
this.set('users', users);
|
||||
this.set('filteredUsers', users);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
let drop = this.get('drop');
|
||||
|
||||
if (is.not.null(drop)) {
|
||||
drop.destroy();
|
||||
}
|
||||
this._super(...arguments);
|
||||
this.destroyDropdown();
|
||||
},
|
||||
|
||||
onKeywordChange: function () {
|
||||
|
@ -109,6 +112,8 @@ export default Ember.Component.extend(AuthProvider, {
|
|||
$(".edit-user-dialog").css("display", "block");
|
||||
$("input").removeClass("error");
|
||||
|
||||
this.closeDropdown();
|
||||
|
||||
let drop = new Drop({
|
||||
target: $(".edit-button-" + id)[0],
|
||||
content: $(".edit-user-dialog")[0],
|
||||
|
@ -122,7 +127,7 @@ export default Ember.Component.extend(AuthProvider, {
|
|||
remove: false
|
||||
});
|
||||
|
||||
self.set('drop', drop);
|
||||
self.set('dropdown', drop);
|
||||
|
||||
drop.on('open', function () {
|
||||
self.$("#edit-firstname").focus();
|
||||
|
@ -134,6 +139,8 @@ export default Ember.Component.extend(AuthProvider, {
|
|||
this.set('deleteUser', user);
|
||||
$(".delete-user-dialog").css("display", "block");
|
||||
|
||||
this.closeDropdown();
|
||||
|
||||
let drop = new Drop({
|
||||
target: $(".delete-button-" + id)[0],
|
||||
content: $(".delete-user-dialog")[0],
|
||||
|
@ -147,12 +154,11 @@ export default Ember.Component.extend(AuthProvider, {
|
|||
remove: false
|
||||
});
|
||||
|
||||
this.set('drop', drop);
|
||||
this.set('dropdown', drop);
|
||||
},
|
||||
|
||||
cancel() {
|
||||
let drop = this.get('drop');
|
||||
drop.close();
|
||||
this.closeDropdown();
|
||||
},
|
||||
|
||||
save() {
|
||||
|
@ -172,8 +178,7 @@ export default Ember.Component.extend(AuthProvider, {
|
|||
return;
|
||||
}
|
||||
|
||||
let drop = this.get('drop');
|
||||
drop.close();
|
||||
this.closeDropdown();
|
||||
|
||||
this.attrs.onSave(user);
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import tocUtil from '../../utils/toc';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
import TooltipMixin from '../../mixins/tooltip';
|
||||
import tocUtil from '../../utils/toc';
|
||||
|
||||
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||
document: {},
|
||||
|
@ -30,7 +30,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
return this.get('pages.length') === 0;
|
||||
}),
|
||||
|
||||
didReceiveAttrs: function () {
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.set('showToc', is.not.undefined(this.get('pages')) && this.get('pages').get('length') > 0);
|
||||
|
@ -40,7 +40,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
}
|
||||
},
|
||||
|
||||
didRender: function () {
|
||||
didRender() {
|
||||
this._super(...arguments);
|
||||
|
||||
if (this.session.authenticated) {
|
||||
|
|
50
gui/app/components/document/document-sidebar.js
Normal file
50
gui/app/components/document/document-sidebar.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// 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>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
import TooltipMixin from '../../mixins/tooltip';
|
||||
|
||||
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||
tab: 'index',
|
||||
|
||||
didRender() {
|
||||
this._super(...arguments);
|
||||
|
||||
if (this.get('permissions.documentEdit')) {
|
||||
this.addTooltip(document.getElementById("document-index-button"));
|
||||
this.addTooltip(document.getElementById("document-activity-button"));
|
||||
}
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
this.destroyTooltips();
|
||||
},
|
||||
|
||||
actions: {
|
||||
onTabSwitch(tab) {
|
||||
this.set('tab', tab);
|
||||
},
|
||||
|
||||
onPageSequenceChange(changes) {
|
||||
this.attrs.onPageSequenceChange(changes);
|
||||
},
|
||||
|
||||
onPageLevelChange(changes) {
|
||||
this.attrs.onPageLevelChange(changes);
|
||||
},
|
||||
|
||||
onGotoPage(id) {
|
||||
this.attrs.onGotoPage(id);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -54,7 +54,7 @@ export default Ember.Component.extend(NotifierMixin, {
|
|||
let u = {
|
||||
orgId: this.get('folder.orgId'),
|
||||
folderId: this.get('folder.id'),
|
||||
userId: '',
|
||||
userId: '0',
|
||||
fullname: ' Everyone',
|
||||
spaceView: false,
|
||||
spaceManage: false,
|
||||
|
@ -95,7 +95,7 @@ export default Ember.Component.extend(NotifierMixin, {
|
|||
let payload = { Message: message, Permissions: permissions };
|
||||
|
||||
let hasEveryone = _.find(permissions, function (permission) {
|
||||
return permission.get('userId') === "" &&
|
||||
return permission.get('userId') === "0" &&
|
||||
(permission.get('spaceView') || permission.get('documentAdd') || permission.get('documentEdit') || permission.get('documentDelete') ||
|
||||
permission.get('documentMove') || permission.get('documentCopy') || permission.get('documentTemplate'));
|
||||
});
|
||||
|
|
|
@ -39,6 +39,14 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, AuthMixin, {
|
|||
this.set('selectedDocuments', []);
|
||||
},
|
||||
|
||||
didRender() {
|
||||
this._super(...arguments);
|
||||
|
||||
if (this.get('rootDocCount') > 0) {
|
||||
this.addTooltip(document.getElementById("uncategorized-button"));
|
||||
}
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue