diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-04-03 22:53:43 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-04-03 22:53:43 +0000 |
commit | f7435112c54d7d45dee6ba9f747609d9491bbff5 (patch) | |
tree | 515ed44a2c7ee3ef5bcf6feedbac798cb89225c9 /modules | |
parent | dff53d9e31dec8110f4fd047c69c5444ebde273e (diff) |
Clean up JS/HTML so that renaming works properly (it had hardcoded
urls before). Clean up indentation and localization code while I'm
in there.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/tag/js/tag.js | 44 | ||||
-rw-r--r-- | modules/tag/views/admin_tags.html.php | 4 |
2 files changed, 24 insertions, 24 deletions
diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js index b0ba2516..a1eaeecd 100644 --- a/modules/tag/js/tag.js +++ b/modules/tag/js/tag.js @@ -18,41 +18,41 @@ function ajaxify_tag_form() { function closeEditInPlaceForms() { // closes currently open inplace edit forms - if ($("#gRenameTagForm").length) { - var li = $("#gRenameTagForm").parent(); - $("#gRenameTagForm").parent().html($("#gRenameTagForm").parent().data("revert")); + if ($("#gRenameTagForm").length) { + var li = $("#gRenameTagForm").parent(); + $("#gRenameTagForm").parent().html($("#gRenameTagForm").parent().data("revert")); li.height(""); - $(".gEditable", li).bind("click", editInplace); + $(".gEditable", li).bind("click", editInPlace); $(".gDialogLink", li).bind("click", handleDialogEvent); } } -function editInplace(element) { - closeEditInPlaceForms(); +function editInPlace(element) { + closeEditInPlaceForms(); - // creat edit form - var tag_id = $(this).attr('id').substr(5); + // create edit form + var tag_id = $(this).attr('id').substr(5); var tag_name = $(this).text(); var tag_width = $(this).width(); - $(this).parent().data("revert", $(this).parent().html()); - var form = '<form id="gRenameTagForm" method="post" class="ui-helper-clearfix" '; - form += 'action="/gallery3/index.php/admin/tags/rename/' + tag_id + '">'; - form += '<input name="csrf" type="hidden" value="' + csrf_token + '" />'; + $(this).parent().data("revert", $(this).parent().html()); + var form = '<form id="gRenameTagForm" method="post" class="ui-helper-clearfix" '; + 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="' + tag_name + '" />'; - form += '<input type="submit" class="submit ui-state-default ui-corner-all" value="' + save_i18n + '" />'; - form += '<span>' + or_i18n + '</span> <a href="#">' + cancel_i18n + '</a>'; - form += '</form>'; - + form += '<input type="submit" class="submit ui-state-default ui-corner-all" value="' + save_i18n + '" i/>'; + form += '<a href="#">' + cancel_i18n + '</a>'; + form += '</form>'; + // add edit form - $(this).parent().html(form); + $(this).parent().html(form); $("#gRenameTagForm #name") .width(tag_width+30) .focus(); //$("#gRenameTagForm").parent().height( $("#gRenameTagForm").height() ); $("#gRenameTagForm a").bind("click", closeEditInPlaceForms); - - ajaxify_editInplaceForm = function() { - $("#gRenameTagForm").ajaxForm({ + + ajaxify_editInPlaceForm = function() { + $("#gRenameTagForm").ajaxForm({ dataType: "json", success: function(data) { if (data.result == "success") { @@ -64,5 +64,5 @@ function editInplace(element) { } }); }; - ajaxify_editInplaceForm(); -}
\ No newline at end of file + ajaxify_editInPlaceForm(); +} diff --git a/modules/tag/views/admin_tags.html.php b/modules/tag/views/admin_tags.html.php index 48d2d0f8..133b452f 100644 --- a/modules/tag/views/admin_tags.html.php +++ b/modules/tag/views/admin_tags.html.php @@ -1,18 +1,18 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <script src="<?= url::file("modules/tag/js/tag.js") ?>" type="text/javascript"></script> <script> + var TAG_RENAME_URL = "<?= url::site("admin/tags/rename/__ID__") ?>"; $("document").ready(function() { // using JS for adding link titles to avoid running t() for each tag $("#gTagAdmin .tag-name").attr("title", "<?= t("Click to edit this tag") ?>"); $("#gTagAdmin .delete-link").attr("title", $(".delete-link:first span").html()); // In-place editing for tag admin - $(".gEditable").bind("click", editInplace); + $(".gEditable").bind("click", editInPlace); }); // make some values available within tag.js var csrf_token = "<?= $csrf ?>"; var save_i18n = '<?= t("save") ?>'; - var or_i18n = '<?= t("or") ?>'; var cancel_i18n = '<?= t("cancel") ?>'; </script> <div class="gBlock"> |