From 5490057480f17e5810cf8b9e558769ebd74d4b27 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 16 Sep 2009 12:27:13 -0700 Subject: When editing tags in place, and there is a validation error, highlight the tag with a red border and show a statust message. This fixes ticket: #779 --- modules/tag/js/tag.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/tag/js') diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js index aaae9e72..d656da36 100644 --- a/modules/tag/js/tag.js +++ b/modules/tag/js/tag.js @@ -19,6 +19,7 @@ function ajaxify_tag_form() { function closeEditInPlaceForms() { // closes currently open inplace edit forms if ($("#gRenameTagForm").length) { + $("#gEditErrorMessage").remove(); var li = $("#gRenameTagForm").parent(); $("#gRenameTagForm").parent().html($("#gRenameTagForm").parent().data("revert")); li.height(""); @@ -66,6 +67,11 @@ function editInPlace(element) { $("#gTag-" + data.tag_id).text(data.new_tagname); // update tagname console.log(data); window.location.reload(); + } else if (data.result == "error") { + $("#gRenameTagForm #name") + .css("border", "2px solid red") + .focus(); + $("#gTagAdmin").before("

" + data.message + "

"); } } }); -- cgit v1.2.3 From 48326ad01708fcfa020283e2ad8b2cae4ede1600 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 12:11:00 -0700 Subject: Cleanup issues with the original fix for #779 --- modules/tag/controllers/admin_tags.php | 4 ++-- modules/tag/js/tag.js | 2 +- themes/admin_default/css/screen.css | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'modules/tag/js') diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index 3301566b..ced73d65 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -81,7 +81,7 @@ class Admin_Tags_Controller extends Admin_Controller { kohana::show_404(); } - //Don't use a form as the form is dynamically created in the js + // Don't use a form as the form is dynamically created in the js $post = new Validation($_POST); $post->add_rules("name", "required", "length[1,64]"); $valid = $post->validate(); @@ -89,7 +89,7 @@ class Admin_Tags_Controller extends Admin_Controller { $new_name = $this->input->post("name"); $new_tag = ORM::factory("tag")->where("name", $new_name)->find(); if ($new_tag->loaded) { - $error_msg = "There is already a tag with that name"; + $error_msg = t("There is already a tag with that name")->__toString(); $valid = false; } } else { diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js index d656da36..52c695c6 100644 --- a/modules/tag/js/tag.js +++ b/modules/tag/js/tag.js @@ -69,7 +69,7 @@ function editInPlace(element) { window.location.reload(); } else if (data.result == "error") { $("#gRenameTagForm #name") - .css("border", "2px solid red") + .addClass("gError") .focus(); $("#gTagAdmin").before("

" + data.message + "

"); } diff --git a/themes/admin_default/css/screen.css b/themes/admin_default/css/screen.css index 33cc6733..de6d436e 100644 --- a/themes/admin_default/css/screen.css +++ b/themes/admin_default/css/screen.css @@ -1034,6 +1034,11 @@ li.gDefaultGroup h4, li.gDefaultGroup .gUser { float: right; } +#gRenameTagForm input[type="text"].gError { + border: 2px solid red; + background: none; +} + #gRenameTagForm input[type="submit"] { height: 25px; } -- cgit v1.2.3