diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-19 06:27:18 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-19 06:27:18 -0700 |
commit | 1b530e4680b09391d7f99e91f1b0b1eb6b2069fc (patch) | |
tree | 9beee9ad047c5efa41dae7f64a0195b304770b61 /modules/tag | |
parent | 9a6a404a3239c964528b501d3c187ead84b1f7a0 (diff) | |
parent | b2d0b3ebbb1764593e387a2e07e0d4e67f4f5474 (diff) |
Merge branch 'master' into talmdal_dev
Conflicts:
modules/user/views/admin_users.html.php
Diffstat (limited to 'modules/tag')
-rw-r--r-- | modules/tag/css/tag.css | 42 | ||||
-rw-r--r-- | modules/tag/helpers/tag.php | 3 | ||||
-rw-r--r-- | modules/tag/helpers/tag_theme.php | 1 | ||||
-rw-r--r-- | modules/tag/js/tag.js | 33 | ||||
-rw-r--r-- | modules/tag/views/admin_tags.html.php | 74 | ||||
-rw-r--r-- | modules/tag/views/tag_block.html.php | 5 |
6 files changed, 79 insertions, 79 deletions
diff --git a/modules/tag/css/tag.css b/modules/tag/css/tag.css index b718de05..ec16251d 100644 --- a/modules/tag/css/tag.css +++ b/modules/tag/css/tag.css @@ -1,3 +1,5 @@ +/* Tag cloud ~~~~~~~~~~~~~~~~~~~~~~~ */ + #g-tag-cloud ul { font-size: 1.2em; text-align: justify; @@ -64,7 +66,13 @@ text-decoration: underline; } -/* Tag admin ~~~~~~~~~~~~~~ */ +/* Add tag form ~~~~~~~~~~~~~~~~~~~~ */ + +#g-sidebar .g-short-form .textbox { + width: 11em; +} + +/* Tag admin ~~~~~~~~~~~~~~~~~~~~~~~ */ #g-tag-admin { table-layout: fixed; @@ -75,40 +83,18 @@ } #g-tag-admin ul { - padding-bottom: .3em; + margin-bottom: 2em; } #g-tag-admin li { - padding: .1em 0 .2em .3em; -} - -#g-tag-admin .g-column { - float: left; - width: 200px; + padding: .1em 0 .2em 0; } -#g-edit-tag-form input { - padding: 0 .2em 0 .2em; - clear: none; - float: left; - margin: 0 .2em 0 0; +#g-rename-tag-form ul { + margin-bottom: 0; } -#g-edit-tag-form input[type="text"].g-error { +#g-rename-tag-form input[type="text"].g-error { border: 2px solid red; background: none; } - -#g-edit-tag-form input[type="submit"] { - height: 25px; -} - -#g-edit-tag-form a, #g-edit-tag-form span { - display: block; - float: left; - padding: .2em .2em 0 .1em; -} - -#g-edit-tag-form span { - float: right; -} diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index b1d79458..01972a65 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -79,7 +79,6 @@ class tag_Core { } } - /** * Return all the tags for a given item. * @return array @@ -111,7 +110,7 @@ class tag_Core { } static function get_rename_form($tag) { - $form = new Forge("admin/tags/rename/$tag->id", "", "post", array("id" => "g-edit-tag-form", "class" => "g-short-form")); + $form = new Forge("admin/tags/rename/$tag->id", "", "post", array("id" => "g-rename-tag-form", "class" => "g-short-form")); $group = $form->group("rename_tag")->label(t("Rename Tag")); $group->input("name")->label(t("Tag name"))->value($tag->name)->rules("required|length[1,64]"); $group->inputs["name"]->error_messages("in_use", t("There is already a tag with that name")); diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php index e3743824..ac0dd016 100644 --- a/modules/tag/helpers/tag_theme.php +++ b/modules/tag/helpers/tag_theme.php @@ -26,6 +26,7 @@ class tag_theme_Core { } static function admin_head($theme) { + $theme->css("tag.css"); $theme->script("tag.js"); } 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('"', """, 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('"', """, 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>"); diff --git a/modules/tag/views/admin_tags.html.php b/modules/tag/views/admin_tags.html.php index 2d41ee5f..dc9deb1f 100644 --- a/modules/tag/views/admin_tags.html.php +++ b/modules/tag/views/admin_tags.html.php @@ -1,5 +1,5 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<script> +<script type="text/javascript"> var TAG_RENAME_URL = <?= html::js_string(url::site("admin/tags/rename/__ID__")) ?>; $("document").ready(function() { // using JS for adding link titles to avoid running t() for each tag @@ -14,33 +14,43 @@ var save_i18n = <?= html::js_string(t("save")->for_html_attr()) ?>; var cancel_i18n = <?= html::js_string(t("cancel")->for_html_attr()) ?>; </script> -<div class="g-block"> - <h2> - <?= t("Tag Admin") ?> - </h2> - <? $tags_per_column = $tags->count()/5 ?> - <? $column_tag_count = 0 ?> +<? $tags_per_column = $tags->count()/5 ?> +<? $column_tag_count = 0 ?> - <table id="g-tag-admin" class="g-block-content"> - <caption class="g-understate"> - <?= t2("There is one tag", "There are %count tags", $tags->count()) ?> - </caption> - <tr> - <td> - <? foreach ($tags as $i => $tag): ?> - <? $current_letter = strtoupper(mb_substr($tag->name, 0, 1)) ?> +<div class="g-block"> + <h1> <?= t("Tag Admin") ?> </h1> - <? if ($i == 0): /* first letter */ ?> - <strong><?= html::clean($current_letter) ?></strong> - <ul> - <? elseif ($last_letter != $current_letter): /* new letter */ ?> - <? if ($column_tag_count > $tags_per_column): /* new column */ ?> - </td> - <td> - <? $column_tag_count = 0 ?> - <? endif ?> + <div class="g-block-content"> + <table id="g-tag-admin"> + <caption class="g-understate"> + <?= t2("There is one tag", "There are %count tags", $tags->count()) ?> + </caption> + <tr> + <td> + <? foreach ($tags as $i => $tag): ?> + <? $current_letter = strtoupper(mb_substr($tag->name, 0, 1)) ?> + <? if ($i == 0): /* first letter */ ?> + <strong><?= html::clean($current_letter) ?></strong> + <ul> + <? elseif ($last_letter != $current_letter): /* new letter */ ?> + <? if ($column_tag_count > $tags_per_column): /* new column */ ?> + </td> + <td> + <? $column_tag_count = 0 ?> + <? endif ?> + </ul> + <strong><?= html::clean($current_letter) ?></strong> + <ul> + <? endif ?> + <li> + <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"> + <span class="ui-icon ui-icon-trash"><?= t("Delete this tag") ?></span></a> + </li> </ul> <strong><?= html::clean($current_letter) ?></strong> <ul> @@ -53,12 +63,12 @@ class="g-dialog-link g-delete-link g-button"> <span class="ui-icon ui-icon-trash"><?= t("Delete this tag") ?></span></a> </li> - - <? $column_tag_count++ ?> - <? $last_letter = $current_letter ?> - <? endforeach /* $tags */ ?> - </ul> - </td> - </tr> - </table> + <? $column_tag_count++ ?> + <? $last_letter = $current_letter ?> + <? endforeach /* $tags */ ?> + </ul> + </td> + </tr> + </table> + </div> </div> diff --git a/modules/tag/views/tag_block.html.php b/modules/tag/views/tag_block.html.php index 8c79b74a..ad36b297 100644 --- a/modules/tag/views/tag_block.html.php +++ b/modules/tag/views/tag_block.html.php @@ -6,8 +6,9 @@ url, { max: 30, multiple: true, - multipleSeparator: ',', - cacheLength: 1} + multipleSeparator: ',', + cacheLength: 1 + } ); }); </script> |