diff options
-rw-r--r-- | lib/gallery.common.css | 5 | ||||
-rw-r--r-- | lib/gallery.in_place_edit.js | 26 | ||||
-rw-r--r-- | modules/gallery/css/gallery.css | 2 | ||||
-rw-r--r-- | modules/gallery/libraries/InPlaceEdit.php | 8 | ||||
-rw-r--r-- | modules/gallery/models/item.php | 4 | ||||
-rw-r--r-- | modules/gallery/tests/Item_Model_Test.php | 1 | ||||
-rw-r--r-- | modules/gallery/views/in_place_edit.html.php | 4 | ||||
-rw-r--r-- | modules/tag/controllers/admin_tags.php | 18 | ||||
-rw-r--r-- | modules/tag/css/tag.css | 4 | ||||
-rw-r--r-- | themes/admin_wind/css/screen.css | 12 | ||||
-rw-r--r-- | themes/night_wind/css/screen.css | 4 | ||||
-rw-r--r-- | themes/wind/css/screen.css | 4 |
12 files changed, 60 insertions, 32 deletions
diff --git a/lib/gallery.common.css b/lib/gallery.common.css index 2cbce900..f199ba45 100644 --- a/lib/gallery.common.css +++ b/lib/gallery.common.css @@ -87,7 +87,10 @@ option:focus { color: #000; } -input.checkbox { +input.checkbox, +input[type=checkbox], +input.radio, +input[type=radio] { float: left; margin-right: .4em; } diff --git a/lib/gallery.in_place_edit.js b/lib/gallery.in_place_edit.js index 38c4efb1..681688e5 100644 --- a/lib/gallery.in_place_edit.js +++ b/lib/gallery.in_place_edit.js @@ -2,7 +2,6 @@ $.widget("ui.gallery_in_place_edit", { _init: function() { var self = this; - $(self).data("parent", self.element.parent()); this.element.click(function(event) { event.preventDefault(); self._show(event.currentTarget); @@ -15,6 +14,11 @@ var tag_width = $(target).width(); $(self).data("tag_width", tag_width); + var form = $("#g-in-place-edit-form"); + if (form.length > 0) { + self._cancel(); + } + $.get(self.options.form_url.replace("__ID__", $(target).attr('rel')), function(data) { var parent = $(target).parent(); parent.children().hide(); @@ -24,8 +28,7 @@ .focus(); $(".g-short-form").gallery_short_form(); parent.find("form .g-cancel").click(function(event) { - parent.find("form").remove(); - parent.children().show(); + self._cancel(); event.preventDefault(); return false; }); @@ -34,21 +37,34 @@ }, + _cancel: function() { + var parent = $("#g-in-place-edit-form").parent(); + $(parent).find("form").remove(); + $(parent).children().show(); + $("#g-in-place-edit-message").remove(); + }, + _ajaxify_edit: function() { var self = this; - var form = $($(self).data("parent")).find("form"); + var form = $("#g-in-place-edit-form"); $(form).ajaxForm({ dataType: "json", success: function(data) { if (data.result == "success") { window.location.reload(); } else { + var parent = $(form).parent(); $(form).replaceWith(data.form); var width = $(self).data("tag_width"); - $($(self).data("parent")).find("form :text") + $(parent).find("form :text") .width(width) .focus(); $(".g-short-form").gallery_short_form(); + $(parent).find("form .g-cancel").click(function(event) { + self._cancel(); + event.preventDefault(); + return false; + }); self._ajaxify_edit(); } } diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css index 18d9a522..3262dee2 100644 --- a/modules/gallery/css/gallery.css +++ b/modules/gallery/css/gallery.css @@ -50,7 +50,7 @@ /* In-place edit ~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#g-inplace-edit-form ul { +#g-in-place-edit-form ul { margin: 0; } diff --git a/modules/gallery/libraries/InPlaceEdit.php b/modules/gallery/libraries/InPlaceEdit.php index 057874e3..67ab3805 100644 --- a/modules/gallery/libraries/InPlaceEdit.php +++ b/modules/gallery/libraries/InPlaceEdit.php @@ -35,22 +35,22 @@ class InPlaceEdit_Core { return $instance; } - public function add_action($action) { + public function action($action) { $this->action = $action; return $this; } - public function add_rules($rules) { + public function rules($rules) { $this->rules += $rules; return $this; } - public function add_messages($messages) { + public function messages($messages) { $this->messages += $messages; return $this; } - public function add_callback($callback) { + public function callback($callback) { $this->callback = $callback; return $this; } diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 9735ed62..d27e331b 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -444,11 +444,11 @@ class Item_Model extends ORM_MPTT { $position = $db->from("items") ->where("parent_id", $this->id) - ->where("$sort_column < ", $child->$sort_column) + ->where("$sort_column $comp ", $child->$sort_column) ->where($where) ->count_records(); - // We stopped short of our target value in the sort (notice that we're using a < comparator + // We stopped short of our target value in the sort (notice that we're using a < comparator // above) because it's possible that we have duplicate values in the sort column. An // equality check would just arbitrarily pick one of those multiple possible equivalent // columns, which would mean that if you choose a sort order that has duplicates, it'd pick diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index fefc9383..e7dce893 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -232,6 +232,7 @@ class Item_Model_Test extends Unit_Test_Case { $this->assert_equal("resize", file_get_contents($photo->resize_path())); $this->assert_equal("file", file_get_contents($photo->file_path())); } + public function move_album_fails_invalid_target_test() { // Create an album with a photo in it $root = ORM::factory("item", 1); diff --git a/modules/gallery/views/in_place_edit.html.php b/modules/gallery/views/in_place_edit.html.php index 64671d57..03cbdc69 100644 --- a/modules/gallery/views/in_place_edit.html.php +++ b/modules/gallery/views/in_place_edit.html.php @@ -1,5 +1,5 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<?= form::open($action, array("method" => "post", "id" => "g-inplace-edit-form", "class" => "g-short-form"), $hidden) ?> +<?= form::open($action, array("method" => "post", "id" => "g-in-place-edit-form", "class" => "g-short-form"), $hidden) ?> <ul> <li <? if (!empty($errors["input"])): ?> class="g-error"<? endif ?>> <?= form::input("input", $form["input"], " class='textbox'") ?> @@ -11,6 +11,6 @@ </ul> <?= form::close() ?> <? if (!empty($errors["input"])): ?> -<div id="g-inplace-edit-message" class="g-error"><?= $errors["input"] ?></div> +<div id="g-in-place-edit-message" class="g-error"><?= $errors["input"] ?></div> <? endif ?> diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index d79f697c..67587c2e 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -70,7 +70,7 @@ class Admin_Tags_Controller extends Admin_Controller { $tag = ORM::factory("tag", $id); if ($tag->loaded) { print InPlaceEdit::factory($tag->name) - ->add_action("admin/tags/rename/$id") + ->action("admin/tags/rename/$id") ->render(); } } @@ -83,15 +83,15 @@ class Admin_Tags_Controller extends Admin_Controller { kohana::show_404(); } - $inplaceedit = InPlaceEdit::factory($tag->name) - ->add_action("admin/tags/rename/$tag->id") - ->add_rules(array("required", "length[1,64]")) - ->add_messages(array("in_use" => t("There is already a tag with that name"))) - ->add_callback(array($this, "check_for_duplicate")); + $in_place_edit = InPlaceEdit::factory($tag->name) + ->action("admin/tags/rename/$tag->id") + ->rules(array("required", "length[1,64]")) + ->messages(array("in_use" => t("There is already a tag with that name"))) + ->callback(array($this, "check_for_duplicate")); - if ($inplaceedit->validate()) { + if ($in_place_edit->validate()) { $old_name = $tag->name; - $tag->name = $inplaceedit->value(); + $tag->name = $in_place_edit->value(); $tag->save(); $message = t("Renamed tag %old_name to %new_name", @@ -101,7 +101,7 @@ class Admin_Tags_Controller extends Admin_Controller { print json_encode(array("result" => "success")); } else { - print json_encode(array("result" => "error", "form" => $inplaceedit->render())); + print json_encode(array("result" => "error", "form" => $in_place_edit->render())); } } diff --git a/modules/tag/css/tag.css b/modules/tag/css/tag.css index 03ed444b..6d6438e3 100644 --- a/modules/tag/css/tag.css +++ b/modules/tag/css/tag.css @@ -91,6 +91,6 @@ padding: .1em 0 .2em 0; } -#g-rename-tag-form ul { +#g-tag-admin form ul { margin-bottom: 0; -}
\ No newline at end of file +} diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css index 8d49a389..3342bd83 100644 --- a/themes/admin_wind/css/screen.css +++ b/themes/admin_wind/css/screen.css @@ -88,10 +88,18 @@ a:hover, /* Forms ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +fieldset { + margin-bottom: 1em; +} + #g-dialog form { width: 270px; } +#g-dialog fieldset { + margin-bottom: 0; +} + /* Tables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ table { @@ -374,8 +382,8 @@ th { padding: .3em .8em; } -/* In-line editting ~~~~~~~~~~~~~~~~~~~~~ */ -#g-inplace-edit-message { +/* In-line editing ~~~~~~~~~~~~~~~~~~~~~~ */ +#g-in-place-edit-message { background-color: #FFF; } diff --git a/themes/night_wind/css/screen.css b/themes/night_wind/css/screen.css index 2286b26e..cd1824d1 100644 --- a/themes/night_wind/css/screen.css +++ b/themes/night_wind/css/screen.css @@ -455,8 +455,8 @@ li.g-error select { padding-top: 1em; } -/* In-line editting ~~~~~~~~~~~~~~~~~~~~~ */ -#g-inplace-edit-message { +/* In-line editing ~~~~~~~~~~~~~~~~~~~~~~ */ +#g-in-place-edit-message { background-color: #FFF; } diff --git a/themes/wind/css/screen.css b/themes/wind/css/screen.css index 8c466bd8..74771e07 100644 --- a/themes/wind/css/screen.css +++ b/themes/wind/css/screen.css @@ -299,8 +299,8 @@ td { padding-top: 1em; } -/* In-line editting ~~~~~~~~~~~~~~~~~~~~~ */ -#g-inplace-edit-message { +/* In-line editing ~~~~~~~~~~~~~~~~~~~~~~ */ +#g-in-place-edit-message { background-color: #FFF; } |