From b9e8ce4190a2fee59b2b111be1bc485e2cc5eb7f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 20 Jan 2009 08:54:15 +0000 Subject: Quick edit now lets you set the album cover. --- core/controllers/quick.php | 16 ++++++++++++++++ core/js/quick.js | 22 ++++++++++++---------- core/views/quick_pane.html.php | 4 ++-- 3 files changed, 30 insertions(+), 12 deletions(-) (limited to 'core') diff --git a/core/controllers/quick.php b/core/controllers/quick.php index e382a444..44ca32b4 100644 --- a/core/controllers/quick.php +++ b/core/controllers/quick.php @@ -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); diff --git a/core/js/quick.js b/core/js/quick.js index 36b6f250..e662f77f 100644 --- a/core/js/quick.js +++ b/core/js/quick.js @@ -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"); } }); } diff --git a/core/views/quick_pane.html.php b/core/views/quick_pane.html.php index dfae4d15..d3977a39 100644 --- a/core/views/quick_pane.html.php +++ b/core/views/quick_pane.html.php @@ -28,8 +28,8 @@ -type == "photo"): ?> -type == "photo" && access::can("edit", $item->parent())): ?> +id?csrf=" . access::csrf_token()) ?>" title=""> -- cgit v1.2.3