diff options
author | Nathan Kinkade <nkinkade@nkinka.de> | 2010-02-03 13:48:34 +0000 |
---|---|---|
committer | Nathan Kinkade <nkinkade@nkinka.de> | 2010-02-03 13:48:34 +0000 |
commit | 052476ef44ca801766cbd6bdbfe42d5a0a362e52 (patch) | |
tree | f7a1d39fe4aae154e916e2cd4c02a798aef6c67f /lib | |
parent | 92d211bae653b6c94e0038b1a47734a1acaa149e (diff) | |
parent | 99a7f470b93d35717f8d5979d05da6cf05a1dd20 (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gallery.in_place_edit.js | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/lib/gallery.in_place_edit.js b/lib/gallery.in_place_edit.js index c10400e3..5a815dac 100644 --- a/lib/gallery.in_place_edit.js +++ b/lib/gallery.in_place_edit.js @@ -10,10 +10,10 @@ }, _show: function(target) { - if ($(this).data("gallery_in_place_edit") == true) { + if ($(target).data("gallery_in_place_edit") == true) { return; } - $(this).data("gallery_in_place_edit", true); + $(target).data("gallery_in_place_edit", true); var self = this; var tag_width = $(target).width(); $(self).data("tag_width", tag_width); @@ -27,26 +27,28 @@ var parent = $(target).parent(); parent.children().hide(); parent.append(data); - parent.find("form :text") - .width(tag_width) - .focus(); - $(".g-short-form").gallery_short_form(); - parent.find("form .g-cancel").click(function(event) { - self._cancel(); - event.preventDefault(); - return false; - }); - self._ajaxify_edit(); + self._setup_form(parent.find("form")); }); + }, + _setup_form: function(form) { + var self = this; + var width = $(self).data("tag_width"); + form.find(":text").width(width).focus(); + form.find(".g-cancel").click(function(event) { + self._cancel(); + event.preventDefault(); + return false; + }); + $(".g-short-form").gallery_short_form(); + this._ajaxify_edit(); }, _cancel: function() { var parent = $("#g-in-place-edit-form").parent(); - $(parent).find("form").remove(); + $("#g-in-place-edit-form").remove(); $(parent).children().show(); - $("#g-in-place-edit-message").remove(); - $(this).data("gallery_in_place_edit", false); + $(parent).find(".g-editable").data("gallery_in_place_edit", false); }, _ajaxify_edit: function() { @@ -60,17 +62,7 @@ } else { var parent = $(form).parent(); $(form).replaceWith(data.form); - var width = $(self).data("tag_width"); - $(parent).find("form :text") - .width(width) - .focus(); - $(".g-short-form").gallery_short_form(); - $(parent).find("form .g-cancel").click(function(event) { - self._cancel(); - event.preventDefault(); - return false; - }); - self._ajaxify_edit(); + self._setup_form(parent.find("form")); } } }); |