mirror of
https://github.com/wekan/wekan.git
synced 2025-04-24 05:57:13 -04:00
Allow the header bar customization
This commit also provide a way to escape the Shorcuts page on Sandstorm.
This commit is contained in:
parent
3b2eb0ffa1
commit
71b9a42f00
12 changed files with 98 additions and 50 deletions
|
@ -1,4 +1,4 @@
|
||||||
Template.headerTitle.events({
|
Template.boardHeaderBar.events({
|
||||||
'click .js-open-archived-board'() {
|
'click .js-open-archived-board'() {
|
||||||
Modal.open('archivedBoards');
|
Modal.open('archivedBoards');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
template(name="headerBoard")
|
template(name="boardHeaderBar")
|
||||||
h1.header-board-menu
|
h1.header-board-menu
|
||||||
with currentBoard
|
with currentBoard
|
||||||
a(class="{{#if currentUser.isBoardAdmin}}js-edit-board-title{{else}}is-disabled{{/if}}")
|
a(class="{{#if currentUser.isBoardAdmin}}js-edit-board-title{{else}}is-disabled{{/if}}")
|
||||||
|
|
|
@ -23,3 +23,12 @@ template(name="boardList")
|
||||||
p.board-list-item-desc= description
|
p.board-list-item-desc= description
|
||||||
li.js-add-board
|
li.js-add-board
|
||||||
a.board-list-item.label {{_ 'add-board'}}
|
a.board-list-item.label {{_ 'add-board'}}
|
||||||
|
|
||||||
|
|
||||||
|
template(name="boardListHeaderBar")
|
||||||
|
h1 {{_ 'my-boards'}}
|
||||||
|
|
||||||
|
.board-header-btns.right
|
||||||
|
a.board-header-btn.js-open-archived-board
|
||||||
|
i.fa.fa-archive
|
||||||
|
span {{_ 'archives'}}
|
||||||
|
|
|
@ -32,10 +32,7 @@ template(name="header")
|
||||||
current page. This bar is contextual based.
|
current page. This bar is contextual based.
|
||||||
If the user is not connected we display "sign in" and "log in" buttons.
|
If the user is not connected we display "sign in" and "log in" buttons.
|
||||||
#header-main-bar(class="{{#if wrappedHeader}}wrapper{{/if}}")
|
#header-main-bar(class="{{#if wrappedHeader}}wrapper{{/if}}")
|
||||||
if $.Session.get 'currentBoard'
|
+Template.dynamic(template=headerBar)
|
||||||
+headerBoard
|
|
||||||
else if($eq currentRouteName 'home')
|
|
||||||
+headerTitle
|
|
||||||
|
|
||||||
//-
|
//-
|
||||||
On sandstorm, the logo shouldn't be clickable, because we only have one
|
On sandstorm, the logo shouldn't be clickable, because we only have one
|
||||||
|
@ -47,11 +44,3 @@ template(name="header")
|
||||||
else
|
else
|
||||||
a.wekan-logo(href="{{pathFor 'home'}}" title="{{_ 'header-logo-title'}}")
|
a.wekan-logo(href="{{pathFor 'home'}}" title="{{_ 'header-logo-title'}}")
|
||||||
img(src="{{pathFor '/wekan-logo-header.png'}}" alt="Wekan")
|
img(src="{{pathFor '/wekan-logo-header.png'}}" alt="Wekan")
|
||||||
|
|
||||||
template(name="headerTitle")
|
|
||||||
h1 {{_ 'my-boards'}}
|
|
||||||
|
|
||||||
.board-header-btns.right
|
|
||||||
a.board-header-btn.js-open-archived-board
|
|
||||||
i.fa.fa-archive
|
|
||||||
span {{_ 'archives'}}
|
|
||||||
|
|
|
@ -85,6 +85,14 @@
|
||||||
float: left
|
float: left
|
||||||
border-radius: 3px
|
border-radius: 3px
|
||||||
|
|
||||||
|
a.fa, a i.fa
|
||||||
|
color: white
|
||||||
|
|
||||||
|
.back-btn
|
||||||
|
font-size: 0.9em
|
||||||
|
margin-right: 10px
|
||||||
|
|
||||||
|
|
||||||
.wekan-logo
|
.wekan-logo
|
||||||
display: block
|
display: block
|
||||||
margin: 3px auto 0
|
margin: 3px auto 0
|
||||||
|
|
19
client/components/main/keyboardShortcuts.jade
Normal file
19
client/components/main/keyboardShortcuts.jade
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
template(name="shortcutsHeaderBar")
|
||||||
|
h1
|
||||||
|
a.back-btn(href="{{pathFor 'home'}}")
|
||||||
|
i.fa.fa-chevron-left
|
||||||
|
| {{_ 'keyboard-shortcuts'}}
|
||||||
|
|
||||||
|
template(name="shortcutsModalTitle")
|
||||||
|
h2
|
||||||
|
i.fa.fa-keyboard-o
|
||||||
|
| {{_ 'keyboard-shortcuts'}}
|
||||||
|
|
||||||
|
template(name="keyboardShortcuts")
|
||||||
|
.wrapper.shortcuts-list
|
||||||
|
each mapping
|
||||||
|
.shortcuts-list-item
|
||||||
|
.shortcuts-list-item-keys
|
||||||
|
each keys
|
||||||
|
kbd= this
|
||||||
|
.shortcuts-list-item-action {{_ action}}
|
|
@ -1,11 +0,0 @@
|
||||||
.wrapper.shortcuts-list
|
|
||||||
h2
|
|
||||||
i.fa.fa-keyboard-o
|
|
||||||
| {{_ 'keyboard-shortcuts'}}
|
|
||||||
|
|
||||||
each mapping
|
|
||||||
.shortcuts-list-item
|
|
||||||
.shortcuts-list-item-keys
|
|
||||||
each keys
|
|
||||||
kbd= this
|
|
||||||
.shortcuts-list-item-action {{_ action}}
|
|
|
@ -31,6 +31,7 @@ template(name="defaultLayout")
|
||||||
.modal-content
|
.modal-content
|
||||||
a.modal-close-btn.js-close-modal
|
a.modal-close-btn.js-close-modal
|
||||||
i.fa.fa-times-thin
|
i.fa.fa-times-thin
|
||||||
|
+Template.dynamic(template=Modal.getHeaderName)
|
||||||
+Template.dynamic(template=Modal.getTemplateName)
|
+Template.dynamic(template=Modal.getTemplateName)
|
||||||
|
|
||||||
template(name="notFound")
|
template(name="notFound")
|
||||||
|
|
|
@ -31,6 +31,9 @@ body
|
||||||
.sk-spinner
|
.sk-spinner
|
||||||
margin-top: 30vh
|
margin-top: 30vh
|
||||||
|
|
||||||
|
> .wrapper
|
||||||
|
margin-top: 25px
|
||||||
|
|
||||||
#modal
|
#modal
|
||||||
position: absolute
|
position: absolute
|
||||||
top: 0
|
top: 0
|
||||||
|
|
|
@ -13,7 +13,10 @@ FlowRouter.route('/', {
|
||||||
Filter.reset();
|
Filter.reset();
|
||||||
EscapeActions.executeAll();
|
EscapeActions.executeAll();
|
||||||
|
|
||||||
BlazeLayout.render('defaultLayout', { content: 'boardList' });
|
BlazeLayout.render('defaultLayout', {
|
||||||
|
headerBar: 'boardListHeaderBar',
|
||||||
|
content: 'boardList',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,7 +36,10 @@ FlowRouter.route('/b/:id/:slug', {
|
||||||
EscapeActions.executeUpTo('popup-close');
|
EscapeActions.executeUpTo('popup-close');
|
||||||
}
|
}
|
||||||
|
|
||||||
BlazeLayout.render('defaultLayout', { content: 'board' });
|
BlazeLayout.render('defaultLayout', {
|
||||||
|
headerBar: 'boardHeaderBar',
|
||||||
|
content: 'board',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -45,7 +51,10 @@ FlowRouter.route('/b/:boardId/:slug/:cardId', {
|
||||||
Session.set('currentBoard', params.boardId);
|
Session.set('currentBoard', params.boardId);
|
||||||
Session.set('currentCard', params.cardId);
|
Session.set('currentCard', params.cardId);
|
||||||
|
|
||||||
BlazeLayout.render('defaultLayout', { content: 'board' });
|
BlazeLayout.render('defaultLayout', {
|
||||||
|
headerBar: 'boardHeaderBar',
|
||||||
|
content: 'board',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,11 +67,14 @@ FlowRouter.route('/shortcuts', {
|
||||||
|
|
||||||
if (previousPath) {
|
if (previousPath) {
|
||||||
Modal.open(shortcutsTemplate, {
|
Modal.open(shortcutsTemplate, {
|
||||||
|
header: 'shortcutsModalTitle',
|
||||||
onCloseGoTo: previousPath,
|
onCloseGoTo: previousPath,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// XXX There is currently no way to escape this page on Sandstorm
|
BlazeLayout.render('defaultLayout', {
|
||||||
BlazeLayout.render('defaultLayout', { content: shortcutsTemplate });
|
headerBar: 'shortcutsHeaderBar',
|
||||||
|
content: shortcutsTemplate,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,8 +6,14 @@ window.Modal = new class {
|
||||||
this._onCloseGoTo = '';
|
this._onCloseGoTo = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getHeaderName() {
|
||||||
|
const currentModal = this._currentModal.get();
|
||||||
|
return currentModal && currentModal.header;
|
||||||
|
}
|
||||||
|
|
||||||
getTemplateName() {
|
getTemplateName() {
|
||||||
return this._currentModal.get();
|
const currentModal = this._currentModal.get();
|
||||||
|
return currentModal && currentModal.modalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
isOpen() {
|
isOpen() {
|
||||||
|
@ -21,8 +27,8 @@ window.Modal = new class {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open(modalName, { onCloseGoTo = ''} = {}) {
|
open(modalName, { header = '', onCloseGoTo = ''} = {}) {
|
||||||
this._currentModal.set(modalName);
|
this._currentModal.set({ header, modalName });
|
||||||
this._onCloseGoTo = onCloseGoTo;
|
this._onCloseGoTo = onCloseGoTo;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
46
sandstorm.js
46
sandstorm.js
|
@ -3,24 +3,24 @@
|
||||||
const isSandstorm = Meteor.settings && Meteor.settings.public &&
|
const isSandstorm = Meteor.settings && Meteor.settings.public &&
|
||||||
Meteor.settings.public.sandstorm;
|
Meteor.settings.public.sandstorm;
|
||||||
|
|
||||||
|
// 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) {
|
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',
|
|
||||||
};
|
|
||||||
|
|
||||||
function updateUserPermissions(userId, permissions) {
|
function updateUserPermissions(userId, permissions) {
|
||||||
const isActive = permissions.indexOf('participate') > -1;
|
const isActive = permissions.indexOf('participate') > -1;
|
||||||
const isAdmin = permissions.indexOf('configure') > -1;
|
const isAdmin = permissions.indexOf('configure') > -1;
|
||||||
|
@ -142,6 +142,18 @@ if (isSandstorm && Meteor.isClient) {
|
||||||
updateSandstormMetaData({ setTitle: DocHead.getTitle() });
|
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
|
// XXX Hack. `Meteor.absoluteUrl` doesn't work in Sandstorm, since every
|
||||||
// session has a different URL whereas Meteor computes absoluteUrl based on
|
// session has a different URL whereas Meteor computes absoluteUrl based on
|
||||||
// the ROOT_URL environment variable. So we overwrite this function on a
|
// the ROOT_URL environment variable. So we overwrite this function on a
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue