1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

removed redundant UI code

This commit is contained in:
Harvey Kandola 2017-12-11 14:39:12 +00:00
parent 5edd08ee04
commit cc1c216754
40 changed files with 81 additions and 949 deletions

View file

@ -1,15 +0,0 @@
// 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 Component from '@ember/component';
export default Component.extend({
});

View file

@ -12,12 +12,11 @@
import Component from '@ember/component';
import { schedule, debounce } from '@ember/runloop';
import AuthProvider from '../../mixins/auth';
import DropdownMixin from '../../mixins/dropdown';
import ModalMixin from '../../mixins/modal';
export default Component.extend(AuthProvider, DropdownMixin, {
export default Component.extend(AuthProvider, ModalMixin, {
editUser: null,
deleteUser: null,
dropdown: null,
password: {},
filter: '',
filteredUsers: [],
@ -169,7 +168,7 @@ export default Component.extend(AuthProvider, DropdownMixin, {
this.set('selectedUsers', []);
this.set('hasSelectedUsers', false);
return true;
this.modalClose('#admin-user-delete-modal');
}
}
});

View file

@ -13,9 +13,8 @@ import { computed } from '@ember/object';
import { notEmpty } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import DropdownMixin from '../../mixins/dropdown';
export default Component.extend(DropdownMixin, {
export default Component.extend({
documentService: service('document'),
appMeta: service(),
hasAttachments: notEmpty('files'),

View file

@ -1,140 +0,0 @@
// 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 { computed } from '@ember/object';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import stringUtil from '../utils/string';
export default Component.extend({
drop: null,
target: null,
button: "Delete",
color: "flat-red",
button2: "",
color2: "2",
open: "click",
position: 'bottom right',
showCancel: true,
contentId: "",
focusOn: null, // is there an input field we need to focus?
selectOn: null, // is there an input field we need to select?
onOpenCallback: null, // callback when opened
onAction: null,
onAction2: null,
offset: "5px 0",
targetOffset: "10px 0",
constrainToWindow: true,
constrainToScrollParent: true,
cssClass: '',
tether: service(),
hasSecondButton: computed('button2', 'color2', function () {
return is.not.empty(this.get('button2')) && is.not.empty(this.get('color2'));
}),
didReceiveAttrs() {
this.set("contentId", 'dropdown-dialog-' + stringUtil.makeId(10));
},
didInsertElement() {
this._super(...arguments);
// TODO: refactor to eliminate self
let self = this;
if (is.null(self.get('target'))) {
return;
}
let drop = this.get('tether').createDrop({
target: document.getElementById(self.get('target')),
content: self.$(".dropdown-dialog")[0],
classes: 'drop-theme-basic',
position: self.get('position'),
openOn: self.get('open'),
constrainToWindow: true,
constrainToScrollParent: false,
tetherOptions: {
offset: self.offset,
targetOffset: self.targetOffset,
// targetModifier: 'scroll-handle',
constraints: [
{
to: 'scrollParent',
attachment: 'together'
}
],
},
remove: true
});
if (drop) {
drop.on('open', function () {
if (is.not.null(self.get("focusOn"))) {
document.getElementById(self.get("focusOn")).focus();
}
if (is.not.null(self.get("selectOn"))) {
document.getElementById(self.get("selectOn")).select();
}
if (is.not.null(self.get("onOpenCallback"))) {
self.attrs.onOpenCallback(drop);
}
});
self.set('drop', drop);
}
},
willDestroyElement() {
let drop = this.get('drop');
if (drop) {
drop.destroy();
}
},
actions: {
onCancel() {
let drop = this.get('drop');
if (drop) {
drop.close();
}
},
onAction() {
if (this.get('onAction') === null) {
return;
}
let close = this.attrs.onAction();
let drop = this.get('drop');
if (close && drop) {
drop.close();
}
},
onAction2() {
if (this.get('onAction2') === null) {
return;
}
let close = this.attrs.onAction2();
let drop = this.get('drop');
if (close && drop) {
drop.close();
}
}
}
});

View file

@ -1,73 +0,0 @@
// 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 { inject as service } from '@ember/service';
import Component from '@ember/component';
import stringUtil from '../utils/string';
export default Component.extend({
target: null,
open: "click",
position: 'bottom right',
contentId: "",
drop: null,
onOpenCallback: null, // callback when opened
onCloseCallback: null, // callback when closed
tether: service(),
didReceiveAttrs() {
this.set("contentId", 'dropdown-menu-' + stringUtil.makeId(10));
},
didInsertElement() {
this._super(...arguments);
let self = this;
let drop = this.get('tether').createDrop({
target: document.getElementById(self.get('target')),
content: self.$(".dropdown-menu")[0],
classes: 'drop-theme-menu',
position: self.get('position'),
openOn: self.get('open'),
constrainToWindow: false,
constrainToScrollParent: false,
tetherOptions: {
offset: "5px 0",
targetOffset: "10px 0",
targetModifier: 'scroll-handle',
},
remove: true
});
if (drop) {
drop.on('open', function () {
if (is.not.null(self.get("onOpenCallback"))) {
self.attrs.onOpenCallback(drop);
}
});
drop.on('close', function () {
if (is.not.null(self.get("onCloseCallback"))) {
self.attrs.onCloseCallback();
}
});
self.set('drop', drop);
}
},
willDestroyElement() {
let drop = this.get('drop');
if (drop) {
drop.destroy();
}
}
});

View file

@ -1,15 +0,0 @@
// 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 Component from '@ember/component';
export default Component.extend({
});

View file

@ -1,25 +0,0 @@
// 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 Component from '@ember/component';
import { inject as service } from '@ember/service';
import NotifierMixin from '../../mixins/notifier';
export default Component.extend(NotifierMixin, {
appMeta :service(),
didRender() {
if (this.get('appMeta').invalidLicense()) {
this.showNotification(`!! Expired or invalid license !!`);
}
}
});

View file

@ -1,25 +0,0 @@
// 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 Component from '@ember/component';
import { inject as service } from '@ember/service';
import NotifierMixin from '../../mixins/notifier';
export default Component.extend(NotifierMixin, {
appMeta :service(),
didRender() {
if (this.get('appMeta').invalidLicense()) {
this.showNotification(`!! Expired or invalid license !!`);
}
}
});

View file

@ -1,14 +0,0 @@
// 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 Component from '@ember/component';
export default Component.extend({
});