From 71b9a42f00d8871bb09944ec80979c61ad84e655 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Tue, 8 Dec 2015 16:05:59 -0500 Subject: Allow the header bar customization This commit also provide a way to escape the Shorcuts page on Sandstorm. --- sandstorm.js | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'sandstorm.js') diff --git a/sandstorm.js b/sandstorm.js index a711a960..5148095f 100644 --- a/sandstorm.js +++ b/sandstorm.js @@ -3,24 +3,24 @@ const isSandstorm = Meteor.settings && Meteor.settings.public && Meteor.settings.public.sandstorm; -if (isSandstorm && Meteor.isServer) { - // In sandstorm we only have one board per sandstorm instance. Since we want - // to keep most of our code unchanged, we simply hard-code a board `_id` and - // redirect the user to this particular board. - const sandstormBoard = { - _id: 'sandstorm', - - // XXX Should be shared with the grain instance name. - title: 'Wekan', - slug: 'libreboard', - members: [], - - // Board access security is handled by sandstorm, so in our point of view we - // can alway assume that the board is public (unauthorized users won't be - // able to access it anyway). - permission: 'public', - }; +// In sandstorm we only have one board per sandstorm instance. Since we want to +// keep most of our code unchanged, we simply hard-code a board `_id` and +// redirect the user to this particular board. +const sandstormBoard = { + _id: 'sandstorm', + + // XXX Should be shared with the grain instance name. + title: 'Wekan', + slug: 'libreboard', + members: [], + + // Board access security is handled by sandstorm, so in our point of view we + // can alway assume that the board is public (unauthorized users won't be able + // to access it anyway). + permission: 'public', +}; +if (isSandstorm && Meteor.isServer) { function updateUserPermissions(userId, permissions) { const isActive = permissions.indexOf('participate') > -1; const isAdmin = permissions.indexOf('configure') > -1; @@ -142,6 +142,18 @@ if (isSandstorm && Meteor.isClient) { updateSandstormMetaData({ setTitle: DocHead.getTitle() }); }); + // Runtime redirection from the home page to the unique board -- since the + // home page contains a list of a single board it's not worth to display. + // + // XXX Hack. The home route is already defined at this point so we need to + // add the redirection trigger to the internal route object. + FlowRouter._routesMap.home._triggersEnter.push((context, redirect) => { + redirect(FlowRouter.path('board', { + id: sandstormBoard._id, + slug: sandstormBoard.slug, + })); + }); + // XXX Hack. `Meteor.absoluteUrl` doesn't work in Sandstorm, since every // session has a different URL whereas Meteor computes absoluteUrl based on // the ROOT_URL environment variable. So we overwrite this function on a -- cgit v1.2.3-1-g7c22