diff options
Diffstat (limited to 'client')
22 files changed, 125 insertions, 106 deletions
diff --git a/client/components/boards/boardArchive.js b/client/components/boards/boardArchive.js index 35f795f3..6f62daaf 100644 --- a/client/components/boards/boardArchive.js +++ b/client/components/boards/boardArchive.js @@ -1,4 +1,4 @@ -Template.headerTitle.events({ +Template.boardHeaderBar.events({ 'click .js-open-archived-board'() { Modal.open('archivedBoards'); }, diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade index f264a6d9..eb7ca984 100644 --- a/client/components/boards/boardHeader.jade +++ b/client/components/boards/boardHeader.jade @@ -1,4 +1,4 @@ -template(name="headerBoard") +template(name="boardHeaderBar") h1.header-board-menu with currentBoard a(class="{{#if currentUser.isBoardAdmin}}js-edit-board-title{{else}}is-disabled{{/if}}") @@ -125,4 +125,4 @@ template(name="boardChangeTitlePopup") template(name="archiveBoardPopup") p {{_ 'close-board-pop'}} - button.js-confirm.negate.full(type="submit") {{_ 'close'}} + button.js-confirm.negate.full(type="submit") {{_ 'archive'}} diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index 34204a46..b5a31754 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -50,7 +50,7 @@ Template.boardChangeTitlePopup.events({ BlazeComponent.extendComponent({ template() { - return 'headerBoard'; + return 'boardHeaderBar'; }, isStarred() { @@ -94,7 +94,7 @@ BlazeComponent.extendComponent({ }, }]; }, -}).register('headerBoard'); +}).register('boardHeaderBar'); BlazeComponent.extendComponent({ template() { diff --git a/client/components/boards/boardsList.jade b/client/components/boards/boardsList.jade index 7099cdc9..c11bb2df 100644 --- a/client/components/boards/boardsList.jade +++ b/client/components/boards/boardsList.jade @@ -23,3 +23,12 @@ template(name="boardList") p.board-list-item-desc= description li.js-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'}} diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 9d2cbec7..5746c92c 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -94,7 +94,7 @@ template(name="moveCardPopup") template(name="cardMembersPopup") ul.pop-over-list.js-card-member-list - each board.members + each board.activeMembers li.item(class="{{#if isCardMember}}active{{/if}}") a.name.js-select-member(href="#") +userAvatar(userId=user._id) diff --git a/client/components/cards/minicard.styl b/client/components/cards/minicard.styl index 1c27efff..47d160f4 100644 --- a/client/components/cards/minicard.styl +++ b/client/components/cards/minicard.styl @@ -133,5 +133,6 @@ margin: 0 padding: 0 max-height: 162px - min-height: 54px + min-height: 36px + margin-bottom: 20px overflow-y: auto diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 36b60d06..c3a85614 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -57,6 +57,7 @@ BlazeComponent.extendComponent({ // We keep the form opened, empty it, and scroll to it. textarea.val('').focus(); + autosize.update(textarea); if (position === 'bottom') { this.scrollToBottom(); } @@ -180,13 +181,17 @@ BlazeComponent.extendComponent({ onRendered() { const editor = this; - this.$('textarea').escapeableTextComplete([ + const $textarea = this.$('textarea'); + + autosize($textarea); + + $textarea.escapeableTextComplete([ // User mentions { match: /\B@(\w*)$/, search(term, callback) { const currentBoard = Boards.findOne(Session.get('currentBoard')); - callback($.map(currentBoard.members, (member) => { + callback($.map(currentBoard.activeMembers(), (member) => { const user = Users.findOne(member.userId); return user.username.indexOf(term) === 0 ? user : null; })); diff --git a/client/components/lists/listHeader.jade b/client/components/lists/listHeader.jade index 72cd0fe9..750cf3a2 100644 --- a/client/components/lists/listHeader.jade +++ b/client/components/lists/listHeader.jade @@ -21,16 +21,11 @@ template(name="listActionPopup") li: a.js-add-card {{_ 'add-card'}} if cards.count li: a.js-select-cards {{_ 'list-select-cards'}} - li: a.js-move-cards {{_ 'list-move-cards'}} - li: a.js-archive-cards {{_ 'list-archive-cards'}} hr ul.pop-over-list li: a.js-import-card {{_ 'import-card'}} li: a.js-close-list {{_ 'archive-list'}} -template(name="listMoveCardsPopup") - +boardLists - template(name="boardLists") ul.pop-over-list each currentBoard.lists @@ -39,7 +34,3 @@ template(name="boardLists") a.disabled {{title}} ({{_ 'current'}}) else a.js-select-list= title - -template(name="listArchiveCardsPopup") - p {{_ 'list-archive-cards-pop'}} - input.js-confirm.negate.full(type="submit" value="{{_ 'archive-all'}}") diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js index d660508a..5b7c5713 100644 --- a/client/components/lists/listHeader.js +++ b/client/components/lists/listHeader.js @@ -34,28 +34,9 @@ Template.listActionPopup.events({ Popup.close(); }, 'click .js-import-card': Popup.open('listImportCard'), - 'click .js-move-cards': Popup.open('listMoveCards'), - 'click .js-archive-cards': Popup.afterConfirm('listArchiveCards', function() { - this.allCards().forEach((card) => { - card.archive(); - }); - Popup.close(); - }), - 'click .js-close-list'(evt) { evt.preventDefault(); this.archive(); Popup.close(); }, }); - -Template.listMoveCardsPopup.events({ - 'click .js-select-list'() { - const fromList = Template.parentData(2).data; - const toList = this._id; - fromList.allCards().forEach((card) => { - card.move(toList); - }); - Popup.close(); - }, -}); diff --git a/client/components/main/editor.js b/client/components/main/editor.js index 82fce641..a30a5e1d 100644 --- a/client/components/main/editor.js +++ b/client/components/main/editor.js @@ -28,7 +28,7 @@ Template.editor.onRendered(() => { match: /\B@(\w*)$/, search(term, callback) { const currentBoard = Boards.findOne(Session.get('currentBoard')); - callback(currentBoard.members.map((member) => { + callback(currentBoard.activeMembers().map((member) => { const username = Users.findOne(member.userId).username; return username.includes(term) ? username : null; })); diff --git a/client/components/main/header.jade b/client/components/main/header.jade index 86dfd6a7..0d178250 100644 --- a/client/components/main/header.jade +++ b/client/components/main/header.jade @@ -32,10 +32,7 @@ template(name="header") current page. This bar is contextual based. If the user is not connected we display "sign in" and "log in" buttons. #header-main-bar(class="{{#if wrappedHeader}}wrapper{{/if}}") - if $.Session.get 'currentBoard' - +headerBoard - else if($eq currentRouteName 'home') - +headerTitle + +Template.dynamic(template=headerBar) //- On sandstorm, the logo shouldn't be clickable, because we only have one @@ -47,11 +44,3 @@ template(name="header") else a.wekan-logo(href="{{pathFor 'home'}}" title="{{_ 'header-logo-title'}}") 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'}} diff --git a/client/components/main/header.js b/client/components/main/header.js index 30cb2d8f..d44fe76d 100644 --- a/client/components/main/header.js +++ b/client/components/main/header.js @@ -1,9 +1,4 @@ Template.header.helpers({ - // Reactively set the color of the page from the color of the current board. - headerTemplate() { - return 'headerBoard'; - }, - wrappedHeader() { return !Session.get('currentBoard'); }, diff --git a/client/components/main/header.styl b/client/components/main/header.styl index b66eb2da..6decf2df 100644 --- a/client/components/main/header.styl +++ b/client/components/main/header.styl @@ -85,6 +85,14 @@ float: left border-radius: 3px + a.fa, a i.fa + color: white + + .back-btn + font-size: 0.9em + margin-right: 10px + + .wekan-logo display: block margin: 3px auto 0 diff --git a/client/components/main/keyboardShortcuts.jade b/client/components/main/keyboardShortcuts.jade new file mode 100644 index 00000000..bde40819 --- /dev/null +++ b/client/components/main/keyboardShortcuts.jade @@ -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}} diff --git a/client/components/main/keyboardShortcuts.tpl.jade b/client/components/main/keyboardShortcuts.tpl.jade deleted file mode 100644 index 5b5dae8b..00000000 --- a/client/components/main/keyboardShortcuts.tpl.jade +++ /dev/null @@ -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}} diff --git a/client/components/main/layouts.jade b/client/components/main/layouts.jade index 65b53f04..88d178f5 100644 --- a/client/components/main/layouts.jade +++ b/client/components/main/layouts.jade @@ -31,6 +31,7 @@ template(name="defaultLayout") .modal-content a.modal-close-btn.js-close-modal i.fa.fa-times-thin + +Template.dynamic(template=Modal.getHeaderName) +Template.dynamic(template=Modal.getTemplateName) template(name="notFound") diff --git a/client/components/main/layouts.styl b/client/components/main/layouts.styl index fcc94251..0e50dd55 100644 --- a/client/components/main/layouts.styl +++ b/client/components/main/layouts.styl @@ -31,6 +31,9 @@ body .sk-spinner margin-top: 30vh + > .wrapper + margin-top: 25px + #modal position: absolute top: 0 diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index 5b58dbd9..ec3ebcf6 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -279,7 +279,7 @@ BlazeComponent.extendComponent({ 'click .js-select-member'() { const userId = this.currentData()._id; const currentBoard = Boards.findOne(Session.get('currentBoard')); - if (currentBoard.memberIndex(userId)<0) { + if (!currentBoard.hasMember(userId)) { this.inviteUser(userId); } }, @@ -305,16 +305,12 @@ Template.changePermissionsPopup.events({ Template.changePermissionsPopup.helpers({ isAdmin() { - const user = Users.findOne(this.userId); - return user.isBoardAdmin(); + const currentBoard = Boards.findOne(Session.get('currentBoard')); + return currentBoard.hasAdmin(this.userId); }, isLastAdmin() { - const user = Users.findOne(this.userId); - if (!user.isBoardAdmin()) - return false; const currentBoard = Boards.findOne(Session.get('currentBoard')); - const nbAdmins = _.where(currentBoard.members, { isAdmin: true }).length; - return nbAdmins === 1; + return currentBoard.hasAdmin(this.userId) && (currentBoard.activeAdmins() === 1); }, }); diff --git a/client/components/sidebar/sidebarFilters.jade b/client/components/sidebar/sidebarFilters.jade index ef26ef76..2b326493 100644 --- a/client/components/sidebar/sidebarFilters.jade +++ b/client/components/sidebar/sidebarFilters.jade @@ -18,17 +18,16 @@ template(name="filterSidebar") i.fa.fa-check hr ul.sidebar-list - each currentBoard.members - if isActive - with getUser userId - li(class="{{#if Filter.members.isSelected _id}}active{{/if}}") - a.name.js-toggle-member-filter - +userAvatar(userId=this._id) - span.sidebar-list-item-description - = profile.fullname - | (<span class="username">{{ username }}</span>) - if Filter.members.isSelected _id - i.fa.fa-check + each currentBoard.activeMembers + with getUser userId + li(class="{{#if Filter.members.isSelected _id}}active{{/if}}") + a.name.js-toggle-member-filter + +userAvatar(userId=this._id) + span.sidebar-list-item-description + = profile.fullname + | (<span class="username">{{ username }}</span>) + if Filter.members.isSelected _id + i.fa.fa-check if Filter.isActive hr a.sidebar-btn.js-clear-all @@ -55,20 +54,22 @@ template(name="multiselectionSidebar") i.fa.fa-ellipsis-h hr ul.sidebar-list - each currentBoard.members - if isActive - with getUser userId - li(class="{{#if Filter.members.isSelected _id}}active{{/if}}") - a.name.js-toggle-member-multiselection - +userAvatar(userId=this._id) - span.sidebar-list-item-description - = profile.fullname - | (<span class="username">{{ username }}</span>) - if allSelectedElementHave 'member' _id - i.fa.fa-check - else if someSelectedElementHave 'member' _id - i.fa.fa-ellipsis-h + each currentBoard.activeMembers + with getUser userId + li(class="{{#if Filter.members.isSelected _id}}active{{/if}}") + a.name.js-toggle-member-multiselection + +userAvatar(userId=this._id) + span.sidebar-list-item-description + = profile.fullname + | (<span class="username">{{ username }}</span>) + if allSelectedElementHave 'member' _id + i.fa.fa-check + else if someSelectedElementHave 'member' _id + i.fa.fa-ellipsis-h hr + a.sidebar-btn.js-move-selection + i.fa.fa-share + span {{_ 'move-selection'}} a.sidebar-btn.js-archive-selection i.fa.fa-archive span {{_ 'archive-selection'}} @@ -82,3 +83,7 @@ template(name="disambiguateMultiMemberPopup") p {{_ 'what-to-do'}} button.wide.js-unassign-member {{_ 'unassign-member'}} button.wide.js-assign-member {{_ 'assign-member'}} + +template(name="moveSelectionPopup") + +boardLists + diff --git a/client/components/sidebar/sidebarFilters.js b/client/components/sidebar/sidebarFilters.js index bdecd63e..ba4e4df9 100644 --- a/client/components/sidebar/sidebarFilters.js +++ b/client/components/sidebar/sidebarFilters.js @@ -93,8 +93,10 @@ BlazeComponent.extendComponent({ return popup.call(this.currentData(), evt); } }, + 'click .js-move-selection': Popup.open('moveSelection'), 'click .js-archive-selection'() { mutateSelectedCards('archive'); + EscapeActions.executeUpTo('multiselection'); }, }]; }, @@ -121,3 +123,10 @@ Template.disambiguateMultiMemberPopup.events({ Popup.close(); }, }); + +Template.moveSelectionPopup.events({ + 'click .js-select-list'() { + mutateSelectedCards('move', this._id); + EscapeActions.executeUpTo('multiselection'); + }, +}); diff --git a/client/config/router.js b/client/config/router.js index 0a6958d0..ddd69db4 100644 --- a/client/config/router.js +++ b/client/config/router.js @@ -13,7 +13,10 @@ FlowRouter.route('/', { Filter.reset(); 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'); } - 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('currentCard', params.cardId); - BlazeLayout.render('defaultLayout', { content: 'board' }); + BlazeLayout.render('defaultLayout', { + headerBar: 'boardHeaderBar', + content: 'board', + }); }, }); @@ -58,11 +67,14 @@ FlowRouter.route('/shortcuts', { if (previousPath) { Modal.open(shortcutsTemplate, { + header: 'shortcutsModalTitle', onCloseGoTo: previousPath, }); } else { - // XXX There is currently no way to escape this page on Sandstorm - BlazeLayout.render('defaultLayout', { content: shortcutsTemplate }); + BlazeLayout.render('defaultLayout', { + headerBar: 'shortcutsHeaderBar', + content: shortcutsTemplate, + }); } }, }); diff --git a/client/lib/modal.js b/client/lib/modal.js index e6301cb5..1ca8804b 100644 --- a/client/lib/modal.js +++ b/client/lib/modal.js @@ -6,8 +6,14 @@ window.Modal = new class { this._onCloseGoTo = ''; } + getHeaderName() { + const currentModal = this._currentModal.get(); + return currentModal && currentModal.header; + } + getTemplateName() { - return this._currentModal.get(); + const currentModal = this._currentModal.get(); + return currentModal && currentModal.modalName; } isOpen() { @@ -21,8 +27,8 @@ window.Modal = new class { } } - open(modalName, { onCloseGoTo = ''} = {}) { - this._currentModal.set(modalName); + open(modalName, { header = '', onCloseGoTo = ''} = {}) { + this._currentModal.set({ header, modalName }); this._onCloseGoTo = onCloseGoTo; } }; |