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

Allow content to contain links to network locations

This commit is contained in:
Harvey Kandola 2018-07-09 14:41:55 -04:00
parent 19736aab04
commit 4cfbd57871
13 changed files with 129 additions and 30 deletions

View file

@ -12,9 +12,10 @@
import { debounce } from '@ember/runloop';
import { computed, set } from '@ember/object';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import stringUtil from '../../utils/string';
import TooltipMixin from '../../mixins/tooltip';
import ModalMixin from '../../mixins/modal';
import Component from '@ember/component';
export default Component.extend(ModalMixin, TooltipMixin, {
link: service(),
@ -26,6 +27,8 @@ export default Component.extend(ModalMixin, TooltipMixin, {
showSections: computed('tab1Selected', function() { return this.get('tab1Selected'); }),
showAttachments: computed('tab2Selected', function() { return this.get('tab2Selected'); }),
showSearch: computed('tab3Selected', function() { return this.get('tab3Selected'); }),
showNetwork: computed('tab4Selected', function() { return this.get('tab4Selected'); }),
networkLocation: '',
keywords: '',
hasMatches: computed('matches', function () {
let m = this.get('matches');
@ -66,6 +69,8 @@ export default Component.extend(ModalMixin, TooltipMixin, {
didRender() {
this._super(...arguments);
this.$('#content-linker-networklocation').removeClass('is-invalid');
this.renderTooltips();
},
@ -114,7 +119,25 @@ export default Component.extend(ModalMixin, TooltipMixin, {
onInsertLink() {
let selection = this.get('selection');
if (this.get('tab4Selected')) {
let loc = this.get('networkLocation').trim();
let folderId = this.get('folder.id');
let documentId = this.get('document.id');
selection = {
context: '',
documentId: documentId,
folderId: folderId,
id: stringUtil.makeId(16),
linkType: 'network',
targetId: '',
externalId: loc,
title: loc
}
}
if (is.null(selection)) {
if (this.get('tab4Selected')) this.$('#content-linker-networklocation').addClass('is-invalid').focus();
return;
}
@ -125,6 +148,7 @@ export default Component.extend(ModalMixin, TooltipMixin, {
this.set('tab1Selected', id === 1);
this.set('tab2Selected', id === 2);
this.set('tab3Selected', id === 3);
this.set('tab4Selected', id === 4);
}
}
});

View file

@ -17,6 +17,10 @@ export default Component.extend({
classNames: ['layout-footer', 'non-printable'],
tagName: 'footer',
appMeta: service(),
showWait: false,
showDone: false,
showMessage: false,
message: '',
init() {
this._super(...arguments);
@ -40,5 +44,17 @@ export default Component.extend({
$('.progress-done').removeClass('zoomIn').addClass('zoomOut');
}, 3000);
}
if (msg !== 'done' && msg !== 'wait') {
$('.progress-notification').removeClass('zoomOut').addClass('zoomIn');
this.set('showWait', false);
this.set('showDone', false);
this.set('showMessage', true);
this.set('message', msg);
setTimeout(function() {
$('.progress-notification').removeClass('zoomIn').addClass('zoomOut');
}, 3000);
}
}
});