1
0
mirror of https://github.com/fazo96/homework.git synced 2025-01-10 12:14:22 +01:00

fixed long descs

This commit is contained in:
fazo96 2014-05-27 08:54:18 +02:00
parent 1f957770f7
commit 9d94fa0532
2 changed files with 12 additions and 6 deletions

View File

@ -29,6 +29,8 @@ if Meteor.isClient
Template.userInfo.in = -> Meteor.user().emails[0].address Template.userInfo.in = -> Meteor.user().emails[0].address
# Notes template # Notes template
Template.notes.truncateNoteDesc = (s) ->
if s.length > 52 then s.slice(0,48)+"..." else s
Template.notes.notes = -> Template.notes.notes = ->
d = notes.find().fetch(); d = notes.find().fetch();
#d.splice d.indexOf(Session.get('note')), 1 ; d #d.splice d.indexOf(Session.get('note')), 1 ; d
@ -39,13 +41,17 @@ if Meteor.isClient
# Note Editor # Note Editor
Template.editor.note = -> Session.get 'note' Template.editor.note = -> Session.get 'note'
Template.editor.events saveCurrentNote = (t,e) ->
'click .close-editor': -> Session.set 'note', undefined if e and e.keyCode isnt 13 then return;
'click .save-editor': (e,t) ->
notes.update Session.get('note')._id, notes.update Session.get('note')._id,
$set: $set:
title: t.find('.title').value title: t.find('.title').value
content: t.find('.area').value content: t.find('.area').value
Template.editor.events
'click .close-editor': -> Session.set 'note', undefined
'click .save-editor': (e,t) -> saveCurrentNote t
#'keypress .edit-note': (e,t) -> saveCurrentNote t, e # Doesnt work??
'keypress .title': (e,t) -> saveCurrentNote t, e
# Notifications # Notifications
alerts = [] alerts = []

View File

@ -24,7 +24,7 @@
{{#each notes}} {{#each notes}}
<li class="note list-group-item"> <li class="note list-group-item">
<button type="button" class="edit-note close"><i class="fa fa-pencil-square-o"></i></button> <button type="button" class="edit-note close"><i class="fa fa-pencil-square-o"></i></button>
<b>{{title}}</b> <span class="subtitle">{{content}}</span> <b>{{title}}</b> <span class="subtitle">{{truncateNoteDesc content}}</span>
<button type="button" class="close-note close">&times;</button> <button type="button" class="close-note close">&times;</button>
</li> </li>
{{/each}} {{/each}}