{{tablename}}
diff --git a/client/views/helpers/chunks/instance_div/instance_div.js b/client/views/helpers/chunks/instance_div/instance_div.js index eae1499d..e257bb50 100644 --- a/client/views/helpers/chunks/instance_div/instance_div.js +++ b/client/views/helpers/chunks/instance_div/instance_div.js @@ -11,4 +11,7 @@ Template.instance_div.helpers({ date_format(lasttouch) { return moment(lasttouch).format('LLL'); }, + absolute_url() { + return Meteor.absoluteUrl(); + }, }); diff --git a/client/views/helpers/form_error/form_error.html b/client/views/helpers/form_error/form_error.html index 5c17c5c5..e82b23c3 100644 --- a/client/views/helpers/form_error/form_error.html +++ b/client/views/helpers/form_error/form_error.html @@ -1,7 +1,7 @@Click here to return home.
- \ No newline at end of file +Click here to return home.
+ diff --git a/client/views/rename/rename.js b/client/views/rename/rename.js index 916ec7fd..d66f7be0 100644 --- a/client/views/rename/rename.js +++ b/client/views/rename/rename.js @@ -33,7 +33,7 @@ Template.rename.events({ } else if (result) { const isList = template.data.isList; if (isList) { - window.location.href = '/list/' + Instances.findOne({ _id: table._id }).slug; + window.location.href = Meteor.absoluteUrl() + 'list/' + Instances.findOne({ _id: table._id }).slug; } else { Blaze.remove(popoverTemplate); } diff --git a/client/views/resetPassword/resetPassword.js b/client/views/resetPassword/resetPassword.js index c7aa2bd2..5aa846e5 100644 --- a/client/views/resetPassword/resetPassword.js +++ b/client/views/resetPassword/resetPassword.js @@ -29,7 +29,7 @@ Template.ResetPassword.events({ showError('Something went wrong', 'inputcontainer', 'resetPassword'); } else { console.log('Password has been changed'); - window.location.href = '/'; + window.location.href = Meteor.absoluteUrl(); } }); } diff --git a/client/views/share/share.js b/client/views/share/share.js index 466b3567..3a1ab938 100644 --- a/client/views/share/share.js +++ b/client/views/share/share.js @@ -5,7 +5,7 @@ Template.share.onRendered(() => { Template.share.helpers({ shareLink() { - return window.location.origin + '/list/' + Template.instance().data; + return Meteor.absoluteUrl() + 'list/' + Template.instance().data; }, }); diff --git a/lib/routes.js b/lib/routes.js index 71a9e97c..c883716a 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -1,13 +1,15 @@ /* eslint-disable func-names */ import { Instances, Questions, Answers } from './common.js'; +const urlPathPrefix = Meteor.settings.public.urlPathPrefix || '' + Router.configure({ notFoundTemplate: 'not_found', loadingTemplate: 'loading', }); Router.route('home', { - path: '/', + path: '/' + urlPathPrefix, template: 'home', data() { return Instances.find({ hidden: { $ne: true } }).fetch(); @@ -15,15 +17,15 @@ Router.route('home', { fastRender: true, }); -Router.route('/credits', function () { +Router.route(urlPathPrefix + '/credits', function () { this.render('credits'); }); -Router.route('/dashboard', function () { +Router.route(urlPathPrefix + '/dashboard', function () { this.render('dashboard'); }); -Router.route('/create', function () { +Router.route(urlPathPrefix + '/create', function () { if (Meteor.user()) { this.render('create'); } else { @@ -33,33 +35,33 @@ Router.route('/create', function () { } }); -Router.route('/admin', function () { +Router.route(urlPathPrefix + '/admin', function () { this.render('admin'); }); -Router.route('/propose', function () { +Router.route(urlPathPrefix + '/propose', function () { this.render('propose'); }); -Router.route('/report', function () { +Router.route(urlPathPrefix + '/report', function () { this.render('report'); }); -Router.route('/login', function () { +Router.route(urlPathPrefix + '/login', function () { this.render('login'); }); -Router.route('/delete', function () { +Router.route(urlPathPrefix + '/delete', function () { this.render('delete'); }); -Router.route('/add', function () { +Router.route(urlPathPrefix + '/add', function () { this.render('add'); }); // When the user visits /answer/id, display answer template with question data Router.route('answer', { - path: '/answer/:_id', + path: urlPathPrefix + '/answer/:_id', template: 'answer', data() { const question = Questions.findOne({ _id: this.params._id }); @@ -69,7 +71,7 @@ Router.route('answer', { // When the user visits /modify/id, display modify template with question data Router.route('modify', { - path: '/modify/:_id', + path: urlPathPrefix + '/modify/:_id', template: 'modify', data() { const question = Questions.findOne({ _id: this.params._id }); @@ -79,7 +81,7 @@ Router.route('modify', { // When the user visits //id1/id2, display template with data for both questions 1 and 2 Router.route('', { - path: '//:first/:second', + path: urlPathPrefix + '//:first/:second', template: '', data() { const questionData = { @@ -92,7 +94,7 @@ Router.route('', { // When the user visits /list/tablename, set cookie to tablename and display list Router.route('listlink', { - path: '/list/:slug', + path: urlPathPrefix + '/list/:slug', waitOn() { return [ Meteor.subscribe('questions', this.params.slug), @@ -116,7 +118,7 @@ Router.route('listlink', { }, }); -Router.route('/list/:slug/touch', +Router.route(urlPathPrefix + '/list/:slug/touch', { onBeforeAction() { const instanceId = Instances.findOne({ slug: this.params.slug })._id; @@ -140,7 +142,7 @@ Router.route('/list/:slug/touch', // When the user visits /rename/id, display rename template with instance data Router.route('rename', { - path: '/rename/:_id', + path: urlPathPrefix + '/rename/:_id', template: 'rename', data() { const instance = Instances.findOne({ _id: this.params._id }); @@ -149,7 +151,7 @@ Router.route('rename', { }); // When the user visits rss/tablename, create an RSS file using table data -Router.route('/rss/:tablename', { +Router.route(urlPathPrefix + '/rss/:tablename', { where: 'server', action() { // Retrieves table and question data for the tablename parameter @@ -203,6 +205,6 @@ Router.route('/rss/:tablename', { }); // When the user visits the reset password -Router.route('/reset-password/:token', function() { +Router.route(urlPathPrefix + '/reset-password/:token', function() { this.render('ResetPassword') });