New component for use in header-bar

This commit is contained in:
Joel Louzado 2017-02-22 17:33:17 +05:30
parent cd70076af2
commit ac07646749
2 changed files with 16 additions and 6 deletions

View file

@ -170,7 +170,7 @@ template(name="boardChangeColorPopup")
if isSelected
i.fa.fa-check
template(name="createBoardPopup")
template(name="createBoard")
form
label
| {{_ 'title'}}

View file

@ -119,10 +119,15 @@ BlazeComponent.extendComponent({
},
}).register('boardChangeColorPopup');
BlazeComponent.extendComponent({
const CreateBoard = BlazeComponent.extendComponent({
template() {
return 'createBoard';
},
onCreated() {
this.visibilityMenuIsOpen = new ReactiveVar(false);
this.visibility = new ReactiveVar('private');
const boardId = '';
},
visibilityCheck() {
@ -143,15 +148,12 @@ BlazeComponent.extendComponent({
const title = this.find('.js-new-board-title').value;
const visibility = this.visibility.get();
const boardId = Boards.insert({
boardId = Boards.insert({
title,
permission: visibility,
});
Utils.goBoardId(boardId);
// Immediately star boards crated with the headerbar popup.
Meteor.user().toggleBoardStar(boardId);
},
events() {
@ -166,6 +168,14 @@ BlazeComponent.extendComponent({
},
}).register('createBoardPopup');
(class HeaderBarCreateBoard extends CreateBoard {
onSubmit(evt) {
super.onSubmit(evt);
// Immediately star boards crated with the headerbar popup.
Meteor.user().toggleBoardStar(boardId);
}
}).register('headerBarCreateBoardPopup')
BlazeComponent.extendComponent({
visibilityCheck() {
const currentBoard = Boards.findOne(Session.get('currentBoard'));