From eb081dd3cfe2a0a5f43099ff1c9ca5617ae8ca5c Mon Sep 17 00:00:00 2001 From: fazo96 Date: Mon, 26 May 2014 12:08:14 +0200 Subject: [PATCH] added editor, not working yet though --- app.coffee | 19 ++++++++++++++++--- index.html | 22 ++++++++++++++++++---- style.css | 14 +++++++++++++- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/app.coffee b/app.coffee index 73bcca9..86a9bb3 100644 --- a/app.coffee +++ b/app.coffee @@ -27,8 +27,20 @@ if Meteor.isClient Template.notes.notes = -> notes.find().fetch() Template.notes.events { - 'click .delete': -> - notes.remove @_id + 'click .delete': -> notes.remove @_id + 'click .edit': -> + Template.edit.note = this; console.log Template.edit.note + UI.render Template.edit + } + + # Note Editor TODO: Make Reactive + Template.edit.show = -> + console.log Template.edit.note isnt undefined + Template.edit.note isnt undefined + Template.edit.note = undefined + Template.edit.events { + 'click .close': -> Template.edit.note = undefined + 'click .save': -> null } # Auth @@ -36,8 +48,9 @@ if Meteor.isClient Template.auth.errCallback = (err) -> Template.auth.alert { msg: err.reason } + # TODO: make reactive Template.auth.alert = (add,remove) -> - if add then Template.auth.alerts.push add; + if add then Template.auth.alerts.push add if remove Template.auth.alerts.splice Template.auth.alerts.indexOf(remove), 1 Template.auth.alerts diff --git a/index.html b/index.html index 2a0ccb7..9d60e1d 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@
- {{> notes}} {{#if currentUser}} + {{> edit}} {{> notes}} {{#if currentUser}}
{{> userInfo}}
{{/if}} {{#unless currentUser}}
{{> auth}}
{{/unless}} @@ -22,10 +22,8 @@