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:
parent
92696c5181
commit
9e3eac19aa
12 changed files with 886 additions and 743 deletions
15
gui/app/pods/jumpto/controller.js
Normal file
15
gui/app/pods/jumpto/controller.js
Normal 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({
|
||||
});
|
37
gui/app/pods/jumpto/route.js
Normal file
37
gui/app/pods/jumpto/route.js
Normal 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;
|
||||
}
|
||||
});
|
0
gui/app/pods/jumpto/template.hbs
Normal file
0
gui/app/pods/jumpto/template.hbs
Normal 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',
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue