Permalink
Browse files

Implement verse deletion

- Bug relating to zombie views is yet to be resolved.
  • Loading branch information...
1 parent dcfeca0 commit 0863f3213606f50744029d3d9fbbacc201ad83eb @ismyrnow committed Feb 8, 2014
Showing with 18 additions and 4 deletions.
  1. +4 −0 public/css/style.css
  2. +7 −1 public/js/templates/editVerse.hbs
  3. +7 −3 public/js/views/editVerseView.js
@@ -126,6 +126,10 @@ select {
padding: 1em;
}
+#delete-verse {
+ color: rgb(231, 75, 75);
+}
+
/* FOOTER
-----------------------*/
@@ -20,4 +20,10 @@
{{/select}}
</select>
<textarea name="text" rows="7">{{text}}</textarea>
-</div>
+</div>
+
+<footer>
+ <nav>
+ <a href="javascript:void(0)" id="delete-verse">Delete</a>
+ </nav>
+</footer>
@@ -15,6 +15,7 @@ function (Handlebars, Marionette, template, debounce) {
events: {
'click #save-verse': 'saveVerse',
+ 'click #delete-verse': 'deleteVerse',
'keyup [name=reference]': 'referenceChangedDebounced'
},
@@ -24,9 +25,7 @@ function (Handlebars, Marionette, template, debounce) {
var list = $('select[name=list]').val();
var text = $('textarea[name=text').val();
- var verseModel = App.Verses.get(this.model.id);
-
- verseModel.save({
+ this.model.save({
reference: reference,
text: text,
version: version,
@@ -36,6 +35,11 @@ function (Handlebars, Marionette, template, debounce) {
window.location.hash = "#";
},
+ deleteVerse: function() {
+ this.model.destroy();
+ window.location.hash = "#";
+ },
+
referenceChanged: function() {
// TODO: check to see if reference looks legit
var reference = $('input[name=reference]').val();

0 comments on commit 0863f32

Please sign in to comment.