From c9ccc2461880de141c37c3c7a7df3b26530ce806 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 18 Oct 2009 10:32:08 -0600 Subject: Moved the short_form init function to gallery.common and made it jQuery plugin. Dropped gallery.form.js. Applied short forms to server_add and tag admin pages. Added tag.css to admin views. Added .g-wide {}. --- modules/tag/js/tag.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'modules/tag/js') diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js index 17845272..41fa4d41 100644 --- a/modules/tag/js/tag.js +++ b/modules/tag/js/tag.js @@ -18,10 +18,10 @@ function ajaxify_tag_form() { function closeEditInPlaceForms() { // closes currently open inplace edit forms - if ($("#g-edit-tag-form").length) { + if ($("#g-rename-tag-form").length) { $("#g-edit-error-message").remove(); - var li = $("#g-edit-tag-form").parent(); - $("#g-edit-tag-form").parent().html($("#g-edit-tag-form").parent().data("revert")); + var li = $("#g-rename-tag-form").parent(); + $("#g-rename-tag-form").parent().html($("#g-rename-tag-form").parent().data("revert")); li.height(""); $(".g-editable", li).bind("click", editInPlace); $(".g-dialog-link", li).gallery_dialog(); @@ -41,34 +41,37 @@ function editInPlace(element) { var tag_name = $(this).html(); var tag_width = $(this).width(); $(this).parent().data("revert", $(this).parent().html()); - var form = '
'; form += ''; - form += ''; - form += ''; - form += '' + cancel_i18n + ''; + form += ''; form += '
'; // add edit form $(this).parent().html(form); - $("#g-edit-tag-form #name") - .width(tag_width+30) + $("#g-rename-tag-form #name") + .width(tag_width) .focus(); - //$("#g-edit-tag-form").parent().height( $("#g-edit-tag-form").height() ); - $("#g-edit-tag-form a").bind("click", closeEditInPlaceForms); + $(".g-short-form").gallery_short_form(); + $("#g-rename-tag-form .g-cancel").bind("click", closeEditInPlaceForms); ajaxify_editInPlaceForm = function() { - $("#g-edit-tag-form").ajaxForm({ + $("#g-rename-tag-form").ajaxForm({ dataType: "json", success: function(data) { + console.log("success"); if (data.result == "success") { closeEditInPlaceForms(); // close form $("#g-tag-" + data.tag_id).text(data.new_tagname); // update tagname - console.log(data); window.location.reload(); } else if (data.result == "error") { - $("#g-edit-tag-form #name") + console.log("error"); + $("#g-rename-tag-form #name") .addClass("g-error") .focus(); $("#g-tag-admin").before("

" + data.message + "

"); -- cgit v1.2.3