Add UI code and make some fixes to list move code

Still need to add new lists to all swimlanes
This commit is contained in:
John R. Supplee 2021-03-27 00:56:44 +02:00
parent be9e98b2a1
commit aad300613d
6 changed files with 87 additions and 15 deletions

View file

@ -39,6 +39,8 @@ template(name="swimlaneActionPopup")
hr
ul.pop-over-list
li: a.js-close-swimlane {{_ 'archive-swimlane'}}
ul.pop-over-list
li: a.js-move-swimlane {{_ 'move-swimlane'}}
template(name="swimlaneAddPopup")
unless currentUser.isCommentOnly

View file

@ -47,20 +47,25 @@ Template.swimlaneFixedHeader.helpers({
},
});
Template.swimlaneActionPopup.events({
'click .js-set-swimlane-color': Popup.open('setSwimlaneColor'),
'click .js-close-swimlane'(event) {
event.preventDefault();
this.archive();
Popup.close();
},
});
Template.swimlaneActionPopup.helpers({
BlazeComponent.extendComponent({
isCommentOnly() {
return Meteor.user().isCommentOnly();
},
});
events() {
return [
{
'click .js-set-swimlane-color': Popup.open('setSwimlaneColor'),
'click .js-close-swimlane'(event) {
event.preventDefault();
this.archive();
Popup.close();
},
'click .js-move-swimlane': Popup.open('moveSwimlane'),
},
];
},
}).register('swimlaneActionPopup');
BlazeComponent.extendComponent({
onCreated() {

View file

@ -61,3 +61,13 @@ template(name="addListForm")
a.open-list-composer.js-open-inlined-form
i.fa.fa-plus
| {{_ 'add-list'}}
template(name="moveSwimlanePopup")
unless currentUser.isWorker
label {{_ 'boards'}}:
select.js-select-boards(autofocus)
each toBoard in toBoards
option(value="{{toBoard._id}}") {{toBoard.title}}
.edit-controls.clearfix
button.primary.confirm.js-done {{_ 'done'}}

View file

@ -323,3 +323,50 @@ BlazeComponent.extendComponent({
initSortable(boardComponent, $listsDom);
},
}).register('listsGroup');
BlazeComponent.extendComponent({
onCreated() {
this.currentSwimlane = this.currentData();
},
board() {
return Boards.findOne(Session.get('currentBoard'));
},
toBoards() {
const boards = Boards.find(
{
archived: false,
'members.userId': Meteor.userId(),
type: 'board',
_id: { $ne: this.board()._id },
},
{
sort: { title: 1 },
},
);
console.log('boards.count():', boards.count());
console.log('boards:', boards);
return boards;
},
events() {
return [
{
'click .js-done'() {
const swimlane = Swimlanes.findOne(this.currentSwimlane._id);
const bSelect = $('.js-select-boards')[0];
let boardId;
if (bSelect) {
boardId = bSelect.options[bSelect.selectedIndex].value;
swimlane.move(boardId);
this.board().getDefaultSwimline();
}
Popup.close();
},
},
];
},
}).register('moveSwimlanePopup');