Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMatt Claypotch <thepotch@gmail.com>2010-08-24 01:25:40 (GMT)
committer Matt Claypotch <thepotch@gmail.com>2010-08-24 01:25:40 (GMT)
commit819a52b38386b7f024236e91dc440d2072e96730 (patch)
treea2397f5df7c5c5acb6047fed5f5dfff86c38ae5d /media
parentf72883760b5cb8acb934fa4426ead7df5339039f (diff)
Inline edit tweaks
Diffstat (limited to 'media')
-rw-r--r--media/js/zamboni/reviews.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/media/js/zamboni/reviews.js b/media/js/zamboni/reviews.js
index d56ae53..c182ac4 100644
--- a/media/js/zamboni/reviews.js
+++ b/media/js/zamboni/reviews.js
@@ -50,6 +50,7 @@ $(document).ready(function() {
$review = $(this).parents(".review"),
rating = $review.attr("data-rating"),
edit_url = $("a.permalink", $review).attr("href") + "edit";
+ $cancel = $("#review-edit-cancel");
$review.attr("action", edit_url);
$form.detach().insertAfter($review);
@@ -59,11 +60,15 @@ $(document).ready(function() {
$review.hide();
$form.show();
- $("#review-edit-cancel").click(function(e) {
- e.preventDefault();
- $form.hide();
+ function done_edit() {
+ $form.unbind().hide();
$review.show();
- $(this).die();
+ $cancel.unbind();
+ }
+
+ $cancel.click(function(e) {
+ e.preventDefault();
+ done_edit();
});
$form.submit(function (e) {
@@ -77,9 +82,7 @@ $(document).ready(function() {
$(".stars", $review).removeClass('stars-0 stars-1 stars-2 stars-3 stars-4 stars-5').addClass('stars-' + rating);
rating = $review.attr("data-rating", rating);
$review.children("p.review-body").text($("#id_body").val());
- $review.show();
- $form.hide();
- $('#review-edit-cancel').die();
+ done_edit();
},
dataType: 'json'
});