mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-14 02:50:13 -04:00
Merge branch 'master' of github.com:gallery/gallery3
This commit is contained in:
@@ -15,6 +15,13 @@
|
||||
var tag_width = $(target).width();
|
||||
$(self).data("tag_width", tag_width);
|
||||
|
||||
var form = $("#g-inplace-edit-form");
|
||||
if (form.length > 0) {
|
||||
var parent = form.parent();
|
||||
form.remove();
|
||||
parent.children().show();
|
||||
}
|
||||
|
||||
$.get(self.options.form_url.replace("__ID__", $(target).attr('rel')), function(data) {
|
||||
var parent = $(target).parent();
|
||||
parent.children().hide();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user