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

Allow doc/section/files links to open in tabs

Closes #233 and might help #236
This commit is contained in:
sauls8t 2019-04-10 20:03:34 +01:00
parent 92696c5181
commit 9e3eac19aa
12 changed files with 886 additions and 743 deletions

View file

@ -0,0 +1,15 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Controller from '@ember/controller';
export default Controller.extend({
});

View file

@ -0,0 +1,37 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import { inject as service } from '@ember/service';
import { Promise } from 'rsvp';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
import Route from '@ember/routing/route';
export default Route.extend(AuthenticatedRouteMixin, {
linkSvc: service('link'),
jumpToLink: '',
beforeModel: function () {
// let jumpType = this.paramsFor('jumpto').jump_type;
let jumpId = this.paramsFor('jumpto').jump_id;
return new Promise((resolve) => {
this.get('linkSvc').fetchLinkUrl(jumpId).then((link) => {
this.set('jumpToLink', link);
resolve();
});
});
},
model: function () {
let link = this.get('jumpToLink');
window.location.href = link;
}
});

View file

View file

@ -129,6 +129,10 @@ export default Router.map(function () {
path: 'secure/:token'
});
this.route('jumpto', {
path: 'link/:jump_type/:jump_id'
});
this.route(
'auth',
{

View file

@ -35,6 +35,16 @@ export default Service.extend(Notifier, {
});
},
// Returns link URL for specified link.
fetchLinkUrl(linkId) {
return this.get('ajax').request(`link/${linkId}`, {
method: 'GET',
dataType: 'text'
}).then((response) => {
return response;
});
},
// Returns keyword-based candidates
searchCandidates(keywords) {
let url = "links?keywords=" + encodeURIComponent(keywords);