mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Work on the card activities and comments
This commit also introduces a new CSSEvents object that is used to abstract vendor specifics events related to CSS transitions and animations. Fixes #183. Fixes #179.
This commit is contained in:
parent
216887490e
commit
c894567987
31 changed files with 590 additions and 691 deletions
|
|
@ -0,0 +1,49 @@
|
|||
var commentFormIsOpen = new ReactiveVar(false);
|
||||
|
||||
Template.commentForm.helpers({
|
||||
commentFormIsOpen: function() {
|
||||
return commentFormIsOpen.get();
|
||||
}
|
||||
});
|
||||
|
||||
Template.commentForm.events({
|
||||
'click .js-new-comment:not(.focus)': function() {
|
||||
commentFormIsOpen.set(true);
|
||||
},
|
||||
'submit .js-new-comment-form': function(evt, tpl) {
|
||||
var input = tpl.$('.js-new-comment-input');
|
||||
if ($.trim(input.val())) {
|
||||
CardComments.insert({
|
||||
boardId: this.boardId,
|
||||
cardId: this._id,
|
||||
text: input.val()
|
||||
});
|
||||
input.val('');
|
||||
input.blur();
|
||||
commentFormIsOpen.set(false);
|
||||
Tracker.flush();
|
||||
autosize.update(input);
|
||||
}
|
||||
evt.preventDefault();
|
||||
},
|
||||
// Pressing Ctrl+Enter should submit the form
|
||||
'keydown form textarea': function(evt, tpl) {
|
||||
if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) {
|
||||
tpl.find('button[type=submit]').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.commentForm.onDestroyed(function() {
|
||||
commentFormIsOpen.set(false);
|
||||
});
|
||||
|
||||
EscapeActions.register('inlinedForm',
|
||||
function() {
|
||||
commentFormIsOpen.set(false);
|
||||
$('.js-new-comment-input').blur();
|
||||
},
|
||||
function() { return commentFormIsOpen.get(); }, {
|
||||
noClickEscapeOn: '.js-new-comment'
|
||||
}
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue