aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/home/main.html.erb
diff options
context:
space:
mode:
authorTeddy Wing2016-10-06 18:38:14 -0400
committerTeddy Wing2016-10-06 18:38:14 -0400
commit1d6fa22853b724025461aca3d8b7b939c9fc2dba (patch)
treef2b25601dba11abb62476a115bdb21b2c855269f /app/views/home/main.html.erb
parentc7aad39abdb200d85915fe98fdf21000599552fa (diff)
downloadNotes-angular-demo-1d6fa22853b724025461aca3d8b7b939c9fc2dba.tar.bz2
Prepare for mentor session with Andrew Clark. Refresh my memory on how this all works and is implemented by rewriting the code, using the code from Dany's live session as a reference.
Diffstat (limited to 'app/views/home/main.html.erb')
-rw-r--r--app/views/home/main.html.erb40
1 files changed, 27 insertions, 13 deletions
diff --git a/app/views/home/main.html.erb b/app/views/home/main.html.erb
index 990f007..46fdd35 100644
--- a/app/views/home/main.html.erb
+++ b/app/views/home/main.html.erb
@@ -3,30 +3,44 @@
<div class="position-relative">
<div class="right-section">
- <span class="display-none margin-top-neg-15">
- <input type="text" class="form-field" />
- <button type="button" class="button">Create</button>
- <button type="button" class="button">Cancel</button>
+ <span class="display-inline-block margin-top-neg-15"
+ ng-show="notesService.show_create">
+ <input type="text" class="form-field"
+ ng-model="notesService.new_note_title" />
+ <button type="button" class="button"
+ ng-click="notesService.create(notesService.new_note_title)">Create</button>
+ <button type="button" class="button"
+ ng-click="notesService.show_create = false">Cancel</button>
</span>
- <a href="#" class="button">New</a>
+ <a href="#" class="button"
+ ng-hide="notesService.show_create"
+ ng-click="notesService.show_create = true">New</a>
- <a href="#" class="button margin-left-8">Save</a>
+ <a href="#" class="button margin-left-8"
+ ng-show="notesService.current_note"
+ ng-click="notesService.update()">Save</a>
</div>
</div>
</div>
<div class="margin-top-70">
<div class="sidebar position-fixed min-height-100%">
- <a href="#" class="sidebar-link display-block padding-13">A Note</a>
- <a href="#" class="delete-link display-none"><span>×</span></a>
- <a href="#" class="sidebar-link display-block padding-13">A Note</a>
- <a href="#" class="delete-link display-none"><span>×</span></a>
- <a href="#" class="sidebar-link display-block padding-13">A Note</a>
- <a href="#" class="delete-link display-none"><span>×</span></a>
+ <div ng-repeat="note in notesService.notes">
+ <a href="#" class="sidebar-link display-block padding-13"
+ ng-class="{ active: notesService.current_note === note }"
+ ng-click="notesService.open(note)"
+ ng-mouseover="display_delete_link = true"
+ ng-mouseout="display_delete_link = false"
+ ng-bind="note.title"></a>
+ <a href="#" class="delete-link"
+ ng-show="display_delete_link"
+ ng-click="notesService.delete(note)"><span>×</span></a>
+ </div>
</div>
<div class="note-editor">
- <textarea class="border-none outline-none width-100% font-size-16"></textarea>
+ <textarea class="border-none outline-none width-100% font-size-16"
+ ng-model="notesService.current_note.body"></textarea>
</div>
</div>