summaryrefslogtreecommitdiffstats
path: root/client/components/activities/events.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/activities/events.js')
-rw-r--r--client/components/activities/events.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/client/components/activities/events.js b/client/components/activities/events.js
new file mode 100644
index 00000000..ea98e65f
--- /dev/null
+++ b/client/components/activities/events.js
@@ -0,0 +1,30 @@
+Template.cardActivities.events({
+ 'click .js-edit-action': function(evt) {
+ var $this = $(evt.currentTarget);
+ var container = $this.parents('.phenom-comment');
+
+ // open and focus
+ container.addClass('editing');
+ container.find('textarea').focus();
+ },
+ 'click .js-confirm-delete-action': function() {
+ CardComments.remove(this._id);
+ },
+ 'submit form': function(evt) {
+ var $this = $(evt.currentTarget);
+ var container = $this.parents('.phenom-comment');
+ var text = container.find('textarea');
+
+ if ($.trim(text.val())) {
+ CardComments.update(this._id, {
+ $set: {
+ text: text.val()
+ }
+ });
+
+ // reset editing class
+ $('.editing').removeClass('editing');
+ }
+ evt.preventDefault();
+ }
+});