diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-10-18 10:30:36 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-10-18 10:33:51 -0700 |
commit | b976f9b3665771444c30e914fe21cbce5848bd21 (patch) | |
tree | 2be33f0254fa123de2f8deee92f04922a0eaa797 | |
parent | 4949a2ce0b5daca7afe86a261be447440fce7eff (diff) |
Move away from embedding the tag id in to the CSS id. This is brittle
and causes us to do silly things to extract the id.
Use rel instead so:
<span id="g-tag-1">
becomes:
<span class="g-tag" rel="1">
-rw-r--r-- | modules/tag/js/tag.js | 4 | ||||
-rw-r--r-- | modules/tag/views/admin_tags.html.php | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js index 17845272..532ada95 100644 --- a/modules/tag/js/tag.js +++ b/modules/tag/js/tag.js @@ -37,7 +37,7 @@ function editInPlace(element) { closeEditInPlaceForms(); // create edit form - var tag_id = $(this).attr('id').substr(5); + var tag_id = $(this).attr('rel'); var tag_name = $(this).html(); var tag_width = $(this).width(); $(this).parent().data("revert", $(this).parent().html()); @@ -64,7 +64,7 @@ function editInPlace(element) { success: function(data) { if (data.result == "success") { closeEditInPlaceForms(); // close form - $("#g-tag-" + data.tag_id).text(data.new_tagname); // update tagname + $(".g-tag[rel=" + data.tag_id + "]").text(data.new_tagname); // update tagname console.log(data); window.location.reload(); } else if (data.result == "error") { diff --git a/modules/tag/views/admin_tags.html.php b/modules/tag/views/admin_tags.html.php index edc466bb..2d41ee5f 100644 --- a/modules/tag/views/admin_tags.html.php +++ b/modules/tag/views/admin_tags.html.php @@ -47,7 +47,7 @@ <? endif ?> <li> - <span id="g-tag-<?= $tag->id ?>" class="g-editable g-tag-name"><?= html::clean($tag->name) ?></span> + <span class="g-editable g-tag-name" rel="<?= $tag->id ?>"><?= html::clean($tag->name) ?></span> <span class="g-understate">(<?= $tag->count ?>)</span> <a href="<?= url::site("admin/tags/form_delete/$tag->id") ?>" class="g-dialog-link g-delete-link g-button"> |