mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-29 11:10:37 -04:00
Quick edit now lets you set the album cover.
This commit is contained in:
@@ -72,6 +72,22 @@ class Quick_Controller extends Controller {
|
||||
"height" => $item->thumb_height));
|
||||
}
|
||||
|
||||
public function make_album_cover($id) {
|
||||
access::verify_csrf();
|
||||
$item = ORM::factory("item", $id);
|
||||
access::required("edit", $item);
|
||||
|
||||
$parent = $item->parent();
|
||||
access::required("edit", $parent);
|
||||
|
||||
$parent->album_cover_item_id = $item->id;
|
||||
$parent->thumb_dirty = 1;
|
||||
$parent->save();
|
||||
graphics::generate($parent);
|
||||
|
||||
print json_encode(array("result" => "success"));
|
||||
}
|
||||
|
||||
public function form_edit($id) {
|
||||
$item = ORM::factory("item", $id);
|
||||
access::required("edit", $item);
|
||||
|
||||
+12
-10
@@ -48,16 +48,18 @@ var quick_do = function(cont, pane, img) {
|
||||
url: pane.attr("href"),
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
img.css("opacity", "1");
|
||||
img.attr("width", data.width);
|
||||
img.attr("height", data.height);
|
||||
img.attr("src", data.src);
|
||||
if (data.height > data.width) {
|
||||
img.css("margin-top", -32);
|
||||
} else {
|
||||
img.css("margin-top", 0);
|
||||
}
|
||||
cont.removeClass("gLoadingLarge");
|
||||
img.css("opacity", "1");
|
||||
if (data.src) {
|
||||
img.attr("width", data.width);
|
||||
img.attr("height", data.height);
|
||||
img.attr("src", data.src);
|
||||
if (data.height > data.width) {
|
||||
img.css("margin-top", -32);
|
||||
} else {
|
||||
img.css("margin-top", 0);
|
||||
}
|
||||
}
|
||||
cont.removeClass("gLoadingLarge");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<? if ($item->type == "photo"): ?>
|
||||
<a class="cover" href="#"
|
||||
<? if ($item->type == "photo" && access::can("edit", $item->parent())): ?>
|
||||
<a class="cover" href="<?= url::site("quick/make_album_cover/$item->id?csrf=" . access::csrf_token()) ?>"
|
||||
title="<?= t("Select as album cover") ?>">
|
||||
<span>
|
||||
<?= t("Select as album cover") ?>
|
||||
|
||||
Reference in New Issue
Block a user