Quick edit now lets you set the album cover.

This commit is contained in:
Bharat Mediratta
2009-01-20 08:54:15 +00:00
parent be1f9d6892
commit b9e8ce4190
3 changed files with 30 additions and 12 deletions
+16
View File
@@ -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
View File
@@ -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");
}
});
}
+2 -2
View File
@@ -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") ?>