mirror of
https://github.com/documize/community.git
synced 2025-07-18 20:59:43 +02:00
Replaced underscore.js & is.js with lodash.js
This commit is contained in:
parent
df8e843bf5
commit
566807bc14
93 changed files with 17379 additions and 2056 deletions
|
@ -1,9 +0,0 @@
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_style = space
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
indent_size = 4
|
|
||||||
insert_final_newline = true
|
|
|
@ -1,62 +0,0 @@
|
||||||
{
|
|
||||||
"css": {
|
|
||||||
"indent_size": 4,
|
|
||||||
"indent_level": 0,
|
|
||||||
"indent_with_tabs": true,
|
|
||||||
"preserve_newlines": true,
|
|
||||||
"max_preserve_newlines": 2,
|
|
||||||
"newline_between_rules": true,
|
|
||||||
"selector_separator_newlines": true
|
|
||||||
},
|
|
||||||
"scss": {
|
|
||||||
"indent_size": 4,
|
|
||||||
"indent_level": 0,
|
|
||||||
"indent_with_tabs": true,
|
|
||||||
"preserve_newlines": true,
|
|
||||||
"max_preserve_newlines": 2,
|
|
||||||
"newline_between_rules": true,
|
|
||||||
"selector_separator_newlines": true
|
|
||||||
},
|
|
||||||
"html": {
|
|
||||||
"indent_size": 4,
|
|
||||||
"indent_level": 0,
|
|
||||||
"indent_with_tabs": true,
|
|
||||||
"preserve_newlines": true,
|
|
||||||
"max_preserve_newlines": 2,
|
|
||||||
"wrap_line_length": 0,
|
|
||||||
"indent_handlebars": true,
|
|
||||||
"indent_inner_html": false,
|
|
||||||
"indent_scripts": "keep"
|
|
||||||
},
|
|
||||||
"hbs": {
|
|
||||||
"indent_size": 4,
|
|
||||||
"indent_level": 0,
|
|
||||||
"indent_with_tabs": true,
|
|
||||||
"max_preserve_newlines": 2,
|
|
||||||
"preserve_newlines": true,
|
|
||||||
"wrap_line_length": 0
|
|
||||||
},
|
|
||||||
"js": {
|
|
||||||
"indent_size": 4,
|
|
||||||
"indent_level": 0,
|
|
||||||
"indent_with_tabs": true,
|
|
||||||
"preserve_newlines": true,
|
|
||||||
"wrap_line_length": 0,
|
|
||||||
"break_chained_methods": false,
|
|
||||||
"max_preserve_newlines": 2,
|
|
||||||
"jslint_happy": true,
|
|
||||||
"brace_style": "collapse-preserve-inline",
|
|
||||||
"keep_function_indentation": false,
|
|
||||||
"space_after_anon_function": false,
|
|
||||||
"space_before_anon_function": false,
|
|
||||||
"space_before_conditional": true,
|
|
||||||
"space_in_empty_paren": false,
|
|
||||||
"space_before_func_paren": false,
|
|
||||||
"space_in_paren": false
|
|
||||||
},
|
|
||||||
"sql": {
|
|
||||||
"indent_size": 4,
|
|
||||||
"indent_level": 0,
|
|
||||||
"indent_with_tabs": true
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
gui/public/tinymce/**
|
|
||||||
gui/public/tinymce/
|
|
||||||
gui/public/tinymce
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"esversion":6
|
|
||||||
}
|
|
|
@ -19,9 +19,9 @@ All you need to provide is PostgreSQL or any MySQL variant.
|
||||||
|
|
||||||
## Latest Release
|
## Latest Release
|
||||||
|
|
||||||
[Community Edition: v2.0.6](https://github.com/documize/community/releases)
|
[Community Edition: v2.1.0](https://github.com/documize/community/releases)
|
||||||
|
|
||||||
[Enterprise Edition: v2.0.6](https://www.documize.com/downloads)
|
[Enterprise Edition: v2.1.0](https://www.documize.com/downloads)
|
||||||
|
|
||||||
## OS support
|
## OS support
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ Heck, Documize will probably run just fine on a Raspberry Pi 3.
|
||||||
|
|
||||||
## Technology Stack
|
## Technology Stack
|
||||||
|
|
||||||
- Go (v1.11.5)
|
- Go (v1.12.0)
|
||||||
- Ember JS (v3.7.2)
|
- Ember JS (v3.8.0)
|
||||||
|
|
||||||
## Authentication Options
|
## Authentication Options
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
# EditorConfig helps developers define and maintain consistent
|
|
||||||
# coding styles between different editors and IDEs
|
|
||||||
# editorconfig.org
|
|
||||||
|
|
||||||
root = true
|
|
||||||
|
|
||||||
|
|
||||||
[*]
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
|
|
||||||
[*.hbs]
|
|
||||||
insert_final_newline = false
|
|
||||||
|
|
||||||
[*.{diff,md}]
|
|
||||||
trim_trailing_whitespace = false
|
|
|
@ -1,11 +1,4 @@
|
||||||
public/tinymce/**
|
/public/
|
||||||
public/tinymce/
|
|
||||||
public/tinymce
|
|
||||||
public/codemirror/**
|
|
||||||
public/codemirror/
|
|
||||||
public/codemirror
|
|
||||||
|
|
||||||
# unconventional js
|
|
||||||
/blueprints/*/files/
|
/blueprints/*/files/
|
||||||
/vendor/
|
/vendor/
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ module.exports = {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
globals: {
|
globals: {
|
||||||
"is": true,
|
|
||||||
"mermaid": true,
|
"mermaid": true,
|
||||||
"_": true,
|
"_": true,
|
||||||
"tinymce": true,
|
"tinymce": true,
|
||||||
|
|
|
@ -43,19 +43,19 @@ export default Component.extend(ModalMixin, Notifier, {
|
||||||
|
|
||||||
ldapErrorServerHost: empty('ldapConfig.serverHost'),
|
ldapErrorServerHost: empty('ldapConfig.serverHost'),
|
||||||
ldapErrorServerPort: computed('ldapConfig.serverPort', function() {
|
ldapErrorServerPort: computed('ldapConfig.serverPort', function() {
|
||||||
return is.empty(this.get('ldapConfig.serverPort')) || is.not.number(parseInt(this.get('ldapConfig.serverPort')));
|
return _.isEmpty(this.get('ldapConfig.serverPort')) || !_.isNumber(parseInt(this.get('ldapConfig.serverPort')));
|
||||||
}),
|
}),
|
||||||
ldapErrorBindDN: empty('ldapConfig.bindDN'),
|
ldapErrorBindDN: empty('ldapConfig.bindDN'),
|
||||||
ldapErrorBindPassword: empty('ldapConfig.bindPassword'),
|
ldapErrorBindPassword: empty('ldapConfig.bindPassword'),
|
||||||
ldapErrorNoFilter: computed('ldapConfig.{userFilter,groupFilter}', function() {
|
ldapErrorNoFilter: computed('ldapConfig.{userFilter,groupFilter}', function() {
|
||||||
return is.empty(this.get('ldapConfig.userFilter')) && is.empty(this.get('ldapConfig.groupFilter'));
|
return _.isEmpty(this.get('ldapConfig.userFilter')) && _.isEmpty(this.get('ldapConfig.groupFilter'));
|
||||||
}),
|
}),
|
||||||
ldapErrorAttributeUserRDN: empty('ldapConfig.attributeUserRDN'),
|
ldapErrorAttributeUserRDN: empty('ldapConfig.attributeUserRDN'),
|
||||||
ldapErrorAttributeUserFirstname: empty('ldapConfig.attributeUserFirstname'),
|
ldapErrorAttributeUserFirstname: empty('ldapConfig.attributeUserFirstname'),
|
||||||
ldapErrorAttributeUserLastname: empty('ldapConfig.attributeUserLastname'),
|
ldapErrorAttributeUserLastname: empty('ldapConfig.attributeUserLastname'),
|
||||||
ldapErrorAttributeUserEmail: empty('ldapConfig.attributeUserEmail'),
|
ldapErrorAttributeUserEmail: empty('ldapConfig.attributeUserEmail'),
|
||||||
ldapErrorAttributeGroupMember: computed('ldapConfig.{groupFilter,attributeGroupMember}', function() {
|
ldapErrorAttributeGroupMember: computed('ldapConfig.{groupFilter,attributeGroupMember}', function() {
|
||||||
return is.not.empty(this.get('ldapConfig.groupFilter')) && is.empty(this.get('ldapConfig.attributeGroupMember'));
|
return !_.isEmpty(this.get('ldapConfig.groupFilter')) && _.isEmpty(this.get('ldapConfig.attributeGroupMember'));
|
||||||
}),
|
}),
|
||||||
ldapPreview: null,
|
ldapPreview: null,
|
||||||
ldapConfig: null,
|
ldapConfig: null,
|
||||||
|
@ -92,7 +92,7 @@ export default Component.extend(ModalMixin, Notifier, {
|
||||||
case constants.AuthProvider.Keycloak: // eslint-disable-line no-case-declarations
|
case constants.AuthProvider.Keycloak: // eslint-disable-line no-case-declarations
|
||||||
let config = this.get('authConfig');
|
let config = this.get('authConfig');
|
||||||
|
|
||||||
if (is.undefined(config) || is.null(config) || is.empty(config) ) {
|
if (_.isUndefined(config) || _.isNull(config) || _.isEmpty(config) ) {
|
||||||
config = {};
|
config = {};
|
||||||
} else {
|
} else {
|
||||||
config = JSON.parse(config);
|
config = JSON.parse(config);
|
||||||
|
@ -107,7 +107,7 @@ export default Component.extend(ModalMixin, Notifier, {
|
||||||
case constants.AuthProvider.LDAP: // eslint-disable-line no-case-declarations
|
case constants.AuthProvider.LDAP: // eslint-disable-line no-case-declarations
|
||||||
let ldapConfig = this.get('authConfig');
|
let ldapConfig = this.get('authConfig');
|
||||||
|
|
||||||
if (is.undefined(ldapConfig) || is.null(ldapConfig) || is.empty(ldapConfig) ) {
|
if (_.isUndefined(ldapConfig) || _.isNull(ldapConfig) || _.isEmpty(ldapConfig) ) {
|
||||||
ldapConfig = {};
|
ldapConfig = {};
|
||||||
} else {
|
} else {
|
||||||
ldapConfig = JSON.parse(ldapConfig);
|
ldapConfig = JSON.parse(ldapConfig);
|
||||||
|
@ -194,13 +194,13 @@ export default Component.extend(ModalMixin, Notifier, {
|
||||||
config.realm = config.realm.trim();
|
config.realm = config.realm.trim();
|
||||||
config.clientId = config.clientId.trim();
|
config.clientId = config.clientId.trim();
|
||||||
config.publicKey = config.publicKey.trim();
|
config.publicKey = config.publicKey.trim();
|
||||||
config.group = is.undefined(config.group) ? '' : config.group.trim();
|
config.group = _.isUndefined(config.group) ? '' : config.group.trim();
|
||||||
config.adminUser = config.adminUser.trim();
|
config.adminUser = config.adminUser.trim();
|
||||||
config.adminPassword = config.adminPassword.trim();
|
config.adminPassword = config.adminPassword.trim();
|
||||||
config.defaultPermissionAddSpace = config.hasOwnProperty('defaultPermissionAddSpace') ? config.defaultPermissionAddSpace : true;
|
config.defaultPermissionAddSpace = config.hasOwnProperty('defaultPermissionAddSpace') ? config.defaultPermissionAddSpace : true;
|
||||||
config.disableLogout = config.hasOwnProperty('disableLogout') ? config.disableLogout : true;
|
config.disableLogout = config.hasOwnProperty('disableLogout') ? config.disableLogout : true;
|
||||||
|
|
||||||
if (is.endWith(config.url, '/')) {
|
if (_.endsWith(config.url, '/')) {
|
||||||
config.url = config.url.substring(0, config.url.length-1);
|
config.url = config.url.substring(0, config.url.length-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ export default Component.extend(ModalMixin, Notifier, {
|
||||||
config.serverHost = config.serverHost.trim();
|
config.serverHost = config.serverHost.trim();
|
||||||
config.serverPort = parseInt(this.get('ldapConfig.serverPort'));
|
config.serverPort = parseInt(this.get('ldapConfig.serverPort'));
|
||||||
|
|
||||||
if (is.not.empty(config.groupFilter) && is.empty(config.attributeGroupMember)) {
|
if (!_.isEmpty(config.groupFilter) && _.isEmpty(config.attributeGroupMember)) {
|
||||||
this.$('#ldap-attributeGroupMember').focus();
|
this.$('#ldap-attributeGroupMember').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,17 +118,17 @@ export default Component.extend(Notifier, Modal, {
|
||||||
|
|
||||||
// do we have upload file?
|
// do we have upload file?
|
||||||
// let files = document.getElementById("restore-file").files;
|
// let files = document.getElementById("restore-file").files;
|
||||||
// if (is.undefined(files) || is.null(files)) {
|
// if (_.isUndefined(files) || _.isNull(files)) {
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// let file = document.getElementById("restore-file").files[0];
|
// let file = document.getElementById("restore-file").files[0];
|
||||||
// if (is.undefined(file) || is.null(file)) {
|
// if (_.isUndefined(file) || _.isNull(file)) {
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
let filedata = this.get('restoreFile');
|
let filedata = this.get('restoreFile');
|
||||||
if (is.null(filedata)) {
|
if (_.isNull(filedata)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ export default Component.extend(Notifier, {
|
||||||
}
|
}
|
||||||
|
|
||||||
let e = this.get('model.general.conversionEndpoint');
|
let e = this.get('model.general.conversionEndpoint');
|
||||||
if (is.endWith(e, '/')) {
|
if (_.endsWith(e, '/')) {
|
||||||
this.set('model.general.conversionEndpoint', e.substring(0, e.length-1));
|
this.set('model.general.conversionEndpoint', e.substring(0, e.length-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ export default Component.extend(Notifier, {
|
||||||
// Jira specific.
|
// Jira specific.
|
||||||
let jira = this.get('jira');
|
let jira = this.get('jira');
|
||||||
|
|
||||||
if (is.empty(jira) || is.not.object(jira)) {
|
if (_.isEmpty(jira) || !_.isObject(jira)) {
|
||||||
jira = {
|
jira = {
|
||||||
url: '',
|
url: '',
|
||||||
username: '',
|
username: '',
|
||||||
|
@ -37,7 +37,7 @@ export default Component.extend(Notifier, {
|
||||||
// Trello specific.
|
// Trello specific.
|
||||||
let trello = this.get('trello');
|
let trello = this.get('trello');
|
||||||
|
|
||||||
if (is.not.object(trello)) {
|
if (!_.isObject(trello)) {
|
||||||
trello = {
|
trello = {
|
||||||
appKey: ''
|
appKey: ''
|
||||||
};
|
};
|
||||||
|
@ -52,7 +52,7 @@ export default Component.extend(Notifier, {
|
||||||
let orgId = this.get("appMeta.orgId");
|
let orgId = this.get("appMeta.orgId");
|
||||||
let url = this.get('jiraCreds.url');
|
let url = this.get('jiraCreds.url');
|
||||||
|
|
||||||
if (is.endWith(url, '/')) {
|
if (_.endsWith(url, '/')) {
|
||||||
this.set('jiraCreds.url', url.substring(0, url.length-1));
|
this.set('jiraCreds.url', url.substring(0, url.length-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ export default Component.extend(Notifier, Modals, {
|
||||||
onExport() {
|
onExport() {
|
||||||
let spec = {
|
let spec = {
|
||||||
spaceId: '',
|
spaceId: '',
|
||||||
data: _.pluck(this.get('folders'), 'id'),
|
data: _.map(this.get('folders'), 'id'),
|
||||||
filterType: 'space',
|
filterType: 'space',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ export default Component.extend(Modals, {
|
||||||
label.color = '#263238';
|
label.color = '#263238';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.empty(label.name)) {
|
if (_.isEmpty(label.name)) {
|
||||||
$('#add-label-name').addClass('is-invalid').focus();
|
$('#add-label-name').addClass('is-invalid').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ export default Component.extend(Modals, {
|
||||||
let color = this.get('labelColor').trim();
|
let color = this.get('labelColor').trim();
|
||||||
let label = this.get('editLabel');
|
let label = this.get('editLabel');
|
||||||
|
|
||||||
if (is.empty(name)) {
|
if (_.isEmpty(name)) {
|
||||||
$('#edit-label-name').addClass('is-invalid').focus();
|
$('#edit-label-name').addClass('is-invalid').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import $ from 'jquery';
|
||||||
import AuthProvider from '../../mixins/auth';
|
import AuthProvider from '../../mixins/auth';
|
||||||
import ModalMixin from '../../mixins/modal';
|
import ModalMixin from '../../mixins/modal';
|
||||||
import Notifier from '../../mixins/notifier';
|
import Notifier from '../../mixins/notifier';
|
||||||
|
import stringUtil from '../../utils/string';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
|
|
||||||
export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||||
|
@ -30,19 +31,19 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||||
},
|
},
|
||||||
|
|
||||||
onAddUser() {
|
onAddUser() {
|
||||||
if (is.empty(this.get('newUser.firstname'))) {
|
if (_.isEmpty(this.get('newUser.firstname'))) {
|
||||||
$("#newUserFirstname").addClass('is-invalid').focus();
|
$("#newUserFirstname").addClass('is-invalid').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$("#newUserFirstname").removeClass('is-invalid');
|
$("#newUserFirstname").removeClass('is-invalid');
|
||||||
|
|
||||||
if (is.empty(this.get('newUser.lastname'))) {
|
if (_.isEmpty(this.get('newUser.lastname'))) {
|
||||||
$("#newUserLastname").addClass('is-invalid').focus();
|
$("#newUserLastname").addClass('is-invalid').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$("#newUserLastname").removeClass('is-invalid');
|
$("#newUserLastname").removeClass('is-invalid');
|
||||||
|
|
||||||
if (is.empty(this.get('newUser.email')) || is.not.email(this.get('newUser.email'))) {
|
if (_.isEmpty(this.get('newUser.email')) || !stringUtil.isEmail(this.get('newUser.email'))) {
|
||||||
$("#newUserEmail").addClass('is-invalid').focus();
|
$("#newUserEmail").addClass('is-invalid').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +60,7 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||||
},
|
},
|
||||||
|
|
||||||
onAddUsers() {
|
onAddUsers() {
|
||||||
if (is.empty(this.get('bulkUsers'))) {
|
if (_.isEmpty(this.get('bulkUsers'))) {
|
||||||
$("#bulkUsers").addClass('is-invalid').focus();
|
$("#bulkUsers").addClass('is-invalid').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default Component.extend(AuthProvider, ModalMixin, {
|
||||||
let filteredUsers = A([]);
|
let filteredUsers = A([]);
|
||||||
users.forEach(user => {
|
users.forEach(user => {
|
||||||
let m = members.findBy('userId', user.get('id'));
|
let m = members.findBy('userId', user.get('id'));
|
||||||
if (is.undefined(m)) filteredUsers.pushObject(user);
|
if (_.isUndefined(m)) filteredUsers.pushObject(user);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.set('users', filteredUsers);
|
this.set('users', filteredUsers);
|
||||||
|
@ -75,7 +75,7 @@ export default Component.extend(AuthProvider, ModalMixin, {
|
||||||
|
|
||||||
let newGroup = this.get('newGroup');
|
let newGroup = this.get('newGroup');
|
||||||
|
|
||||||
if (is.empty(newGroup.name)) {
|
if (_.isEmpty(newGroup.name)) {
|
||||||
$('#new-group-name')
|
$('#new-group-name')
|
||||||
.addClass('is-invalid')
|
.addClass('is-invalid')
|
||||||
.focus();
|
.focus();
|
||||||
|
@ -108,7 +108,7 @@ export default Component.extend(AuthProvider, ModalMixin, {
|
||||||
let group = this.get('groups').findBy('id', deleteGroup.id);
|
let group = this.get('groups').findBy('id', deleteGroup.id);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
is.empty(deleteGroup.name) ||
|
_.isEmpty(deleteGroup.name) ||
|
||||||
group.get('name') !== deleteGroup.name
|
group.get('name') !== deleteGroup.name
|
||||||
) {
|
) {
|
||||||
$('#delete-group-name')
|
$('#delete-group-name')
|
||||||
|
@ -141,7 +141,7 @@ export default Component.extend(AuthProvider, ModalMixin, {
|
||||||
|
|
||||||
let group = this.get('editGroup');
|
let group = this.get('editGroup');
|
||||||
|
|
||||||
if (is.empty(group.get('name'))) {
|
if (_.isEmpty(group.get('name'))) {
|
||||||
$('#edit-group-name')
|
$('#edit-group-name')
|
||||||
.addClass('is-invalid')
|
.addClass('is-invalid')
|
||||||
.focus();
|
.focus();
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { schedule, debounce } from '@ember/runloop';
|
||||||
import AuthProvider from '../../mixins/auth';
|
import AuthProvider from '../../mixins/auth';
|
||||||
import ModalMixin from '../../mixins/modal';
|
import ModalMixin from '../../mixins/modal';
|
||||||
import Notifier from '../../mixins/notifier';
|
import Notifier from '../../mixins/notifier';
|
||||||
|
import stringUtil from '../../utils/string';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
|
|
||||||
export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||||
|
@ -142,15 +143,15 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||||
let user = this.get('editUser');
|
let user = this.get('editUser');
|
||||||
let password = this.get('password');
|
let password = this.get('password');
|
||||||
|
|
||||||
if (is.empty(user.firstname)) {
|
if (_.isEmpty(user.firstname)) {
|
||||||
$("#edit-firstname").addClass("is-invalid").focus();
|
$("#edit-firstname").addClass("is-invalid").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is.empty(user.lastname)) {
|
if (_.isEmpty(user.lastname)) {
|
||||||
$("#edit-lastname").addClass("is-invalid").focus();
|
$("#edit-lastname").addClass("is-invalid").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is.empty(user.email) || is.not.email(user.email)) {
|
if (_.isEmpty(user.email) || !stringUtil.isEmail(user.email)) {
|
||||||
$("#edit-email").addClass("is-invalid").focus();
|
$("#edit-email").addClass("is-invalid").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +162,7 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||||
let cb = this.get('onSave');
|
let cb = this.get('onSave');
|
||||||
cb(user);
|
cb(user);
|
||||||
|
|
||||||
if (is.not.empty(password.password) && is.not.empty(password.confirmation) &&
|
if (!_.isEmpty(password.password) && !_.isEmpty(password.confirmation) &&
|
||||||
password.password === password.confirmation) {
|
password.password === password.confirmation) {
|
||||||
|
|
||||||
let pw = this.get('onPassword');
|
let pw = this.get('onPassword');
|
||||||
|
@ -218,7 +219,7 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||||
let groups = this.get('groups');
|
let groups = this.get('groups');
|
||||||
groups.forEach((g) => {
|
groups.forEach((g) => {
|
||||||
let hasGroup = userGroups.findBy('groupId', g.get('id'));
|
let hasGroup = userGroups.findBy('groupId', g.get('id'));
|
||||||
g.set('isMember', is.not.undefined(hasGroup));
|
g.set('isMember', !_.isUndefined(hasGroup));
|
||||||
})
|
})
|
||||||
this.set('groups', groups);
|
this.set('groups', groups);
|
||||||
|
|
||||||
|
@ -230,7 +231,7 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||||
let group = this.get('groups').findBy('id', groupId);
|
let group = this.get('groups').findBy('id', groupId);
|
||||||
group.set('isMember', false);
|
group.set('isMember', false);
|
||||||
|
|
||||||
if (is.undefined(groupId) || is.undefined(userId)) {
|
if (_.isUndefined(groupId) || _.isUndefined(userId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +245,7 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||||
let group = this.get('groups').findBy('id', groupId);
|
let group = this.get('groups').findBy('id', groupId);
|
||||||
group.set('isMember', true);
|
group.set('isMember', true);
|
||||||
|
|
||||||
if (is.undefined(groupId) || is.undefined(userId)) {
|
if (_.isUndefined(groupId) || _.isUndefined(userId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ export default Component.extend(Notifier, Modals, {
|
||||||
}
|
}
|
||||||
|
|
||||||
// But, if we can work work correct placement, we put new content as best we can.
|
// But, if we can work work correct placement, we put new content as best we can.
|
||||||
if (is.object(beforePage)) {
|
if (_.isObject(beforePage)) {
|
||||||
level = beforePage.get('level');
|
level = beforePage.get('level');
|
||||||
|
|
||||||
// get any page before the beforePage so we can insert this new section between them
|
// get any page before the beforePage so we can insert this new section between them
|
||||||
|
@ -76,7 +76,7 @@ export default Component.extend(Notifier, Modals, {
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
let beforeBeforePage = this.get('pages')[index-1];
|
let beforeBeforePage = this.get('pages')[index-1];
|
||||||
|
|
||||||
if (is.not.undefined(beforeBeforePage)) {
|
if (!_.isUndefined(beforeBeforePage)) {
|
||||||
sequence = (beforePage.get('sequence') + beforeBeforePage.get('page.sequence')) / 2;
|
sequence = (beforePage.get('sequence') + beforeBeforePage.get('page.sequence')) / 2;
|
||||||
} else {
|
} else {
|
||||||
sequence = beforePage.get('sequence') / 2;
|
sequence = beforePage.get('sequence') / 2;
|
||||||
|
@ -97,7 +97,7 @@ export default Component.extend(Notifier, Modals, {
|
||||||
actions: {
|
actions: {
|
||||||
onInsertSection(section) {
|
onInsertSection(section) {
|
||||||
let sectionName = this.get('newSectionName');
|
let sectionName = this.get('newSectionName');
|
||||||
if (is.empty(sectionName)) {
|
if (_.isEmpty(sectionName)) {
|
||||||
$("#new-section-name").focus();
|
$("#new-section-name").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ export default Component.extend(Notifier, Modals, {
|
||||||
|
|
||||||
onInsertBlock(block) {
|
onInsertBlock(block) {
|
||||||
let sectionName = this.get('newSectionName');
|
let sectionName = this.get('newSectionName');
|
||||||
if (is.empty(sectionName)) {
|
if (_.isEmpty(sectionName)) {
|
||||||
$("#new-section-name").focus();
|
$("#new-section-name").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,8 @@ export default Component.extend(ModalMixin, {
|
||||||
|
|
||||||
this.get('link').getCandidates(folderId, documentId, pageId).then(function (candidates) {
|
this.get('link').getCandidates(folderId, documentId, pageId).then(function (candidates) {
|
||||||
self.set('candidates', candidates);
|
self.set('candidates', candidates);
|
||||||
self.set('hasSections', is.not.null(candidates.pages) && candidates.pages.length);
|
self.set('hasSections', !_.isNull(candidates.pages) && candidates.pages.length);
|
||||||
self.set('hasAttachments', is.not.null(candidates.attachments) && candidates.attachments.length);
|
self.set('hasAttachments', !_.isNull(candidates.attachments) && candidates.attachments.length);
|
||||||
|
|
||||||
if (!self.get('hasSections') && !self.get('hasAttachments')) {
|
if (!self.get('hasSections') && !self.get('hasAttachments')) {
|
||||||
self.set('tab1Selected', false);
|
self.set('tab1Selected', false);
|
||||||
|
@ -148,7 +148,7 @@ export default Component.extend(ModalMixin, {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.null(selection)) {
|
if (_.isNull(selection)) {
|
||||||
if (this.get('tab4Selected')) this.$('#content-linker-networklocation').addClass('is-invalid').focus();
|
if (this.get('tab4Selected')) this.$('#content-linker-networklocation').addClass('is-invalid').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ export default Component.extend({
|
||||||
onDeletePage(deleteChildren) {
|
onDeletePage(deleteChildren) {
|
||||||
let page = this.get('page');
|
let page = this.get('page');
|
||||||
|
|
||||||
if (is.undefined(page)) {
|
if (_.isUndefined(page)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
||||||
pinId: '',
|
pinId: '',
|
||||||
newName: ''
|
newName: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
this.saveTemplate = {
|
this.saveTemplate = {
|
||||||
name: '',
|
name: '',
|
||||||
description: ''
|
description: ''
|
||||||
|
@ -130,12 +131,12 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
||||||
let name = this.get('saveTemplate.name');
|
let name = this.get('saveTemplate.name');
|
||||||
let excerpt = this.get('saveTemplate.description');
|
let excerpt = this.get('saveTemplate.description');
|
||||||
|
|
||||||
if (is.empty(name)) {
|
if (_.isEmpty(name)) {
|
||||||
$("#new-template-name").addClass("is-invalid").focus();
|
$("#new-template-name").addClass("is-invalid").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.empty(excerpt)) {
|
if (_.isEmpty(excerpt)) {
|
||||||
$("#new-template-desc").addClass("is-invalid").focus();
|
$("#new-template-desc").addClass("is-invalid").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ export default Component.extend(ModalMixin, {
|
||||||
let page = this.get('page');
|
let page = this.get('page');
|
||||||
let titleElem = '#block-title-' + page.get('id');
|
let titleElem = '#block-title-' + page.get('id');
|
||||||
let blockTitle = this.get('blockTitle');
|
let blockTitle = this.get('blockTitle');
|
||||||
if (is.empty(blockTitle)) {
|
if (_.isEmpty(blockTitle)) {
|
||||||
$(titleElem).addClass('is-invalid');
|
$(titleElem).addClass('is-invalid');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ export default Component.extend(ModalMixin, {
|
||||||
let excerptElem = '#block-desc-' + page.get('id');
|
let excerptElem = '#block-desc-' + page.get('id');
|
||||||
let blockExcerpt = this.get('blockExcerpt');
|
let blockExcerpt = this.get('blockExcerpt');
|
||||||
blockExcerpt = blockExcerpt.replace(/\n/g, "");
|
blockExcerpt = blockExcerpt.replace(/\n/g, "");
|
||||||
if (is.empty(blockExcerpt)) {
|
if (_.isEmpty(blockExcerpt)) {
|
||||||
$(excerptElem).addClass('is-invalid');
|
$(excerptElem).addClass('is-invalid');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -178,9 +178,9 @@ export default Component.extend(ModalMixin, {
|
||||||
|
|
||||||
onCopyPage() {
|
onCopyPage() {
|
||||||
let item = this.get('docSearchResults').findBy('selected', true);
|
let item = this.get('docSearchResults').findBy('selected', true);
|
||||||
let documentId = is.not.undefined(item) ? item.get('documentId') : '';
|
let documentId = !_.isUndefined(item) ? item.get('documentId') : '';
|
||||||
|
|
||||||
if (is.empty(documentId)) return;
|
if (_.isEmpty(documentId)) return;
|
||||||
|
|
||||||
this.modalClose('#copy-page-modal-' + this.get('page.id'));
|
this.modalClose('#copy-page-modal-' + this.get('page.id'));
|
||||||
|
|
||||||
|
@ -193,9 +193,9 @@ export default Component.extend(ModalMixin, {
|
||||||
|
|
||||||
onMovePage() {
|
onMovePage() {
|
||||||
let item = this.get('docSearchResults').findBy('selected', true);
|
let item = this.get('docSearchResults').findBy('selected', true);
|
||||||
let documentId = is.not.undefined(item) ? item.get('documentId') : '';
|
let documentId = !_.isUndefined(item) ? item.get('documentId') : '';
|
||||||
|
|
||||||
if (is.empty(documentId)) return;
|
if (_.isEmpty(documentId)) return;
|
||||||
|
|
||||||
// can't move into self
|
// can't move into self
|
||||||
if (documentId === this.get('document.id')) return;
|
if (documentId === this.get('document.id')) return;
|
||||||
|
@ -219,7 +219,7 @@ export default Component.extend(ModalMixin, {
|
||||||
|
|
||||||
let pages = this.get('pages');
|
let pages = this.get('pages');
|
||||||
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
||||||
if (is.not.undefined(page)) page = page.get('page');
|
if (!_.isUndefined(page)) page = page.get('page');
|
||||||
|
|
||||||
let pendingChanges = tocUtil.moveUp(state, pages, page);
|
let pendingChanges = tocUtil.moveUp(state, pages, page);
|
||||||
if (pendingChanges.length > 0) {
|
if (pendingChanges.length > 0) {
|
||||||
|
@ -235,7 +235,7 @@ export default Component.extend(ModalMixin, {
|
||||||
let state = this.get('state');
|
let state = this.get('state');
|
||||||
let pages = this.get('pages');
|
let pages = this.get('pages');
|
||||||
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
||||||
if (is.not.undefined(page)) page = page.get('page');
|
if (!_.isUndefined(page)) page = page.get('page');
|
||||||
|
|
||||||
let pendingChanges = tocUtil.moveDown(state, pages, page);
|
let pendingChanges = tocUtil.moveDown(state, pages, page);
|
||||||
if (pendingChanges.length > 0) {
|
if (pendingChanges.length > 0) {
|
||||||
|
@ -251,7 +251,7 @@ export default Component.extend(ModalMixin, {
|
||||||
let state = this.get('state');
|
let state = this.get('state');
|
||||||
let pages = this.get('pages');
|
let pages = this.get('pages');
|
||||||
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
||||||
if (is.not.undefined(page)) page = page.get('page');
|
if (!_.isUndefined(page)) page = page.get('page');
|
||||||
|
|
||||||
let pendingChanges = tocUtil.indent(state, pages, page);
|
let pendingChanges = tocUtil.indent(state, pages, page);
|
||||||
if (pendingChanges.length > 0) {
|
if (pendingChanges.length > 0) {
|
||||||
|
@ -267,7 +267,7 @@ export default Component.extend(ModalMixin, {
|
||||||
let state = this.get('state');
|
let state = this.get('state');
|
||||||
let pages = this.get('pages');
|
let pages = this.get('pages');
|
||||||
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
||||||
if (is.not.undefined(page)) page = page.get('page');
|
if (!_.isUndefined(page)) page = page.get('page');
|
||||||
|
|
||||||
let pendingChanges = tocUtil.outdent(state, pages, page);
|
let pendingChanges = tocUtil.outdent(state, pages, page);
|
||||||
if (pendingChanges.length > 0) {
|
if (pendingChanges.length > 0) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ export default Component.extend(Notifier, {
|
||||||
this.set('selectedCategories', selected);
|
this.set('selectedCategories', selected);
|
||||||
selected.forEach((s) => {
|
selected.forEach((s) => {
|
||||||
let cat = cats.findBy('id', s.id);
|
let cat = cats.findBy('id', s.id);
|
||||||
if (is.not.undefined(cat)) {
|
if (!_.isUndefined(cat)) {
|
||||||
cat.set('selected', true);
|
cat.set('selected', true);
|
||||||
this.set('categories', cats);
|
this.set('categories', cats);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ export default Component.extend(Notifier, {
|
||||||
_.each(tagz, (t) => {
|
_.each(tagz, (t) => {
|
||||||
let tag = t.value.toLowerCase().trim();
|
let tag = t.value.toLowerCase().trim();
|
||||||
if (tag.length> 0) {
|
if (tag.length> 0) {
|
||||||
if (!_.contains(tagzToSave, tag) && is.not.startWith(tag, '-')) {
|
if (!_.includes(tagzToSave, tag) && !_.startsWith(tag, '-')) {
|
||||||
tagzToSave.push(tag);
|
tagzToSave.push(tag);
|
||||||
this.$('#add-tag-field-' + t.number).removeClass('is-invalid');
|
this.$('#add-tag-field-' + t.number).removeClass('is-invalid');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -92,7 +92,7 @@ export default Component.extend(Notifier, {
|
||||||
this.set('selectedCategories', selected);
|
this.set('selectedCategories', selected);
|
||||||
selected.forEach((s) => {
|
selected.forEach((s) => {
|
||||||
let cat = cats.findBy('id', s.id);
|
let cat = cats.findBy('id', s.id);
|
||||||
if (is.not.undefined(cat)) {
|
if (!_.isUndefined(cat)) {
|
||||||
cat.set('selected', true);
|
cat.set('selected', true);
|
||||||
this.set('categories', cats);
|
this.set('categories', cats);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ export default Component.extend(Notifier, {
|
||||||
_.each(tagz, (t) => {
|
_.each(tagz, (t) => {
|
||||||
let tag = t.value.toLowerCase().trim();
|
let tag = t.value.toLowerCase().trim();
|
||||||
if (tag.length> 0) {
|
if (tag.length> 0) {
|
||||||
if (!_.contains(tagzToSave, tag) && is.not.startWith(tag, '-')) {
|
if (!_.includes(tagzToSave, tag) && !_.startsWith(tag, '-')) {
|
||||||
tagzToSave.push(tag);
|
tagzToSave.push(tag);
|
||||||
this.$('#add-tag-field-' + t.number).removeClass('is-invalid');
|
this.$('#add-tag-field-' + t.number).removeClass('is-invalid');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default Component.extend({
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
let cp = this.get('currentPageId');
|
let cp = this.get('currentPageId');
|
||||||
this.setState(is.empty(cp) ? '' : cp);
|
this.setState(_.isEmpty(cp) ? '' : cp);
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
@ -71,7 +71,7 @@ export default Component.extend({
|
||||||
setState(pageId) {
|
setState(pageId) {
|
||||||
let toc = this.get('pages');
|
let toc = this.get('pages');
|
||||||
let page = _.find(toc, function(i) { return i.get('page.id') === pageId; });
|
let page = _.find(toc, function(i) { return i.get('page.id') === pageId; });
|
||||||
let state = tocUtil.getState(toc, is.not.undefined(page) ? page.get('page') : page);
|
let state = tocUtil.getState(toc, !_.isUndefined(page) ? page.get('page') : page);
|
||||||
|
|
||||||
if (!this.get('canEdit')) {
|
if (!this.get('canEdit')) {
|
||||||
state.actionablePage = false;
|
state.actionablePage = false;
|
||||||
|
@ -92,7 +92,7 @@ export default Component.extend({
|
||||||
|
|
||||||
let pages = this.get('pages');
|
let pages = this.get('pages');
|
||||||
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
||||||
if (is.not.undefined(page)) page = page.get('page');
|
if (!_.isUndefined(page)) page = page.get('page');
|
||||||
|
|
||||||
let pendingChanges = tocUtil.moveUp(state, pages, page);
|
let pendingChanges = tocUtil.moveUp(state, pages, page);
|
||||||
if (pendingChanges.length > 0) {
|
if (pendingChanges.length > 0) {
|
||||||
|
@ -108,7 +108,7 @@ export default Component.extend({
|
||||||
let state = this.get('state');
|
let state = this.get('state');
|
||||||
let pages = this.get('pages');
|
let pages = this.get('pages');
|
||||||
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
||||||
if (is.not.undefined(page)) page = page.get('page');
|
if (!_.isUndefined(page)) page = page.get('page');
|
||||||
|
|
||||||
let pendingChanges = tocUtil.moveDown(state, pages, page);
|
let pendingChanges = tocUtil.moveDown(state, pages, page);
|
||||||
if (pendingChanges.length > 0) {
|
if (pendingChanges.length > 0) {
|
||||||
|
@ -124,7 +124,7 @@ export default Component.extend({
|
||||||
let state = this.get('state');
|
let state = this.get('state');
|
||||||
let pages = this.get('pages');
|
let pages = this.get('pages');
|
||||||
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
||||||
if (is.not.undefined(page)) page = page.get('page');
|
if (!_.isUndefined(page)) page = page.get('page');
|
||||||
|
|
||||||
let pendingChanges = tocUtil.indent(state, pages, page);
|
let pendingChanges = tocUtil.indent(state, pages, page);
|
||||||
if (pendingChanges.length > 0) {
|
if (pendingChanges.length > 0) {
|
||||||
|
@ -140,7 +140,7 @@ export default Component.extend({
|
||||||
let state = this.get('state');
|
let state = this.get('state');
|
||||||
let pages = this.get('pages');
|
let pages = this.get('pages');
|
||||||
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
let page = _.find(pages, function(i) { return i.get('page.id') === state.pageId; });
|
||||||
if (is.not.undefined(page)) page = page.get('page');
|
if (!_.isUndefined(page)) page = page.get('page');
|
||||||
|
|
||||||
let pendingChanges = tocUtil.outdent(state, pages, page);
|
let pendingChanges = tocUtil.outdent(state, pages, page);
|
||||||
if (pendingChanges.length > 0) {
|
if (pendingChanges.length > 0) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ export default Component.extend(Notifier, {
|
||||||
},
|
},
|
||||||
|
|
||||||
jumpToSection(cp) {
|
jumpToSection(cp) {
|
||||||
if (is.not.empty(cp) && is.not.undefined(cp) && is.not.null(cp)) {
|
if (!_.isEmpty(cp) && !_.isUndefined(cp) && !_.isNull(cp)) {
|
||||||
this.get('browser').scrollTo(`#page-${cp}`)
|
this.get('browser').scrollTo(`#page-${cp}`)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -35,7 +35,7 @@ export default Component.extend(ModalMixin, {
|
||||||
|
|
||||||
let revision = this.get('revision');
|
let revision = this.get('revision');
|
||||||
|
|
||||||
if (is.not.null(revision)) {
|
if (!_.isNull(revision)) {
|
||||||
if (!revision.deleted) {
|
if (!revision.deleted) {
|
||||||
this.fetchDiff(revision.pageId, revision.id);
|
this.fetchDiff(revision.pageId, revision.id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,11 +48,11 @@ export default Component.extend(ModalMixin, Notifer, {
|
||||||
// get summary of documents and users for each category in space
|
// get summary of documents and users for each category in space
|
||||||
this.get('categorySvc').getSummary(this.get('space.id')).then((s) => {
|
this.get('categorySvc').getSummary(this.get('space.id')).then((s) => {
|
||||||
c.forEach((cat) => {
|
c.forEach((cat) => {
|
||||||
let docs = _.where(s, {categoryId: cat.get('id'), type: 'documents'});
|
let docs = _.filter(s, {categoryId: cat.get('id'), type: 'documents'});
|
||||||
let docCount = 0;
|
let docCount = 0;
|
||||||
docs.forEach((d) => { docCount = docCount + d.count });
|
docs.forEach((d) => { docCount = docCount + d.count });
|
||||||
|
|
||||||
let users = _.where(s, {categoryId: cat.get('id'), type: 'users'});
|
let users = _.filter(s, {categoryId: cat.get('id'), type: 'users'});
|
||||||
let userCount = 0;
|
let userCount = 0;
|
||||||
users.forEach((u) => { userCount = userCount + u.count });
|
users.forEach((u) => { userCount = userCount + u.count });
|
||||||
|
|
||||||
|
@ -62,9 +62,9 @@ export default Component.extend(ModalMixin, Notifer, {
|
||||||
|
|
||||||
this.get('categorySvc').getUserVisible(this.get('space.id')).then((cm) => {
|
this.get('categorySvc').getUserVisible(this.get('space.id')).then((cm) => {
|
||||||
cm.forEach((cm) => {
|
cm.forEach((cm) => {
|
||||||
let cat = _.findWhere(c, {id: cm.get('id') });
|
let cat = _.find(c, {id: cm.get('id') });
|
||||||
if (is.not.undefined(cat)) {
|
if (!_.isUndefined(cat)) {
|
||||||
cat.set('access', is.not.undefined(cat));
|
cat.set('access', !_.isUndefined(cat));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -91,7 +91,7 @@ export default Component.extend(ModalMixin, Notifer, {
|
||||||
let cats = this.get('category');
|
let cats = this.get('category');
|
||||||
let cat = cats.findBy('id', id);
|
let cat = cats.findBy('id', id);
|
||||||
|
|
||||||
if (is.not.undefined(cat)) {
|
if (!_.isUndefined(cat)) {
|
||||||
cat.set('editMode', val);
|
cat.set('editMode', val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ export default Component.extend(ModalMixin, Notifer, {
|
||||||
// mark those users as selected that have permission to see the current category
|
// mark those users as selected that have permission to see the current category
|
||||||
perms.forEach((perm) => {
|
perms.forEach((perm) => {
|
||||||
let c = categoryPermissions.findBy('whoId', perm.get('whoId'));
|
let c = categoryPermissions.findBy('whoId', perm.get('whoId'));
|
||||||
if (is.not.undefined(c)) {
|
if (!_.isUndefined(c)) {
|
||||||
c.set('selected', true);
|
c.set('selected', true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,7 +70,7 @@ export default Component.extend(AuthMixin, Notifier, {
|
||||||
this.set('spaceLabel', this.get('space.labelId'));
|
this.set('spaceLabel', this.get('space.labelId'));
|
||||||
|
|
||||||
let icon = this.get('space.icon');
|
let icon = this.get('space.icon');
|
||||||
if (is.empty(icon)) {
|
if (_.isEmpty(icon)) {
|
||||||
icon = constants.IconMeta.Apps;
|
icon = constants.IconMeta.Apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ export default Component.extend(Notifier, Modals, {
|
||||||
users.forEach((user) => {
|
users.forEach((user) => {
|
||||||
let exists = spacePermissions.findBy('whoId', user.get('id'));
|
let exists = spacePermissions.findBy('whoId', user.get('id'));
|
||||||
|
|
||||||
if (is.undefined(exists)) {
|
if (_.isUndefined(exists)) {
|
||||||
filteredUsers.pushObject(user);
|
filteredUsers.pushObject(user);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -203,7 +203,7 @@ export default Component.extend(Notifier, Modals, {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (is.not.undefined(hasEveryone)) {
|
if (!_.isUndefined(hasEveryone)) {
|
||||||
folder.markAsPublic();
|
folder.markAsPublic();
|
||||||
} else {
|
} else {
|
||||||
if (roleCount > 1) {
|
if (roleCount > 1) {
|
||||||
|
@ -238,7 +238,7 @@ export default Component.extend(Notifier, Modals, {
|
||||||
|
|
||||||
let exists = spacePermissions.findBy('whoId', user.get('id'));
|
let exists = spacePermissions.findBy('whoId', user.get('id'));
|
||||||
|
|
||||||
if (is.undefined(exists)) {
|
if (_.isUndefined(exists)) {
|
||||||
spacePermissions.pushObject(this.permissionRecord(constants.WhoType.User, user.get('id'), user.get('fullname')));
|
spacePermissions.pushObject(this.permissionRecord(constants.WhoType.User, user.get('id'), user.get('fullname')));
|
||||||
this.set('spacePermissions', spacePermissions);
|
this.set('spacePermissions', spacePermissions);
|
||||||
this.send('onSearch');
|
this.send('onSearch');
|
||||||
|
|
|
@ -46,8 +46,8 @@ export default Component.extend(AuthMixin, {
|
||||||
let selectedCategory = '';
|
let selectedCategory = '';
|
||||||
|
|
||||||
categories.forEach((cat)=> {
|
categories.forEach((cat)=> {
|
||||||
let summary = _.findWhere(categorySummary, {type: "documents", categoryId: cat.get('id')});
|
let summary = _.find(categorySummary, {type: "documents", categoryId: cat.get('id')});
|
||||||
let docCount = is.not.undefined(summary) ? summary.count : 0;
|
let docCount = !_.isUndefined(summary) ? summary.count : 0;
|
||||||
cat.set('docCount', docCount);
|
cat.set('docCount', docCount);
|
||||||
if (docCount > 0 && selectedCategory === '') {
|
if (docCount > 0 && selectedCategory === '') {
|
||||||
selectedCategory = cat.get('id');
|
selectedCategory = cat.get('id');
|
||||||
|
@ -56,7 +56,7 @@ export default Component.extend(AuthMixin, {
|
||||||
|
|
||||||
this.set('categories', categories);
|
this.set('categories', categories);
|
||||||
this.set('categoryLinkName', categories.length > 0 ? 'Manage' : 'Add');
|
this.set('categoryLinkName', categories.length > 0 ? 'Manage' : 'Add');
|
||||||
this.set('spaceLabel', _.findWhere(this.get('labels'), {id: this.get('space.labelId')}));
|
this.set('spaceLabel', _.find(this.get('labels'), {id: this.get('space.labelId')}));
|
||||||
|
|
||||||
schedule('afterRender', () => {
|
schedule('afterRender', () => {
|
||||||
if (this.get('categoryFilter') !== '') {
|
if (this.get('categoryFilter') !== '') {
|
||||||
|
@ -77,9 +77,9 @@ export default Component.extend(AuthMixin, {
|
||||||
|
|
||||||
switch (filter) {
|
switch (filter) {
|
||||||
case 'category':
|
case 'category':
|
||||||
allowed = _.pluck(_.where(categoryMembers, {'categoryId': id}), 'documentId');
|
allowed = _.map(_.filter(categoryMembers, {'categoryId': id}), 'documentId');
|
||||||
docs.forEach((d) => {
|
docs.forEach((d) => {
|
||||||
if (_.contains(allowed, d.get('id'))) {
|
if (_.includes(allowed, d.get('id'))) {
|
||||||
filtered.pushObject(d);
|
filtered.pushObject(d);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -88,9 +88,9 @@ export default Component.extend(AuthMixin, {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'uncategorized':
|
case 'uncategorized':
|
||||||
allowed = _.pluck(categoryMembers, 'documentId');
|
allowed = _.map(categoryMembers, 'documentId');
|
||||||
docs.forEach((d) => {
|
docs.forEach((d) => {
|
||||||
if (!_.contains(allowed, d.get('id'))) {
|
if (!_.includes(allowed, d.get('id'))) {
|
||||||
filtered.pushObject(d);
|
filtered.pushObject(d);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -92,7 +92,7 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
if (is.not.null(this.get('dropzone'))) {
|
if (!_.isNull(this.get('dropzone'))) {
|
||||||
this.get('dropzone').destroy();
|
this.get('dropzone').destroy();
|
||||||
this.set('dropzone', null);
|
this.set('dropzone', null);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
||||||
|
|
||||||
setupImport() {
|
setupImport() {
|
||||||
// already done init?
|
// already done init?
|
||||||
if (is.not.null(this.get('dropzone'))) {
|
if (!_.isNull(this.get('dropzone'))) {
|
||||||
this.get('dropzone').destroy();
|
this.get('dropzone').destroy();
|
||||||
this.set('dropzone', null);
|
this.set('dropzone', null);
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let docName = this.get('emptyDocName');
|
let docName = this.get('emptyDocName');
|
||||||
|
|
||||||
if (is.empty(docName)) {
|
if (_.isEmpty(docName)) {
|
||||||
this.set('emptyDocNameError', true);
|
this.set('emptyDocNameError', true);
|
||||||
$('#empty-doc-name').focus();
|
$('#empty-doc-name').focus();
|
||||||
return;
|
return;
|
||||||
|
@ -217,14 +217,14 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let docName = this.get('templateDocName');
|
let docName = this.get('templateDocName');
|
||||||
|
|
||||||
if (is.empty(docName)) {
|
if (_.isEmpty(docName)) {
|
||||||
this.set('templateDocNameError', true);
|
this.set('templateDocNameError', true);
|
||||||
$('#template-doc-name').focus();
|
$('#template-doc-name').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let id = this.get('selectedTemplate');
|
let id = this.get('selectedTemplate');
|
||||||
if (is.empty(id)) {
|
if (_.isEmpty(id)) {
|
||||||
$('#widget-list-picker').addClass('is-invalid');
|
$('#widget-list-picker').addClass('is-invalid');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ export default Component.extend(Modals, {
|
||||||
processNotification(msg, type) {
|
processNotification(msg, type) {
|
||||||
if (this.get('isDestroyed') || this.get('isDestroying')) return;
|
if (this.get('isDestroyed') || this.get('isDestroying')) return;
|
||||||
|
|
||||||
if (is.not.undefined(type)) {
|
if (!_.isUndefined(type)) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'info':
|
case 'info':
|
||||||
iziToast.info({
|
iziToast.info({
|
||||||
|
|
|
@ -38,7 +38,7 @@ export default Component.extend(ModalMixin, {
|
||||||
|
|
||||||
let msContainer = document.getElementById('section-editor-' + this.get('containerId'));
|
let msContainer = document.getElementById('section-editor-' + this.get('containerId'));
|
||||||
let mousetrap = this.get('mousetrap');
|
let mousetrap = this.get('mousetrap');
|
||||||
if (is.null(mousetrap)) {
|
if (_.isNull(mousetrap)) {
|
||||||
mousetrap = new Mousetrap(msContainer);
|
mousetrap = new Mousetrap(msContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ export default Component.extend(ModalMixin, {
|
||||||
this.set('showLinkModal', false);
|
this.set('showLinkModal', false);
|
||||||
|
|
||||||
let mousetrap = this.get('mousetrap');
|
let mousetrap = this.get('mousetrap');
|
||||||
if (is.not.null(mousetrap)) {
|
if (!_.isNull(mousetrap)) {
|
||||||
mousetrap.unbind('esc');
|
mousetrap.unbind('esc');
|
||||||
mousetrap.unbind(['ctrl+s', 'command+s']);
|
mousetrap.unbind(['ctrl+s', 'command+s']);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ export default Component.extend(ModalMixin, {
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onAction() {
|
onAction() {
|
||||||
if (this.get('busy') || is.empty(this.get('pageTitle'))) {
|
if (this.get('busy') || _.isEmpty(this.get('pageTitle'))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,12 +67,12 @@ export default Component.extend(ModalMixin, {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.empty(this.get('page.title'))) {
|
if (_.isEmpty(this.get('page.title'))) {
|
||||||
$("#page-title").addClass("is-invalid").focus();
|
$("#page-title").addClass("is-invalid").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.get('hasExcerpt') && is.empty(this.get('page.excerpt'))) {
|
if (this.get('hasExcerpt') && _.isEmpty(this.get('page.excerpt'))) {
|
||||||
$("#page-excerpt").addClass("is-invalid").focus();
|
$("#page-excerpt").addClass("is-invalid").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ export default Component.extend({
|
||||||
this.set('syntaxOptions', opts);
|
this.set('syntaxOptions', opts);
|
||||||
|
|
||||||
// default check
|
// default check
|
||||||
if (is.null(this.get("codeSyntax"))) {
|
if (_.isNull(this.get("codeSyntax"))) {
|
||||||
this.set("codeSyntax", opts.findBy("mode", "htmlmixed"));
|
this.set("codeSyntax", opts.findBy("mode", "htmlmixed"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -83,7 +83,7 @@ export default Component.extend({
|
||||||
};
|
};
|
||||||
|
|
||||||
let syntax = this.get("codeSyntax");
|
let syntax = this.get("codeSyntax");
|
||||||
if (is.not.undefined(syntax)) {
|
if (!_.isUndefined(syntax)) {
|
||||||
CodeMirror.autoLoadMode(editor, syntax.mode);
|
CodeMirror.autoLoadMode(editor, syntax.mode);
|
||||||
editor.setOption("mode", syntax.mode);
|
editor.setOption("mode", syntax.mode);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ export default Component.extend({
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
let editor = this.get('codeEditor');
|
let editor = this.get('codeEditor');
|
||||||
|
|
||||||
if (is.not.null(editor)) {
|
if (!_.isNull(editor)) {
|
||||||
editor.toTextArea();
|
editor.toTextArea();
|
||||||
editor = null;
|
editor = null;
|
||||||
this.set('codeEditor', null);
|
this.set('codeEditor', null);
|
||||||
|
|
|
@ -63,7 +63,7 @@ export default Component.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
let syntax = this.get("codeSyntax");
|
let syntax = this.get("codeSyntax");
|
||||||
if (is.not.undefined(syntax)) {
|
if (!_.isUndefined(syntax)) {
|
||||||
CodeMirror.autoLoadMode(editor, syntax.mode);
|
CodeMirror.autoLoadMode(editor, syntax.mode);
|
||||||
editor.setOption("mode", syntax.mode);
|
editor.setOption("mode", syntax.mode);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ export default Component.extend({
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
let editor = this.get('codeEditor');
|
let editor = this.get('codeEditor');
|
||||||
if (is.not.null(editor)) {
|
if (!_.isNull(editor)) {
|
||||||
editor.toTextArea();
|
editor.toTextArea();
|
||||||
editor = null;
|
editor = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ export default Component.extend({
|
||||||
invokeExport() {
|
invokeExport() {
|
||||||
// Cannot export if nothing has been changed
|
// Cannot export if nothing has been changed
|
||||||
// so we skip straight to the save process.
|
// so we skip straight to the save process.
|
||||||
if (is.empty(this.get('diagramXML'))) {
|
if (_.isEmpty(this.get('diagramXML'))) {
|
||||||
this.set('readyToSave', true);
|
this.set('readyToSave', true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ export default Component.extend({
|
||||||
|
|
||||||
// handle case where no diagram changes were made
|
// handle case where no diagram changes were made
|
||||||
let dg = this.get('diagram');
|
let dg = this.get('diagram');
|
||||||
if (is.empty(dg)) dg = this.get('meta.rawBody');
|
if (_.isEmpty(dg)) dg = this.get('meta.rawBody');
|
||||||
|
|
||||||
meta.set('rawBody', dg);
|
meta.set('rawBody', dg);
|
||||||
page.set('title', this.get('title'));
|
page.set('title', this.get('title'));
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default Component.extend(SectionMixin, {
|
||||||
config = JSON.parse(this.get('meta.config'));
|
config = JSON.parse(this.get('meta.config'));
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
|
|
||||||
if (is.empty(config)) {
|
if (_.isEmpty(config)) {
|
||||||
config = {
|
config = {
|
||||||
APIKey: "",
|
APIKey: "",
|
||||||
filter: {},
|
filter: {},
|
||||||
|
@ -148,15 +148,15 @@ export default Component.extend(SectionMixin, {
|
||||||
|
|
||||||
auth() {
|
auth() {
|
||||||
// missing data?
|
// missing data?
|
||||||
if (is.empty(this.get('config.url'))) {
|
if (_.isEmpty(this.get('config.url'))) {
|
||||||
$("#gemini-url").addClass("is-invalid").focus();
|
$("#gemini-url").addClass("is-invalid").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is.empty(this.get('config.username'))) {
|
if (_.isEmpty(this.get('config.username'))) {
|
||||||
$("#gemini-username").addClass("is-invalid").focus();
|
$("#gemini-username").addClass("is-invalid").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is.empty(this.get('config.APIKey'))) {
|
if (_.isEmpty(this.get('config.APIKey'))) {
|
||||||
$("#gemini-apikey").addClass("is-invalid").focus();
|
$("#gemini-apikey").addClass("is-invalid").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
let self = this;
|
let self = this;
|
||||||
let page = this.get('page');
|
let page = this.get('page');
|
||||||
|
|
||||||
if (is.undefined(this.get('config.clientId')) || is.undefined(this.get('config.callbackUrl'))) {
|
if (_.isUndefined(this.get('config.clientId')) || _.isUndefined(this.get('config.callbackUrl'))) {
|
||||||
self.get('sectionService').fetch(page, "config", {})
|
self.get('sectionService').fetch(page, "config", {})
|
||||||
.then(function (cfg) {
|
.then(function (cfg) {
|
||||||
let config = {};
|
let config = {};
|
||||||
|
@ -77,7 +77,7 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
let code = window.location.search;
|
let code = window.location.search;
|
||||||
code = code.replace("?mode=edit", "");
|
code = code.replace("?mode=edit", "");
|
||||||
|
|
||||||
if (is.not.undefined(code) && is.not.null(code) && is.not.empty(code) && code !== "") {
|
if (!_.isUndefined(code) && !_.isNull(code) && !_.isEmpty(code) && code !== "") {
|
||||||
let tok = code.replace("&code=", "");
|
let tok = code.replace("&code=", "");
|
||||||
self.get('sectionService').fetch(page, "saveSecret", { "token": tok })
|
self.get('sectionService').fetch(page, "saveSecret", { "token": tok })
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -111,7 +111,7 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
let owners = this.get('owners');
|
let owners = this.get('owners');
|
||||||
let thisOwner = this.get('config.owner');
|
let thisOwner = this.get('config.owner');
|
||||||
|
|
||||||
if (is.null(thisOwner) || is.undefined(thisOwner)) {
|
if (_.isNull(thisOwner) || _.isUndefined(thisOwner)) {
|
||||||
if (owners.length) {
|
if (owners.length) {
|
||||||
thisOwner = owners[0];
|
thisOwner = owners[0];
|
||||||
this.set('config.owner', thisOwner);
|
this.set('config.owner', thisOwner);
|
||||||
|
@ -124,7 +124,7 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
|
|
||||||
this.getOrgReposLists();
|
this.getOrgReposLists();
|
||||||
|
|
||||||
if (is.undefined(this.get('initDateTimePicker'))) {
|
if (_.isUndefined(this.get('initDateTimePicker'))) {
|
||||||
$.datetimepicker.setLocale('en');
|
$.datetimepicker.setLocale('en');
|
||||||
$('#branch-since').datetimepicker();
|
$('#branch-since').datetimepicker();
|
||||||
this.set('initDateTimePicker', "Done");
|
this.set('initDateTimePicker', "Done");
|
||||||
|
@ -157,10 +157,10 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
lists2.forEach(function (list) {
|
lists2.forEach(function (list) {
|
||||||
let included = false;
|
let included = false;
|
||||||
var saved;
|
var saved;
|
||||||
if (is.not.undefined(savedLists)) {
|
if (!_.isUndefined(savedLists)) {
|
||||||
saved = savedLists.findBy("id", list.id);
|
saved = savedLists.findBy("id", list.id);
|
||||||
}
|
}
|
||||||
if (is.not.undefined(saved)) {
|
if (!_.isUndefined(saved)) {
|
||||||
included = saved.selected;
|
included = saved.selected;
|
||||||
noIncluded = false;
|
noIncluded = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ export default Component.extend(SectionMixin, {
|
||||||
config = JSON.parse(this.get('meta.config'));
|
config = JSON.parse(this.get('meta.config'));
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
|
|
||||||
if (is.empty(config)) {
|
if (_.isEmpty(config)) {
|
||||||
config = {
|
config = {
|
||||||
jql: '',
|
jql: '',
|
||||||
itemCount: 0,
|
itemCount: 0,
|
||||||
|
|
|
@ -32,7 +32,7 @@ export default Component.extend({
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
let body = (is.not.undefined(this.get('meta'))) ? this.get('meta.rawBody').trim() : '';
|
let body = (!_.isUndefined(this.get('meta'))) ? this.get('meta.rawBody').trim() : '';
|
||||||
this.set('pageBody', body);
|
this.set('pageBody', body);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ export default Component.extend({
|
||||||
|
|
||||||
let syntax = this.get("codeSyntax");
|
let syntax = this.get("codeSyntax");
|
||||||
|
|
||||||
if (is.not.undefined(syntax)) {
|
if (!_.isUndefined(syntax)) {
|
||||||
CodeMirror.autoLoadMode(editor, "markdown");
|
CodeMirror.autoLoadMode(editor, "markdown");
|
||||||
editor.setOption("mode", "markdown");
|
editor.setOption("mode", "markdown");
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
config = JSON.parse(this.get('meta.config'));
|
config = JSON.parse(this.get('meta.config'));
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
|
|
||||||
if (is.empty(config)) {
|
if (_.isEmpty(config)) {
|
||||||
config = {
|
config = {
|
||||||
APIToken: "",
|
APIToken: "",
|
||||||
query: "",
|
query: "",
|
||||||
|
@ -78,12 +78,12 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
|
|
||||||
let options = self.get('options');
|
let options = self.get('options');
|
||||||
let group = {};
|
let group = {};
|
||||||
if (is.not.null(config.group)) {
|
if (!_.isNull(config.group)) {
|
||||||
group = _.findWhere(options.groups, { id: config.group.id });
|
group = _.find(options.groups, { id: config.group.id });
|
||||||
} else {
|
} else {
|
||||||
group = options.groups[0];
|
group = options.groups[0];
|
||||||
}
|
}
|
||||||
if (is.not.undefined(group)) {
|
if (!_.isUndefined(group)) {
|
||||||
set(config, 'group', group);
|
set(config, 'group', group);
|
||||||
}
|
}
|
||||||
}, function (reason) {
|
}, function (reason) {
|
||||||
|
@ -152,7 +152,7 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
|
|
||||||
let config = this.get('config');
|
let config = this.get('config');
|
||||||
let max = 10;
|
let max = 10;
|
||||||
if (is.number(parseInt(config.max))) {
|
if (_.isNumber(parseInt(config.max))) {
|
||||||
max = parseInt(config.max);
|
max = parseInt(config.max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default Component.extend({
|
||||||
|
|
||||||
this.set('pageBody', this.get('meta.rawBody'));
|
this.set('pageBody', this.get('meta.rawBody'));
|
||||||
|
|
||||||
if (is.empty(this.get('pageBody'))) {
|
if (_.isEmpty(this.get('pageBody'))) {
|
||||||
this.set('pageBody', this.get('defaultTable'));
|
this.set('pageBody', this.get('defaultTable'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -74,7 +74,7 @@ export default Component.extend({
|
||||||
let body = $('#' + this.get('editorId')).froalaEditor('html.get', true);
|
let body = $('#' + this.get('editorId')).froalaEditor('html.get', true);
|
||||||
page.set('title', title);
|
page.set('title', title);
|
||||||
|
|
||||||
if (is.empty(body)) {
|
if (_.isEmpty(body)) {
|
||||||
body = this.get('defaultTable');
|
body = this.get('defaultTable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ export default Component.extend(Modals, Notifier, {
|
||||||
|
|
||||||
this.set('pageBody', this.get('meta.rawBody'));
|
this.set('pageBody', this.get('meta.rawBody'));
|
||||||
|
|
||||||
if (is.empty(this.get('pageBody'))) {
|
if (_.isEmpty(this.get('pageBody'))) {
|
||||||
this.set('pageBody', this.get('defaultTable'));
|
this.set('pageBody', this.get('defaultTable'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ export default Component.extend(Modals, Notifier, {
|
||||||
|
|
||||||
generateImportTable(results) {
|
generateImportTable(results) {
|
||||||
// nothing to import?
|
// nothing to import?
|
||||||
if (is.undefined(results) || results.data.length === 0) {
|
if (_.isUndefined(results) || results.data.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ export default Component.extend(Modals, Notifier, {
|
||||||
let table = '<table class="wysiwyg-table" style="width: 100%;"><thead><tr>';
|
let table = '<table class="wysiwyg-table" style="width: 100%;"><thead><tr>';
|
||||||
|
|
||||||
// Setup the table headers
|
// Setup the table headers
|
||||||
if (opts.headers && is.array(results.meta.fields)) {
|
if (opts.headers && _.isArray(results.meta.fields)) {
|
||||||
// use headers from file
|
// use headers from file
|
||||||
results.meta.fields.forEach((header) => {
|
results.meta.fields.forEach((header) => {
|
||||||
table = table + '<th>' + header.trim() + '</th>';
|
table = table + '<th>' + header.trim() + '</th>';
|
||||||
|
@ -155,7 +155,7 @@ export default Component.extend(Modals, Notifier, {
|
||||||
results.data.forEach(row => {
|
results.data.forEach(row => {
|
||||||
table = table + '<tr>';
|
table = table + '<tr>';
|
||||||
|
|
||||||
if (is.array(row)) {
|
if (_.isArray(row)) {
|
||||||
row.forEach((cell) => {
|
row.forEach((cell) => {
|
||||||
table = table + '<td>' + cell.trim() + '</td>';
|
table = table + '<td>' + cell.trim() + '</td>';
|
||||||
});
|
});
|
||||||
|
@ -189,7 +189,7 @@ export default Component.extend(Modals, Notifier, {
|
||||||
|
|
||||||
this.modalClose('#' + this.get('modalId'));
|
this.modalClose('#' + this.get('modalId'));
|
||||||
|
|
||||||
if (is.empty(csv)) {
|
if (_.isEmpty(csv)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ export default Component.extend(Modals, Notifier, {
|
||||||
let editor = tinymce.EditorManager.get(this.get('editorId'));
|
let editor = tinymce.EditorManager.get(this.get('editorId'));
|
||||||
let userSelection = editor.selection.getContent();
|
let userSelection = editor.selection.getContent();
|
||||||
|
|
||||||
if (is.not.empty(userSelection)) {
|
if (!_.isEmpty(userSelection)) {
|
||||||
set(link, 'title', userSelection);
|
set(link, 'title', userSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,8 +219,8 @@ export default Component.extend(Modals, Notifier, {
|
||||||
isDirty() {
|
isDirty() {
|
||||||
let editor = tinymce.EditorManager.get(this.get('editorId'));
|
let editor = tinymce.EditorManager.get(this.get('editorId'));
|
||||||
return (
|
return (
|
||||||
is.not.undefined(tinymce) &&
|
!_.isUndefined(tinymce) &&
|
||||||
is.not.undefined(editor) &&
|
!_.isUndefined(editor) &&
|
||||||
editor.isDirty()
|
editor.isDirty()
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,13 +27,13 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
noBoards: false,
|
noBoards: false,
|
||||||
appKey: "",
|
appKey: "",
|
||||||
trelloConfigured: computed('appKey', function () {
|
trelloConfigured: computed('appKey', function () {
|
||||||
return is.not.empty(this.get('appKey'));
|
return !_.isEmpty(this.get('appKey'));
|
||||||
}),
|
}),
|
||||||
|
|
||||||
boardStyle: computed('config.board', function () {
|
boardStyle: computed('config.board', function () {
|
||||||
let board = this.get('config.board');
|
let board = this.get('config.board');
|
||||||
|
|
||||||
if (is.null(board) || is.undefined(board)) {
|
if (_.isNull(board) || _.isUndefined(board)) {
|
||||||
return "#4c4c4c";
|
return "#4c4c4c";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
config = JSON.parse(this.get('meta.config'));
|
config = JSON.parse(this.get('meta.config'));
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
|
|
||||||
if (is.empty(config)) {
|
if (_.isEmpty(config)) {
|
||||||
config = {
|
config = {
|
||||||
token: "",
|
token: "",
|
||||||
user: null,
|
user: null,
|
||||||
|
@ -73,9 +73,9 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
|
|
||||||
// On auth callback capture user token
|
// On auth callback capture user token
|
||||||
let hashToken = window.location.hash;
|
let hashToken = window.location.hash;
|
||||||
if (is.not.undefined(hashToken) && is.not.null(hashToken)) {
|
if (!_.isUndefined(hashToken) && !_.isNull(hashToken)) {
|
||||||
let token = hashToken.replace("#token=", "");
|
let token = hashToken.replace("#token=", "");
|
||||||
if (is.not.empty(token)) {
|
if (!_.isEmpty(token)) {
|
||||||
self.set('config.token', token);
|
self.set('config.token', token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,14 +100,14 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
let board = this.get('config.board');
|
let board = this.get('config.board');
|
||||||
let page = this.get('page');
|
let page = this.get('page');
|
||||||
|
|
||||||
if (is.null(boards) || is.undefined(boards) || boards.length === 0) {
|
if (_.isNull(boards) || _.isUndefined(boards) || boards.length === 0) {
|
||||||
this.set('noBoards', true);
|
this.set('noBoards', true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.set('noBoards', false);
|
this.set('noBoards', false);
|
||||||
|
|
||||||
if (is.null(board) || is.undefined(board)) {
|
if (_.isNull(board) || _.isUndefined(board)) {
|
||||||
if (boards.length) {
|
if (boards.length) {
|
||||||
board = boards[0];
|
board = boards[0];
|
||||||
this.set('config.board', board);
|
this.set('config.board', board);
|
||||||
|
@ -126,7 +126,7 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
lists.forEach(function (list) {
|
lists.forEach(function (list) {
|
||||||
let saved = savedLists.findBy("id", list.id);
|
let saved = savedLists.findBy("id", list.id);
|
||||||
let included = true;
|
let included = true;
|
||||||
if (is.not.undefined(saved)) {
|
if (!_.isUndefined(saved)) {
|
||||||
included = saved.included;
|
included = saved.included;
|
||||||
}
|
}
|
||||||
list.included = included;
|
list.included = included;
|
||||||
|
|
|
@ -138,7 +138,7 @@ export default Component.extend({
|
||||||
let editor = tinymce.EditorManager.get(this.get('editorId'));
|
let editor = tinymce.EditorManager.get(this.get('editorId'));
|
||||||
let userSelection = editor.selection.getContent();
|
let userSelection = editor.selection.getContent();
|
||||||
|
|
||||||
if (is.not.empty(userSelection)) {
|
if (!_.isEmpty(userSelection)) {
|
||||||
set(link, 'title', userSelection);
|
set(link, 'title', userSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,8 +151,8 @@ export default Component.extend({
|
||||||
isDirty() {
|
isDirty() {
|
||||||
let editor = tinymce.EditorManager.get(this.get('editorId'));
|
let editor = tinymce.EditorManager.get(this.get('editorId'));
|
||||||
return (
|
return (
|
||||||
is.not.undefined(tinymce) &&
|
!_.isUndefined(tinymce) &&
|
||||||
is.not.undefined(editor) &&
|
!_.isUndefined(editor) &&
|
||||||
editor.isDirty()
|
editor.isDirty()
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import { empty, and } from '@ember/object/computed';
|
import { empty, and } from '@ember/object/computed';
|
||||||
import { isEmpty } from '@ember/utils';
|
import { isEmpty } from '@ember/utils';
|
||||||
|
import stringUtil from '../utils/string';
|
||||||
import { set } from '@ember/object';
|
import { set } from '@ember/object';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ export default Component.extend({
|
||||||
return $("#adminLastname").focus();
|
return $("#adminLastname").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEmpty(this.get('model.email')) || !is.email(this.get('model.email'))) {
|
if (isEmpty(this.get('model.email')) || !stringUtil.isEmail(this.get('model.email'))) {
|
||||||
set(this, 'adminEmailError', true);
|
set(this, 'adminEmailError', true);
|
||||||
return $("#adminEmail").focus();
|
return $("#adminEmail").focus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,6 @@ export default Component.extend({
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
this.set('label', _.findWhere(this.get('labels'), {id: this.get('labelId')}));
|
this.set('label', _.find(this.get('labels'), {id: this.get('labelId')}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -76,7 +76,7 @@ export default Component.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
click(e) {
|
click(e) {
|
||||||
if (is.not.undefined(this.onClick)) {
|
if (!_.isUndefined(this.onClick)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.onClick(e);
|
this.onClick(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,11 @@ export default Component.extend({
|
||||||
let icon = this.icon;
|
let icon = this.icon;
|
||||||
let constants = this.get('constants');
|
let constants = this.get('constants');
|
||||||
|
|
||||||
if (is.null(icon)) {
|
if (_.isNull(icon)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.empty(icon)) {
|
if (_.isEmpty(icon)) {
|
||||||
icon = constants.IconMeta.Apps;
|
icon = constants.IconMeta.Apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,12 +37,12 @@ export default Component.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
click(e) {
|
click(e) {
|
||||||
if (is.not.undefined(this.onClick)) {
|
if (!_.isUndefined(this.onClick)) {
|
||||||
this.onClick(e);
|
this.onClick(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.not.undefined(this.linkTo)) {
|
if (!_.isUndefined(this.linkTo)) {
|
||||||
// TODO: pass in linkModel, linkOptions
|
// TODO: pass in linkModel, linkOptions
|
||||||
// https://emberjs.com/api/ember/3.5/classes/RouterService/methods/transitionTo?anchor=transitionTo
|
// https://emberjs.com/api/ember/3.5/classes/RouterService/methods/transitionTo?anchor=transitionTo
|
||||||
this.router.transitionTo(this.get('linkTo'));
|
this.router.transitionTo(this.get('linkTo'));
|
||||||
|
|
|
@ -33,11 +33,11 @@ export default Component.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
click(e) {
|
click(e) {
|
||||||
if (is.not.undefined(this.onClick)) {
|
if (!_.isUndefined(this.onClick)) {
|
||||||
this.onClick(e);
|
this.onClick(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is.not.undefined(this.linkTo)) {
|
if (!_.isUndefined(this.linkTo)) {
|
||||||
// TODO: pass in linkModel, linkOptions
|
// TODO: pass in linkModel, linkOptions
|
||||||
// https://emberjs.com/api/ember/3.5/classes/RouterService/methods/transitionTo?anchor=transitionTo
|
// https://emberjs.com/api/ember/3.5/classes/RouterService/methods/transitionTo?anchor=transitionTo
|
||||||
this.router.transitionTo(this.linkTo);
|
this.router.transitionTo(this.linkTo);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { computed, set } from '@ember/object';
|
||||||
import { isPresent, isEqual, isEmpty } from '@ember/utils';
|
import { isPresent, isEqual, isEmpty } from '@ember/utils';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import AuthProvider from '../../mixins/auth';
|
import AuthProvider from '../../mixins/auth';
|
||||||
|
import stringUtil from '../../utils/string';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
|
|
||||||
export default Component.extend(AuthProvider, {
|
export default Component.extend(AuthProvider, {
|
||||||
|
@ -23,7 +24,7 @@ export default Component.extend(AuthProvider, {
|
||||||
hasLastnameError: empty('model.lastname'),
|
hasLastnameError: empty('model.lastname'),
|
||||||
hasEmailError: computed('model.email', function() {
|
hasEmailError: computed('model.email', function() {
|
||||||
let email = this.get('model.email');
|
let email = this.get('model.email');
|
||||||
return isEmpty(email) || is.not.email(email);
|
return isEmpty(email) || !stringUtil.isEmail(email);
|
||||||
}),
|
}),
|
||||||
hasPasswordError: computed('passwordError', 'password.password', {
|
hasPasswordError: computed('passwordError', 'password.password', {
|
||||||
get() {
|
get() {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { helper } from '@ember/component/helper';
|
||||||
export function formattedDate(params) {
|
export function formattedDate(params) {
|
||||||
let date = params[0];
|
let date = params[0];
|
||||||
let format = params[1];
|
let format = params[1];
|
||||||
if (is.undefined(format)) format = 'Do MMMM YYYY, HH:mm';
|
if (_.isUndefined(format)) format = 'Do MMMM YYYY, HH:mm';
|
||||||
|
|
||||||
// https://momentjs.com/docs/#/manipulating/local/
|
// https://momentjs.com/docs/#/manipulating/local/
|
||||||
return moment.utc(date).local().format(format);
|
return moment.utc(date).local().format(format);
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { helper } from '@ember/component/helper';
|
||||||
export function formattedPrice(params) {
|
export function formattedPrice(params) {
|
||||||
let pence = params[0];
|
let pence = params[0];
|
||||||
|
|
||||||
if(is.not.number(pence)) {
|
if(!_.isNumber(pence)) {
|
||||||
return '$0'
|
return '$0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
import { helper } from '@ember/component/helper';
|
import { helper } from '@ember/component/helper';
|
||||||
|
|
||||||
export function isOneOf(params/*, hash*/) {
|
export function isOneOf(params/*, hash*/) {
|
||||||
if (is.not.undefined(params) || is.not.null(params)) {
|
if (!_.isUndefined(params) || !_.isNull(params)) {
|
||||||
if (params.length >= 2) {
|
if (params.length >= 2) {
|
||||||
let value = params[0];
|
let value = params[0];
|
||||||
for (let i=1; i < params.length; i++) {
|
for (let i=1; i < params.length; i++) {
|
||||||
|
|
|
@ -16,10 +16,10 @@ export function userInitials(params) {
|
||||||
let firstname = params[0];
|
let firstname = params[0];
|
||||||
let lastname = params[1];
|
let lastname = params[1];
|
||||||
|
|
||||||
if (is.undefined(firstname)) {
|
if (_.isUndefined(firstname)) {
|
||||||
firstname = " ";
|
firstname = " ";
|
||||||
}
|
}
|
||||||
if (is.undefined(lastname)) {
|
if (_.isUndefined(lastname)) {
|
||||||
lastname = " ";
|
lastname = " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import $ from 'jquery';
|
||||||
import constants from '../constants/constants';
|
import constants from '../constants/constants';
|
||||||
|
|
||||||
export function initialize(application) {
|
export function initialize(application) {
|
||||||
// address insecure jquery defaults (kudos: @nathanhammond)
|
|
||||||
$.globalEval = function() {};
|
$.globalEval = function() {};
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
crossDomain: true,
|
crossDomain: true,
|
||||||
|
@ -22,10 +21,6 @@ export function initialize(application) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// required since Ember 3.8.0 upgrade to avoid clash with underscore.js
|
|
||||||
window.lodash = _.noConflict();
|
|
||||||
// window.underscore = _.noConflict();
|
|
||||||
|
|
||||||
let cs = constants.constants;
|
let cs = constants.constants;
|
||||||
application.register('constants:main', cs);
|
application.register('constants:main', cs);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default Mixin.create({
|
||||||
$(modalId).modal('dispose');
|
$(modalId).modal('dispose');
|
||||||
$(modalId).modal(options);
|
$(modalId).modal(options);
|
||||||
|
|
||||||
if (is.not.undefined(focusId)) {
|
if (!_.isUndefined(focusId)) {
|
||||||
$(focusId).trigger('focus');
|
$(focusId).trigger('focus');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default Model.extend({
|
||||||
countContent: attr('number', { defaultValue: 0 }),
|
countContent: attr('number', { defaultValue: 0 }),
|
||||||
|
|
||||||
allowLikes: computed('likes', function () {
|
allowLikes: computed('likes', function () {
|
||||||
return is.not.empty(this.get('likes')) && is.not.undefined(this.get('likes'));
|
return !_.isEmpty(this.get('likes')) && !_.isUndefined(this.get('likes'));
|
||||||
}),
|
}),
|
||||||
|
|
||||||
slug: computed('name', function () {
|
slug: computed('name', function () {
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default Route.extend({
|
||||||
return new EmberPromise((resolve) => {
|
return new EmberPromise((resolve) => {
|
||||||
let constants = this.get('constants');
|
let constants = this.get('constants');
|
||||||
|
|
||||||
this.set('mode', is.not.undefined(transition.to.queryParams.mode) ? transition.to.queryParams.mode : 'reject');
|
this.set('mode', !_.isUndefined(transition.to.queryParams.mode) ? transition.to.queryParams.mode : 'reject');
|
||||||
|
|
||||||
if (this.get('mode') === 'reject' || this.get('appMeta.authProvider') !== constants.AuthProvider.Keycloak) {
|
if (this.get('mode') === 'reject' || this.get('appMeta.authProvider') !== constants.AuthProvider.Keycloak) {
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -41,7 +41,7 @@ export default Route.extend({
|
||||||
this.get("session").authenticate('authenticator:keycloak', data).then(() => {
|
this.get("session").authenticate('authenticator:keycloak', data).then(() => {
|
||||||
this.transitionTo('folders');
|
this.transitionTo('folders');
|
||||||
}, (reject) => {
|
}, (reject) => {
|
||||||
if (is.not.undefined(reject.Error)) {
|
if (!_.isUndefined(reject.Error)) {
|
||||||
this.set('message', reject.Error);
|
this.set('message', reject.Error);
|
||||||
} else {
|
} else {
|
||||||
this.set('message', reject);
|
this.set('message', reject);
|
||||||
|
|
|
@ -14,7 +14,7 @@ import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default Route.extend(AuthenticatedRouteMixin, {
|
export default Route.extend(AuthenticatedRouteMixin, {
|
||||||
beforeModel: function (transition) {
|
beforeModel: function (transition) {
|
||||||
if (is.equal(transition.targetName, 'customize.index')) {
|
if (_.isEqual(transition.targetName, 'customize.index')) {
|
||||||
this.transitionTo('customize.general');
|
this.transitionTo('customize.general');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default Route.extend(AuthenticatedRouteMixin, {
|
||||||
beforeModel(transition) {
|
beforeModel(transition) {
|
||||||
// Note the source that sent user to this document.
|
// Note the source that sent user to this document.
|
||||||
let source = transition.to.queryParams.source;
|
let source = transition.to.queryParams.source;
|
||||||
if (is.null(source) || is.undefined(source)) source = "";
|
if (_.isNull(source) || _.isUndefined(source)) source = "";
|
||||||
|
|
||||||
return new EmberPromise((resolve) => {
|
return new EmberPromise((resolve) => {
|
||||||
this.get('documentService').fetchPages(this.paramsFor('document').document_id, this.get('session.user.id'), source).then((data) => {
|
this.get('documentService').fetchPages(this.paramsFor('document').document_id, this.get('session.user.id'), source).then((data) => {
|
||||||
|
|
|
@ -67,7 +67,7 @@ export default Route.extend(AuthenticatedRouteMixin, {
|
||||||
let rootDocCount = 0;
|
let rootDocCount = 0;
|
||||||
|
|
||||||
// get documentId's from category members
|
// get documentId's from category members
|
||||||
let withCat = _.pluck(categoryMembers, 'documentId');
|
let withCat = _.map(categoryMembers, 'documentId');
|
||||||
|
|
||||||
// calculate documents without category;
|
// calculate documents without category;
|
||||||
docs.forEach((d) => {
|
docs.forEach((d) => {
|
||||||
|
|
|
@ -61,7 +61,7 @@ export default Controller.extend(AuthMixin, Modals, {
|
||||||
let spaceLabel = this.get('spaceLabel');
|
let spaceLabel = this.get('spaceLabel');
|
||||||
let clonedId = this.get('clonedSpace.id');
|
let clonedId = this.get('clonedSpace.id');
|
||||||
|
|
||||||
if (is.empty(spaceName)) {
|
if (_.isEmpty(spaceName)) {
|
||||||
$("#new-space-name").addClass("is-invalid").focus();
|
$("#new-space-name").addClass("is-invalid").focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ export default Route.extend(AuthenticatedRouteMixin, {
|
||||||
});
|
});
|
||||||
|
|
||||||
_.each(model.labels, label => {
|
_.each(model.labels, label => {
|
||||||
let spaces = _.where(model.spaces, {labelId: label.get('id')});
|
let spaces = _.filter(model.spaces, {labelId: label.get('id')});
|
||||||
label.set('count', spaces.length);
|
label.set('count', spaces.length);
|
||||||
controller.set(label.get('id'), spaces);
|
controller.set(label.get('id'), spaces);
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,11 +17,11 @@ export default Route.extend(AuthenticatedRouteMixin, {
|
||||||
|
|
||||||
beforeModel(transition) {
|
beforeModel(transition) {
|
||||||
let matchFilter = {
|
let matchFilter = {
|
||||||
matchDoc: is.undefined(transition.to.queryParams.matchDoc) ? true : (transition.to.queryParams.matchDoc == 'true'),
|
matchDoc: _.isUndefined(transition.to.queryParams.matchDoc) ? true : (transition.to.queryParams.matchDoc == 'true'),
|
||||||
matchContent: is.undefined(transition.to.queryParams.matchContent) ? true : (transition.to.queryParams.matchContent == 'true'),
|
matchContent: _.isUndefined(transition.to.queryParams.matchContent) ? true : (transition.to.queryParams.matchContent == 'true'),
|
||||||
matchTag: is.undefined(transition.to.queryParams.matchTag) ? true : (transition.to.queryParams.matchTag == 'true'),
|
matchTag: _.isUndefined(transition.to.queryParams.matchTag) ? true : (transition.to.queryParams.matchTag == 'true'),
|
||||||
matchFile: is.undefined(transition.to.queryParams.matchFile) ? true : (transition.to.queryParams.matchFile == 'true'),
|
matchFile: _.isUndefined(transition.to.queryParams.matchFile) ? true : (transition.to.queryParams.matchFile == 'true'),
|
||||||
slog: is.undefined(transition.to.queryParams.slog) ? false : (transition.to.queryParams.slog === 'true'),
|
slog: _.isUndefined(transition.to.queryParams.slog) ? false : (transition.to.queryParams.slog === 'true'),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.set('matchFilter', matchFilter);
|
this.set('matchFilter', matchFilter);
|
||||||
|
|
|
@ -42,10 +42,10 @@ export default Route.extend(ApplicationRouteMixin, {
|
||||||
|
|
||||||
let next = this.get('localStorage').getSessionItem('entryUrl');
|
let next = this.get('localStorage').getSessionItem('entryUrl');
|
||||||
|
|
||||||
if (is.not.null(next) && is.not.undefined(next)) {
|
if (!_.isNull(next) && !_.isUndefined(next)) {
|
||||||
this.get('localStorage').clearSessionItem('entryUrl')
|
this.get('localStorage').clearSessionItem('entryUrl')
|
||||||
|
|
||||||
if (is.not.include(next, '/auth/')) {
|
if (!_.includes(next, '/auth/')) {
|
||||||
window.location.href= next;
|
window.location.href= next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default AjaxService.extend({
|
||||||
let appVersion = headers['x-documize-version'];
|
let appVersion = headers['x-documize-version'];
|
||||||
|
|
||||||
// Unauthorized local API AJAX calls redirect to app root.
|
// Unauthorized local API AJAX calls redirect to app root.
|
||||||
if (status === 401 && is.not.undefined(appVersion) && is.not.include(window.location.href, '/auth')) {
|
if (status === 401 && !_.isUndefined(appVersion) && !_.includes(window.location.href, '/auth')) {
|
||||||
this.get('localStorage').clearAll();
|
this.get('localStorage').clearAll();
|
||||||
window.location.href = 'auth/login';
|
window.location.href = 'auth/login';
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ export default AjaxService.extend({
|
||||||
this.set('appMeta.valid', false);
|
this.set('appMeta.valid', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.get('session.authenticated') && is.not.empty(userUpdate) && is.not.undefined(userUpdate)) {
|
if (this.get('session.authenticated') && !_.isEmpty(userUpdate) && !_.isUndefined(userUpdate)) {
|
||||||
let latest = JSON.parse(userUpdate);
|
let latest = JSON.parse(userUpdate);
|
||||||
// Permission change means re-validation.
|
// Permission change means re-validation.
|
||||||
if (!latest.active || user.editor !== latest.editor || user.admin !== latest.admin ||
|
if (!latest.active || user.editor !== latest.editor || user.admin !== latest.admin ||
|
||||||
|
|
|
@ -53,7 +53,7 @@ export default Service.extend({
|
||||||
this.set('authProvider', constants.AuthProvider.Documize);
|
this.set('authProvider', constants.AuthProvider.Documize);
|
||||||
|
|
||||||
let dbhash;
|
let dbhash;
|
||||||
if (is.not.null(document.head.querySelector("[property=dbhash]"))) {
|
if (!_.isNull(document.head.querySelector("[property=dbhash]"))) {
|
||||||
dbhash = document.head.querySelector("[property=dbhash]").content;
|
dbhash = document.head.querySelector("[property=dbhash]").content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ export default Service.extend({
|
||||||
|
|
||||||
this.get('localStorage').clearAll();
|
this.get('localStorage').clearAll();
|
||||||
return resolve(this);
|
return resolve(this);
|
||||||
} else if (is.not.include(requestedUrl, '/auth/')) {
|
} else if (!_.includes(requestedUrl, '/auth/')) {
|
||||||
this.get('localStorage').storeSessionItem('entryUrl', requestedUrl);
|
this.get('localStorage').storeSessionItem('entryUrl', requestedUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default Service.extend({
|
||||||
setMetaDescription(description) {
|
setMetaDescription(description) {
|
||||||
$('meta[name=description]').remove();
|
$('meta[name=description]').remove();
|
||||||
|
|
||||||
if (is.null(description) || is.undefined(description)) {
|
if (_.isNull(description) || _.isUndefined(description)) {
|
||||||
description = this.get('sessionService.appMeta.message');
|
description = this.get('sessionService.appMeta.message');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -44,7 +44,7 @@ export default Service.extend({
|
||||||
scrollTo(id) {
|
scrollTo(id) {
|
||||||
schedule('afterRender', () => {
|
schedule('afterRender', () => {
|
||||||
let elem = $(id).offset();
|
let elem = $(id).offset();
|
||||||
if (is.undefined(elem)) return;
|
if (_.isUndefined(elem)) return;
|
||||||
|
|
||||||
$('html, body').animate({
|
$('html, body').animate({
|
||||||
scrollTop: elem.top
|
scrollTop: elem.top
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default BaseService.extend({
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('category', obj);
|
let data = this.get('store').normalize('category', obj);
|
||||||
|
@ -53,7 +53,7 @@ export default BaseService.extend({
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('category', obj);
|
let data = this.get('store').normalize('category', obj);
|
||||||
|
@ -91,7 +91,7 @@ export default BaseService.extend({
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
// return response;
|
// return response;
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('category-permission', obj);
|
let data = this.get('store').normalize('category-permission', obj);
|
||||||
|
@ -108,7 +108,7 @@ export default BaseService.extend({
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('user', obj);
|
let data = this.get('store').normalize('user', obj);
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default Service.extend({
|
||||||
let documents = ArrayProxy.create({
|
let documents = ArrayProxy.create({
|
||||||
content: A([])
|
content: A([])
|
||||||
});
|
});
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
documents = response.map((doc) => {
|
documents = response.map((doc) => {
|
||||||
let data = this.get('store').normalize('document', doc);
|
let data = this.get('store').normalize('document', doc);
|
||||||
|
@ -115,7 +115,7 @@ export default Service.extend({
|
||||||
return this.get('ajax').request(`documents/${documentId}/pages`, {
|
return this.get('ajax').request(`documents/${documentId}/pages`, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
let pages = [];
|
let pages = [];
|
||||||
|
|
||||||
pages = response.map((page) => {
|
pages = response.map((page) => {
|
||||||
|
@ -218,7 +218,7 @@ export default Service.extend({
|
||||||
return this.get('ajax').request(`documents/${documentId}/pages?content=0`, {
|
return this.get('ajax').request(`documents/${documentId}/pages?content=0`, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
let data = [];
|
let data = [];
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
|
@ -288,7 +288,7 @@ export default Service.extend({
|
||||||
return this.get('ajax').request(`sections/targets`, {
|
return this.get('ajax').request(`sections/targets`, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
let data = [];
|
let data = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
|
@ -335,7 +335,7 @@ export default Service.extend({
|
||||||
} else {
|
} else {
|
||||||
let id = this.get('storageSvc').getSessionItem('anonId');
|
let id = this.get('storageSvc').getSessionItem('anonId');
|
||||||
|
|
||||||
if (is.not.null(id) && is.not.undefined(id) && id.length >= 16) {
|
if (!_.isNull(id) && !_.isUndefined(id) && id.length >= 16) {
|
||||||
userId = id;
|
userId = id;
|
||||||
} else {
|
} else {
|
||||||
userId = stringUtil.anonUserId();
|
userId = stringUtil.anonUserId();
|
||||||
|
@ -443,7 +443,7 @@ export default Service.extend({
|
||||||
let userHasChangeAwaitingReview = false;
|
let userHasChangeAwaitingReview = false;
|
||||||
let userHasChangeRejected = false;
|
let userHasChangeRejected = false;
|
||||||
|
|
||||||
if (is.null(source) || is.undefined(source)) source = "";
|
if (_.isNull(source) || _.isUndefined(source)) source = "";
|
||||||
|
|
||||||
return this.get('ajax').request(`fetch/page/${documentId}?source=${source}`, {
|
return this.get('ajax').request(`fetch/page/${documentId}?source=${source}`, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
|
|
|
@ -102,7 +102,7 @@ export default BaseService.extend({
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('folder', obj);
|
let data = this.get('store').normalize('folder', obj);
|
||||||
|
@ -125,7 +125,7 @@ export default BaseService.extend({
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
obj.id = 'sp-' + obj.id;
|
obj.id = 'sp-' + obj.id;
|
||||||
|
@ -156,7 +156,7 @@ export default BaseService.extend({
|
||||||
|
|
||||||
// Current folder caching
|
// Current folder caching
|
||||||
setCurrentFolder(folder) {
|
setCurrentFolder(folder) {
|
||||||
if (is.undefined(folder) || is.null(folder)) {
|
if (_.isUndefined(folder) || _.isNull(folder)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ export default BaseService.extend({
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('folder', obj);
|
let data = this.get('store').normalize('folder', obj);
|
||||||
|
|
|
@ -35,7 +35,7 @@ export default BaseService.extend({
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('group', obj);
|
let data = this.get('store').normalize('group', obj);
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default Service.extend({
|
||||||
|
|
||||||
boot() {
|
boot() {
|
||||||
return new EmberPromise((resolve, reject) => {
|
return new EmberPromise((resolve, reject) => {
|
||||||
if (is.not.undefined(this.get('keycloak')) && is.not.null(this.get('keycloak')) ) {
|
if (!_.isUndefined(this.get('keycloak')) && !_.isNull(this.get('keycloak')) ) {
|
||||||
resolve(this.get('keycloak'));
|
resolve(this.get('keycloak'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -94,12 +94,12 @@ export default Service.extend({
|
||||||
return {
|
return {
|
||||||
domain: '',
|
domain: '',
|
||||||
token: this.get('keycloak').token,
|
token: this.get('keycloak').token,
|
||||||
remoteId: is.null(profile.id) || is.undefined(profile.id) ? profile.email: profile.id,
|
remoteId: _.isNull(profile.id) || _.isUndefined(profile.id) ? profile.email: profile.id,
|
||||||
email: is.null(profile.email) || is.undefined(profile.email) ? '': profile.email,
|
email: _.isNull(profile.email) || _.isUndefined(profile.email) ? '': profile.email,
|
||||||
username: is.null(profile.username) || is.undefined(profile.username) ? '': profile.username,
|
username: _.isNull(profile.username) || _.isUndefined(profile.username) ? '': profile.username,
|
||||||
firstname: is.null(profile.firstName) || is.undefined(profile.firstName) ? profile.username: profile.firstName,
|
firstname: _.isNull(profile.firstName) || _.isUndefined(profile.firstName) ? profile.username: profile.firstName,
|
||||||
lastname: is.null(profile.lastName) || is.undefined(profile.lastName) ? profile.username: profile.lastName,
|
lastname: _.isNull(profile.lastName) || _.isUndefined(profile.lastName) ? profile.username: profile.lastName,
|
||||||
enabled: is.null(profile.enabled) || is.undefined(profile.enabled) ? true: profile.enabled
|
enabled: _.isNull(profile.enabled) || _.isUndefined(profile.enabled) ? true: profile.enabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default BaseService.extend({
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.null(response)) response = [];
|
if (_.isNull(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('label', obj);
|
let data = this.get('store').normalize('label', obj);
|
||||||
|
|
|
@ -84,7 +84,7 @@ export default Service.extend(Notifier, {
|
||||||
documentId: a.attributes["data-link-target-document-id"].value,
|
documentId: a.attributes["data-link-target-document-id"].value,
|
||||||
spaceId: a.attributes["data-link-space-id"].value,
|
spaceId: a.attributes["data-link-space-id"].value,
|
||||||
targetId: a.attributes["data-link-target-id"].value,
|
targetId: a.attributes["data-link-target-id"].value,
|
||||||
externalId: is.undefined(a.attributes["data-link-external-id"]) ? '' : a.attributes["data-link-external-id"].value,
|
externalId: _.isUndefined(a.attributes["data-link-external-id"]) ? '' : a.attributes["data-link-external-id"].value,
|
||||||
url: a.attributes["href"].value,
|
url: a.attributes["href"].value,
|
||||||
orphan: false
|
orphan: false
|
||||||
};
|
};
|
||||||
|
@ -111,8 +111,8 @@ export default Service.extend(Notifier, {
|
||||||
let router = this.get('router');
|
let router = this.get('router');
|
||||||
let targetFolder = this.get('store').peekRecord('folder', link.spaceId);
|
let targetFolder = this.get('store').peekRecord('folder', link.spaceId);
|
||||||
let targetDocument = this.get('store').peekRecord('document', link.documentId);
|
let targetDocument = this.get('store').peekRecord('document', link.documentId);
|
||||||
let folderSlug = is.null(targetFolder) ? "s" : targetFolder.get('slug');
|
let folderSlug = _.isNull(targetFolder) ? "s" : targetFolder.get('slug');
|
||||||
let documentSlug = is.null(targetDocument) ? "d" : targetDocument.get('slug');
|
let documentSlug = _.isNull(targetDocument) ? "d" : targetDocument.get('slug');
|
||||||
|
|
||||||
// handle section link
|
// handle section link
|
||||||
if (link.linkType === "section" || link.linkType === "tab") {
|
if (link.linkType === "section" || link.linkType === "tab") {
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default Service.extend({
|
||||||
return this.get('ajax').request(`pin/${userId}`, {
|
return this.get('ajax').request(`pin/${userId}`, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
let pins = ArrayProxy.create({ content: A([]) });
|
let pins = ArrayProxy.create({ content: A([]) });
|
||||||
|
|
||||||
pins = response.map((pin) => {
|
pins = response.map((pin) => {
|
||||||
|
@ -93,7 +93,7 @@ export default Service.extend({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: JSON.stringify(data)
|
data: JSON.stringify(data)
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
let pins = ArrayProxy.create({
|
let pins = ArrayProxy.create({
|
||||||
content: A([])
|
content: A([])
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default Service.extend({
|
||||||
data: JSON.stringify(payload),
|
data: JSON.stringify(payload),
|
||||||
contentType: 'json'
|
contentType: 'json'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
let results = ArrayProxy.create({
|
let results = ArrayProxy.create({
|
||||||
content: A([])
|
content: A([])
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default BaseService.extend({
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('section', obj);
|
let data = this.get('store').normalize('section', obj);
|
||||||
|
@ -70,9 +70,9 @@ export default BaseService.extend({
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let pages = [];
|
let pages = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
if (is.not.null(response) && is.array(response) && response.length > 0) {
|
if (!_.isNull(response) && _.isArray(response) && response.length > 0) {
|
||||||
pages = response.map((page) => {
|
pages = response.map((page) => {
|
||||||
let data = this.get('store').normalize('page', page);
|
let data = this.get('store').normalize('page', page);
|
||||||
return this.get('store').push(data);
|
return this.get('store').push(data);
|
||||||
|
@ -119,7 +119,7 @@ export default BaseService.extend({
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('block', obj);
|
let data = this.get('store').normalize('block', obj);
|
||||||
|
|
|
@ -23,13 +23,11 @@ export default SimpleAuthSession.extend({
|
||||||
localStorage: service(),
|
localStorage: service(),
|
||||||
folderPermissions: null,
|
folderPermissions: null,
|
||||||
currentFolder: null,
|
currentFolder: null,
|
||||||
isMac: false,
|
|
||||||
isMobile: false,
|
|
||||||
|
|
||||||
secureToken: '',
|
secureToken: '',
|
||||||
hasSecureToken: computed('secureToken', function () {
|
hasSecureToken: computed('secureToken', function () {
|
||||||
let st = this.get('secureToken');
|
let st = this.get('secureToken');
|
||||||
return is.not.null(st) && is.not.undefined(st) && st.length > 0;
|
return !_.isNull(st) && !_.isUndefined(st) && st.length > 0;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
hasAccounts: computed('isAuthenticated', 'session.content.authenticated.user', function () {
|
hasAccounts: computed('isAuthenticated', 'session.content.authenticated.user', function () {
|
||||||
|
@ -51,7 +49,7 @@ export default SimpleAuthSession.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
authenticated: computed('session.content.authenticated.user', function () {
|
authenticated: computed('session.content.authenticated.user', function () {
|
||||||
if (is.null(this.get('session.authenticator')) || this.get('appMeta.secureMode')) return false;
|
if (_.isNull(this.get('session.authenticator')) || this.get('appMeta.secureMode')) return false;
|
||||||
return this.get('session.authenticator') !== 'authenticator:anonymous' && this.get('session.content.authenticated.user.id') !== '0';
|
return this.get('session.authenticator') !== 'authenticator:anonymous' && this.get('session.content.authenticated.user.id') !== '0';
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -92,7 +90,7 @@ export default SimpleAuthSession.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
authToken: computed('session.content.authenticated.user', function () {
|
authToken: computed('session.content.authenticated.user', function () {
|
||||||
if (is.null(this.get('session.authenticator')) ||
|
if (_.isNull(this.get('session.authenticator')) ||
|
||||||
this.get('appMeta.secureMode')) return '';
|
this.get('appMeta.secureMode')) return '';
|
||||||
|
|
||||||
if (this.get('session.authenticator') === 'authenticator:anonymous' ||
|
if (this.get('session.authenticator') === 'authenticator:anonymous' ||
|
||||||
|
@ -103,9 +101,6 @@ export default SimpleAuthSession.extend({
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
this.set('isMac', is.mac());
|
|
||||||
this.set('isMobile', is.mobile());
|
|
||||||
},
|
},
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default Service.extend({
|
||||||
return this.get('ajax').request(`templates/${folderId}`, {
|
return this.get('ajax').request(`templates/${folderId}`, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
let templates = ArrayProxy.create({
|
let templates = ArrayProxy.create({
|
||||||
content: A([])
|
content: A([])
|
||||||
|
|
|
@ -56,7 +56,7 @@ export default Service.extend({
|
||||||
// Returns all active users for organization.
|
// Returns all active users for organization.
|
||||||
getAll() {
|
getAll() {
|
||||||
return this.get('ajax').request(`users?active=1`).then((response) => {
|
return this.get('ajax').request(`users?active=1`).then((response) => {
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
return response.map((obj) => {
|
return response.map((obj) => {
|
||||||
let data = this.get('store').normalize('user', obj);
|
let data = this.get('store').normalize('user', obj);
|
||||||
|
@ -71,10 +71,10 @@ export default Service.extend({
|
||||||
getComplete(filter, limit) {
|
getComplete(filter, limit) {
|
||||||
filter = filter.trim();
|
filter = filter.trim();
|
||||||
if (filter.length > 0) filter = encodeURIComponent(filter);
|
if (filter.length > 0) filter = encodeURIComponent(filter);
|
||||||
if (is.null(limit) || is.undefined(limit)) limit = 100;
|
if (_.isNull(limit) || _.isUndefined(limit)) limit = 100;
|
||||||
|
|
||||||
return this.get('ajax').request(`users?active=0&filter=${filter}&limit=${limit}`).then((response) => {
|
return this.get('ajax').request(`users?active=0&filter=${filter}&limit=${limit}`).then((response) => {
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
return response.map((obj) => {
|
return response.map((obj) => {
|
||||||
let data = this.get('store').normalize('user', obj);
|
let data = this.get('store').normalize('user', obj);
|
||||||
|
@ -91,7 +91,7 @@ export default Service.extend({
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('user', obj);
|
let data = this.get('store').normalize('user', obj);
|
||||||
|
@ -170,7 +170,7 @@ export default Service.extend({
|
||||||
|
|
||||||
// matchUsers on firstname, lastname, email
|
// matchUsers on firstname, lastname, email
|
||||||
matchUsers(text, limit) {
|
matchUsers(text, limit) {
|
||||||
if (is.null(limit) || is.undefined(limit)) limit = 100;
|
if (_.isNull(limit) || _.isUndefined(limit)) limit = 100;
|
||||||
|
|
||||||
return this.get('ajax').request(`users/match?limit=${limit}`, {
|
return this.get('ajax').request(`users/match?limit=${limit}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -179,7 +179,7 @@ export default Service.extend({
|
||||||
data: text
|
data: text
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
if (is.not.array(response)) response = [];
|
if (!_.isArray(response)) response = [];
|
||||||
|
|
||||||
data = response.map((obj) => {
|
data = response.map((obj) => {
|
||||||
let data = this.get('store').normalize('user', obj);
|
let data = this.get('store').normalize('user', obj);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
function getSubdomain() {
|
function getSubdomain() {
|
||||||
if (is.ipv4(window.location.host)) {
|
if (isIPv4(window.location.host)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ function getAppUrl(domain) {
|
||||||
|
|
||||||
let leftOvers = parts.join(".");
|
let leftOvers = parts.join(".");
|
||||||
|
|
||||||
if (is.empty(domain)) {
|
if (_.isEmpty(domain)) {
|
||||||
domain = "";
|
domain = "";
|
||||||
} else {
|
} else {
|
||||||
domain = domain + ".";
|
domain = domain + ".";
|
||||||
|
@ -82,10 +82,16 @@ function isInvalidLicenseError(reason) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isIPv4(ip) {
|
||||||
|
var re = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
||||||
|
return re.test(ip);
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getSubdomain,
|
getSubdomain,
|
||||||
getAppUrl,
|
getAppUrl,
|
||||||
isAjaxAccessError,
|
isAjaxAccessError,
|
||||||
isAjaxNotFoundError,
|
isAjaxNotFoundError,
|
||||||
isInvalidLicenseError,
|
isInvalidLicenseError,
|
||||||
|
isIPv4,
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,10 +40,16 @@ function anonUserId() {
|
||||||
return 'anon_' + makeId(11);
|
return 'anon_' + makeId(11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isEmail(email) {
|
||||||
|
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||||
|
return re.test(email);
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
makeSlug,
|
makeSlug,
|
||||||
makeId,
|
makeId,
|
||||||
endsWith,
|
endsWith,
|
||||||
anonUserId
|
anonUserId,
|
||||||
|
isEmail
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ function getState(toc, page) {
|
||||||
pageId: ''
|
pageId: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
if (is.undefined(page)) {
|
if (_.isUndefined(page)) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,8 +109,8 @@ function getState(toc, page) {
|
||||||
state.indentDisabled = !state.tocTools.allowIndent;
|
state.indentDisabled = !state.tocTools.allowIndent;
|
||||||
state.outdentDisabled = !state.tocTools.allowOutdent;
|
state.outdentDisabled = !state.tocTools.allowOutdent;
|
||||||
|
|
||||||
state.actionablePage = is.not.empty(state.tocTools.upTarget) ||
|
state.actionablePage = !_.isEmpty(state.tocTools.upTarget) ||
|
||||||
is.not.empty(state.tocTools.downTarget) ||
|
!_.isEmpty(state.tocTools.downTarget) ||
|
||||||
state.tocTools.allowIndent || state.tocTools.allowOutdent;
|
state.tocTools.allowIndent || state.tocTools.allowOutdent;
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
|
@ -122,20 +122,20 @@ function moveUp(state, pages, current) {
|
||||||
var page2 = null;
|
var page2 = null;
|
||||||
var pendingChanges = [];
|
var pendingChanges = [];
|
||||||
|
|
||||||
if (is.not.undefined(page1)) page1 = page1.get('page');
|
if (!_.isUndefined(page1)) page1 = page1.get('page');
|
||||||
|
|
||||||
if (is.undefined(current) || is.undefined(page1)) {
|
if (_.isUndefined(current) || _.isUndefined(page1)) {
|
||||||
return pendingChanges;
|
return pendingChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
var index1 = _.findIndex(pages, function(i) { return i.get('page.id') === page1.get('id'); });
|
var index1 = _.findIndex(pages, function(i) { return i.get('page.id') === page1.get('id'); });
|
||||||
|
|
||||||
if (index1 !== -1) {
|
if (index1 !== -1) {
|
||||||
if (is.not.undefined(pages[index1 - 1])) page2 = pages[index1 - 1].get('page');
|
if (!_.isUndefined(pages[index1 - 1])) page2 = pages[index1 - 1].get('page');
|
||||||
}
|
}
|
||||||
|
|
||||||
var sequence1 = page1.get('sequence');
|
var sequence1 = page1.get('sequence');
|
||||||
var sequence2 = is.not.null(page2) && is.not.undefined(page2) ? page2.get('sequence') : 0;
|
var sequence2 = !_.isNull(page2) && !_.isUndefined(page2) ? page2.get('sequence') : 0;
|
||||||
var index = _.findIndex(pages, function(i) { return i.get('page.id') === current.get('id'); });
|
var index = _.findIndex(pages, function(i) { return i.get('page.id') === current.get('id'); });
|
||||||
|
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
|
@ -167,7 +167,7 @@ function moveUp(state, pages, current) {
|
||||||
function moveDown(state, pages, current) {
|
function moveDown(state, pages, current) {
|
||||||
var pageIndex = _.findIndex(pages, function(i) { return i.get('page.id') === current.get('id'); });
|
var pageIndex = _.findIndex(pages, function(i) { return i.get('page.id') === current.get('id'); });
|
||||||
var downTarget = _.find(pages, function(i) { return i.get('page.id') === state.tocTools.downTarget; });
|
var downTarget = _.find(pages, function(i) { return i.get('page.id') === state.tocTools.downTarget; });
|
||||||
if (is.not.undefined(downTarget)) downTarget = downTarget.get('page');
|
if (!_.isUndefined(downTarget)) downTarget = downTarget.get('page');
|
||||||
|
|
||||||
var downTargetIndex = _.findIndex(pages, function(i) { return i.get('page.id') === downTarget.get('id'); });
|
var downTargetIndex = _.findIndex(pages, function(i) { return i.get('page.id') === downTarget.get('id'); });
|
||||||
var pendingChanges = [];
|
var pendingChanges = [];
|
||||||
|
@ -188,9 +188,9 @@ function moveDown(state, pages, current) {
|
||||||
var belowThisGuyIndex = _.findIndex(pages, function(i) { return i.get('page.id') === aboveThisGuy.get('id'); })
|
var belowThisGuyIndex = _.findIndex(pages, function(i) { return i.get('page.id') === aboveThisGuy.get('id'); })
|
||||||
var belowThisGuy = pages[belowThisGuyIndex - 1];
|
var belowThisGuy = pages[belowThisGuyIndex - 1];
|
||||||
|
|
||||||
if (is.not.null(belowThisGuy)) belowThisGuy = belowThisGuy.get('page');
|
if (!_.isNull(belowThisGuy)) belowThisGuy = belowThisGuy.get('page');
|
||||||
|
|
||||||
if (is.not.null(belowThisGuy) && belowThisGuy.get('level') > current.get('level')) {
|
if (!_.isNull(belowThisGuy) && belowThisGuy.get('level') > current.get('level')) {
|
||||||
startingSequence = (aboveThisGuy.get('sequence') + belowThisGuy.get('sequence')) / 2;
|
startingSequence = (aboveThisGuy.get('sequence') + belowThisGuy.get('sequence')) / 2;
|
||||||
upperSequence = aboveThisGuy.get('sequence');
|
upperSequence = aboveThisGuy.get('sequence');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const browsers = [
|
const browsers = [
|
||||||
'last 1 Chrome versions',
|
'last 2 Edge versions',
|
||||||
'last 1 Firefox versions',
|
'last 1 Chrome versions',
|
||||||
'last 1 Safari versions'
|
'last 1 Firefox versions',
|
||||||
|
'last 1 Safari versions'
|
||||||
];
|
];
|
||||||
|
|
||||||
const isCI = !!process.env.CI;
|
// const isCI = !!process.env.CI;
|
||||||
const isProduction = process.env.EMBER_ENV === 'production';
|
// const isProduction = process.env.EMBER_ENV === 'production';
|
||||||
|
|
||||||
if (isCI || isProduction) {
|
// if (isCI || isProduction) {
|
||||||
browsers.push('ie 11');
|
// browsers.push('ie 11');
|
||||||
}
|
// }
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
browsers
|
browsers
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,10 +2,15 @@
|
||||||
|
|
||||||
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
||||||
var isDevelopment = EmberApp.env() === 'development';
|
var isDevelopment = EmberApp.env() === 'development';
|
||||||
|
var nodeSass = require('node-sass');
|
||||||
// var isTest = EmberApp.env() === 'test';
|
// var isTest = EmberApp.env() === 'test';
|
||||||
|
|
||||||
module.exports = function (defaults) {
|
module.exports = function (defaults) {
|
||||||
var app = new EmberApp(defaults, {
|
var app = new EmberApp(defaults, {
|
||||||
|
sassOptions: {
|
||||||
|
implementation: nodeSass
|
||||||
|
},
|
||||||
|
|
||||||
fingerprint: {
|
fingerprint: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
generateAssetMap: true,
|
generateAssetMap: true,
|
||||||
|
@ -59,6 +64,7 @@ module.exports = function (defaults) {
|
||||||
app.import('vendor/is.js');
|
app.import('vendor/is.js');
|
||||||
app.import('vendor/iziToast.js');
|
app.import('vendor/iziToast.js');
|
||||||
app.import('vendor/keycloak.js');
|
app.import('vendor/keycloak.js');
|
||||||
|
app.import('vendor/lodash.js');
|
||||||
app.import('vendor/markdown-it.min.js');
|
app.import('vendor/markdown-it.min.js');
|
||||||
app.import('vendor/md5.js');
|
app.import('vendor/md5.js');
|
||||||
app.import('vendor/moment.js');
|
app.import('vendor/moment.js');
|
||||||
|
@ -68,7 +74,6 @@ module.exports = function (defaults) {
|
||||||
app.import('vendor/slug.js');
|
app.import('vendor/slug.js');
|
||||||
app.import('vendor/sortable.js');
|
app.import('vendor/sortable.js');
|
||||||
app.import('vendor/table-editor.min.js');
|
app.import('vendor/table-editor.min.js');
|
||||||
app.import('vendor/underscore.js');
|
|
||||||
app.import('vendor/codemirror.js'); // core lib
|
app.import('vendor/codemirror.js'); // core lib
|
||||||
app.import('vendor/codemirror-boot.js'); // boot-up files
|
app.import('vendor/codemirror-boot.js'); // boot-up files
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
"@ember/jquery": "^0.6.0",
|
"@ember/jquery": "^0.6.0",
|
||||||
"@ember/optional-features": "^0.7.0",
|
"@ember/optional-features": "^0.7.0",
|
||||||
"broccoli-asset-rev": "^3.0.0",
|
"broccoli-asset-rev": "^3.0.0",
|
||||||
"ember-ajax": "^4.0.1",
|
"ember-ajax": "^3.1.0",
|
||||||
"ember-attacher": "^0.13.10",
|
"ember-attacher": "^0.13.10",
|
||||||
"ember-cli": "~3.8.0",
|
"ember-cli": "~3.8.0",
|
||||||
"ember-cli-app-version": "^3.2.0",
|
"ember-cli-app-version": "^3.2.0",
|
||||||
|
|
17107
gui/vendor/lodash.js
vendored
Normal file
17107
gui/vendor/lodash.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
1692
gui/vendor/underscore.js
vendored
1692
gui/vendor/underscore.js
vendored
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue