mirror of
https://github.com/fazo96/homework.git
synced 2025-01-25 14:34:20 +01:00
added editor, not working yet though
This commit is contained in:
parent
fa326ac809
commit
eb081dd3cf
19
app.coffee
19
app.coffee
@ -27,8 +27,20 @@ if Meteor.isClient
|
|||||||
Template.notes.notes = ->
|
Template.notes.notes = ->
|
||||||
notes.find().fetch()
|
notes.find().fetch()
|
||||||
Template.notes.events {
|
Template.notes.events {
|
||||||
'click .delete': ->
|
'click .delete': -> notes.remove @_id
|
||||||
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
|
# Auth
|
||||||
@ -36,8 +48,9 @@ if Meteor.isClient
|
|||||||
Template.auth.errCallback = (err) ->
|
Template.auth.errCallback = (err) ->
|
||||||
Template.auth.alert { msg: err.reason }
|
Template.auth.alert { msg: err.reason }
|
||||||
|
|
||||||
|
# TODO: make reactive
|
||||||
Template.auth.alert = (add,remove) ->
|
Template.auth.alert = (add,remove) ->
|
||||||
if add then Template.auth.alerts.push add;
|
if add then Template.auth.alerts.push add
|
||||||
if remove
|
if remove
|
||||||
Template.auth.alerts.splice Template.auth.alerts.indexOf(remove), 1
|
Template.auth.alerts.splice Template.auth.alerts.indexOf(remove), 1
|
||||||
Template.auth.alerts
|
Template.auth.alerts
|
||||||
|
22
index.html
22
index.html
@ -10,7 +10,7 @@
|
|||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="center-block" id="quicknotes">
|
<div class="center-block" id="quicknotes">
|
||||||
{{> notes}} {{#if currentUser}}
|
{{> edit}} {{> notes}} {{#if currentUser}}
|
||||||
<div align="center"> {{> userInfo}} </div>
|
<div align="center"> {{> userInfo}} </div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#unless currentUser}} <div align="center">{{> auth}}</div>{{/unless}}
|
{{#unless currentUser}} <div align="center">{{> auth}}</div>{{/unless}}
|
||||||
@ -22,10 +22,8 @@
|
|||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
{{#each notes}}
|
{{#each notes}}
|
||||||
<li class="note list-group-item">
|
<li class="note list-group-item">
|
||||||
|
<button type="button" class="edit close"><i class="fa fa-pencil-square-o"></i></button>
|
||||||
{{content}}
|
{{content}}
|
||||||
<!--<button type="button" class="btn btn-danger pull-right delete">
|
|
||||||
<i class="fa fa-trash-o"></i>
|
|
||||||
</button>-->
|
|
||||||
<button type="button" class="delete close">×</button>
|
<button type="button" class="delete close">×</button>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -55,3 +53,19 @@
|
|||||||
<p>Logged in as {{in}}</p>
|
<p>Logged in as {{in}}</p>
|
||||||
<button type="button" id="logout" class="btn btn-danger">Logout</button>
|
<button type="button" id="logout" class="btn btn-danger">Logout</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template name="edit">
|
||||||
|
{{#if note}}
|
||||||
|
<div class="panel panel-info">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">
|
||||||
|
<input type="text" class="form-control title" placeholder="Title">
|
||||||
|
<button type="button" class="close">×</button>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<textarea class="area form-control" rows="3">{{note.content}}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</template>
|
||||||
|
14
style.css
14
style.css
@ -1,6 +1,5 @@
|
|||||||
.page-header {
|
.page-header {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
@ -19,6 +18,19 @@ input {
|
|||||||
margin-top: -2px;
|
margin-top: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit {
|
||||||
|
clear: right;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.area {
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
|
||||||
#newNote {
|
#newNote {
|
||||||
max-width: 250px;
|
max-width: 250px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
Loading…
Reference in New Issue
Block a user