mirror of https://github.com/wekan/wekan
The Open Source kanban (built with Meteor). Keep variable/table/field names camelCase. For translations, only add Pull Request changes to wekan/i18n/en.i18n.json , other translations are done at https://transifex.com/wekan/wekan only.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.3 KiB
96 lines
2.3 KiB
var toggleBoardStar = function(boardId) {
|
|
var queryType = Meteor.user().hasStarred(boardId) ? '$pull' : '$addToSet';
|
|
var query = {};
|
|
query[queryType] = {
|
|
'profile.starredBoards': boardId
|
|
};
|
|
Meteor.users.update(Meteor.userId(), query);
|
|
};
|
|
|
|
Template.boards.events({
|
|
'click .js-star-board': function(evt) {
|
|
toggleBoardStar(this._id);
|
|
evt.preventDefault();
|
|
}
|
|
});
|
|
|
|
Template.headerBoard.events({
|
|
'click .js-star-board': function() {
|
|
toggleBoardStar(this._id);
|
|
},
|
|
'click .js-open-board-menu': Popup.open('boardMenu'),
|
|
'click #permission-level:not(.no-edit)': Popup.open('boardChangePermission'),
|
|
'click .js-filter-cards-indicator': function(evt) {
|
|
Session.set('currentWidget', 'filter');
|
|
evt.preventDefault();
|
|
},
|
|
'click .js-filter-card-clear': function(evt) {
|
|
Filter.reset();
|
|
evt.stopPropagation();
|
|
}
|
|
});
|
|
|
|
Template.boardMenuPopup.events({
|
|
'click .js-rename-board': Popup.open('boardChangeTitle'),
|
|
'click .js-change-board-color': Popup.open('boardChangeColor')
|
|
});
|
|
|
|
Template.createBoardPopup.events({
|
|
'submit #CreateBoardForm': function(evt, t) {
|
|
var title = t.$('#boardNewTitle');
|
|
|
|
// trim value title
|
|
if ($.trim(title.val())) {
|
|
// İnsert Board title
|
|
var boardId = Boards.insert({
|
|
title: title.val(),
|
|
permission: 'public'
|
|
});
|
|
|
|
// Go to Board _id
|
|
Utils.goBoardId(boardId);
|
|
}
|
|
evt.preventDefault();
|
|
}
|
|
});
|
|
|
|
Template.boardChangeTitlePopup.events({
|
|
'submit #ChangeBoardTitleForm': function(evt, t) {
|
|
var title = t.$('.js-board-name').val().trim();
|
|
if (title) {
|
|
Boards.update(this._id, {
|
|
$set: {
|
|
title: title
|
|
}
|
|
});
|
|
Popup.close();
|
|
}
|
|
evt.preventDefault();
|
|
}
|
|
});
|
|
|
|
Template.boardChangePermissionPopup.events({
|
|
'click .js-select': function(evt) {
|
|
var $this = $(evt.currentTarget);
|
|
var permission = $this.attr('name');
|
|
|
|
Boards.update(this._id, {
|
|
$set: {
|
|
permission: permission
|
|
}
|
|
});
|
|
Popup.close();
|
|
}
|
|
});
|
|
|
|
Template.boardChangeColorPopup.events({
|
|
'click .js-select-background': function(evt) {
|
|
var currentBoardId = Session.get('currentBoard');
|
|
Boards.update(currentBoardId, {
|
|
$set: {
|
|
color: this.toString()
|
|
}
|
|
});
|
|
evt.preventDefault();
|
|
}
|
|
});
|
|
|