From c9ccc2461880de141c37c3c7a7df3b26530ce806 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 18 Oct 2009 10:32:08 -0600 Subject: Moved the short_form init function to gallery.common and made it jQuery plugin. Dropped gallery.form.js. Applied short forms to server_add and tag admin pages. Added tag.css to admin views. Added .g-wide {}. --- .../server_add/controllers/admin_server_add.php | 2 +- modules/tag/css/tag.css | 34 ++------- modules/tag/helpers/tag.php | 3 +- modules/tag/js/tag.js | 33 +++++---- modules/tag/views/admin_tags.html.php | 81 +++++++++++----------- 5 files changed, 67 insertions(+), 86 deletions(-) (limited to 'modules') diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index 837a2c00..cb71e1f1 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -83,7 +83,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { private function _get_admin_form() { $form = new Forge("admin/server_add/add_path", "", "post", - array("id" => "g-server-add-admin-form")); + array("id" => "g-server-add-admin-form", "class" => "g-short-form g-wide")); $add_path = $form->group("add_path"); $add_path->input("path")->label(t("Path"))->rules("required") ->error_messages("not_readable", t("This directory is not readable by the webserver")) diff --git a/modules/tag/css/tag.css b/modules/tag/css/tag.css index b718de05..6dfba946 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; @@ -75,40 +77,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/js/tag.js b/modules/tag/js/tag.js index 17845272..41fa4d41 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 += ''; - form += ''; - form += ''; - form += '' + cancel_i18n + ''; + 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-" + 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("

" + data.message + "

"); diff --git a/modules/tag/views/admin_tags.html.php b/modules/tag/views/admin_tags.html.php index edc466bb..7771f7fe 100644 --- a/modules/tag/views/admin_tags.html.php +++ b/modules/tag/views/admin_tags.html.php @@ -14,51 +14,50 @@ var save_i18n = for_html_attr()) ?>; var cancel_i18n = for_html_attr()) ?>; -
-

- -

- count()/5 ?> - +

+ +

- - - - - + +
- count()) ?> -
- $tag): ?> - name, 0, 1)) ?> +count()/5 ?> + - - -
    - - $tags_per_column): /* new column */ ?> -
- - + + + + + - -
+ count()) ?> +
+ $tag): ?> + name, 0, 1)) ?> - - -
    + + +
      + + $tags_per_column): /* new column */ ?> +
+ -
  • - name) ?> - (count ?>) - id") ?>" - class="g-dialog-link g-delete-link g-button"> - -
  • + + +
      + - - - -
    -
    - +
  • + name) ?> + (count ?>) + id") ?>" + class="g-dialog-link g-delete-link g-button"> + +
  • + + + + + +
    -- cgit v1.2.3