summaryrefslogtreecommitdiff
path: root/modules/tag/js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tag/js')
-rw-r--r--modules/tag/js/tag.js33
1 files changed, 18 insertions, 15 deletions
diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js
index 532ada95..4ed88e03 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 id="g-edit-tag-form" method="post" class="g-inline ui-helper-clearfix" ';
+ var form = '<form id="g-rename-tag-form" method="post" class="g-short-form" ';
form += 'action="' + TAG_RENAME_URL.replace('__ID__', tag_id) + '">';
form += '<input name="csrf" type="hidden" value="' + csrf_token + '" />';
- form += '<input id="name" name="name" type="text" class="textbox" value="' +
- str_replace('"', "&quot;", tag_name) + '" />';
- form += '<input type="submit" class="submit ui-state-default ui-corner-all" value="' + save_i18n + '" i/>';
- form += '<a href="#">' + cancel_i18n + '</a>';
+ form += '<ul>';
+ form += '<li><input id="name" name="name" type="text" class="textbox" value="' +
+ str_replace('"', "&quot;", tag_name) + '" /></li>';
+ form += '<li><input type="submit" class="submit ui-state-default" value="' + save_i18n + '" /></li>';
+ form += '<li><a href="#" class="g-cancel">' + cancel_i18n + '</a></li>';
+ form += '</ul>';
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[rel=" + 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("<p id=\"g-edit-error-message\" class=\"g-error\">" + data.message + "</p>");