diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-11-07 07:35:15 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-11-07 07:35:15 -0800 |
commit | 87f00a5ec5e072f98f5ed6fcd559ef249da57b36 (patch) | |
tree | d1c6ddf82600c4d02ab9098766597d1a3cbfac33 /lib | |
parent | c40735c922b53eb32be1ae39a030362eea52e602 (diff) | |
parent | e300ede3d8311bf236594480355f710b39aaa451 (diff) |
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gallery.common.css | 5 | ||||
-rw-r--r-- | lib/gallery.in_place_edit.js | 26 |
2 files changed, 25 insertions, 6 deletions
diff --git a/lib/gallery.common.css b/lib/gallery.common.css index 2cbce900..f199ba45 100644 --- a/lib/gallery.common.css +++ b/lib/gallery.common.css @@ -87,7 +87,10 @@ option:focus { color: #000; } -input.checkbox { +input.checkbox, +input[type=checkbox], +input.radio, +input[type=radio] { float: left; margin-right: .4em; } diff --git a/lib/gallery.in_place_edit.js b/lib/gallery.in_place_edit.js index 38c4efb1..681688e5 100644 --- a/lib/gallery.in_place_edit.js +++ b/lib/gallery.in_place_edit.js @@ -2,7 +2,6 @@ $.widget("ui.gallery_in_place_edit", { _init: function() { var self = this; - $(self).data("parent", self.element.parent()); this.element.click(function(event) { event.preventDefault(); self._show(event.currentTarget); @@ -15,6 +14,11 @@ var tag_width = $(target).width(); $(self).data("tag_width", tag_width); + var form = $("#g-in-place-edit-form"); + if (form.length > 0) { + self._cancel(); + } + $.get(self.options.form_url.replace("__ID__", $(target).attr('rel')), function(data) { var parent = $(target).parent(); parent.children().hide(); @@ -24,8 +28,7 @@ .focus(); $(".g-short-form").gallery_short_form(); parent.find("form .g-cancel").click(function(event) { - parent.find("form").remove(); - parent.children().show(); + self._cancel(); event.preventDefault(); return false; }); @@ -34,21 +37,34 @@ }, + _cancel: function() { + var parent = $("#g-in-place-edit-form").parent(); + $(parent).find("form").remove(); + $(parent).children().show(); + $("#g-in-place-edit-message").remove(); + }, + _ajaxify_edit: function() { var self = this; - var form = $($(self).data("parent")).find("form"); + var form = $("#g-in-place-edit-form"); $(form).ajaxForm({ dataType: "json", success: function(data) { if (data.result == "success") { window.location.reload(); } else { + var parent = $(form).parent(); $(form).replaceWith(data.form); var width = $(self).data("tag_width"); - $($(self).data("parent")).find("form :text") + $(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(); } } |