mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 03:19:13 -04:00
Merge branch 'master' into talmdal_dev
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
/* In-place edit ~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
#g-inplace-edit-form ul {
|
||||
#g-in-place-edit-form ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 ?>
|
||||
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,6 @@
|
||||
padding: .1em 0 .2em 0;
|
||||
}
|
||||
|
||||
#g-rename-tag-form ul {
|
||||
#g-tag-admin form ul {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user