From 7482b6683eb0cabb9841f839a474d25b4257fc91 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 5 Jan 2009 08:05:50 +0000 Subject: Add "quick edit" which lets you edit a photo's details from the albums page. --- core/controllers/quick.php | 11 ++++++++-- core/css/quick.css | 13 ++++++++++++ core/helpers/core_block.php | 4 ++-- core/js/quick.js | 48 +++++++++++++++++++++++------------------- core/views/quick_edit.html.php | 15 ------------- core/views/quick_pane.html.php | 21 ++++++++++++++++++ 6 files changed, 71 insertions(+), 41 deletions(-) delete mode 100644 core/views/quick_edit.html.php create mode 100644 core/views/quick_pane.html.php (limited to 'core') diff --git a/core/controllers/quick.php b/core/controllers/quick.php index 7267283c..3f3c1f0c 100644 --- a/core/controllers/quick.php +++ b/core/controllers/quick.php @@ -18,14 +18,14 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Quick_Controller extends Controller { - public function edit($id) { + public function pane($id) { $item = ORM::factory("item", $id); if (!$item->loaded) { return ""; } if ($item->type == "photo") { - $view = new View("quick_edit.html"); + $view = new View("quick_pane.html"); $view->item = $item; print $view; } @@ -73,4 +73,11 @@ class Quick_Controller extends Controller { "width" => $item->thumb_width, "height" => $item->thumb_height)); } + + public function form_edit($id) { + $item = ORM::factory("item", $id); + access::required("edit", $item); + $form = photo::get_edit_form($item); + print $form; + } } diff --git a/core/css/quick.css b/core/css/quick.css index ab8c5437..3e9a8843 100644 --- a/core/css/quick.css +++ b/core/css/quick.css @@ -43,3 +43,16 @@ #gQuickPane .rotate-counter-clockwise span { display: none; } + +#gQuickPane .edit { + background: url('../images/image_edit.png'); + width: 16px; + height: 16px; + position: absolute; + top: 0px; + left: 50%; +} + +#gQuickPane .edit span { + display: none; +} diff --git a/core/helpers/core_block.php b/core/helpers/core_block.php index 0976c37a..f4224190 100644 --- a/core/helpers/core_block.php +++ b/core/helpers/core_block.php @@ -35,8 +35,8 @@ class core_block_Core { public static function thumb_top($theme, $child) { if ($child->type == "photo" && access::can("edit", $child)) { - $edit_link = url::site("quick/edit/$child->id"); - return "
"; + $edit_link = url::site("quick/pane/$child->id"); + return "
"; } } diff --git a/core/js/quick.js b/core/js/quick.js index 858ba3f2..7d572174 100644 --- a/core/js/quick.js +++ b/core/js/quick.js @@ -17,7 +17,7 @@ var show_quick = function() { }); quick.hover(function() { }, hide_quick); $.get( - quick.attr("quick_link"), + quick.attr("href"), {}, function(data, textStatus) { $("#gQuickPane").html(data); @@ -30,27 +30,31 @@ var show_quick = function() { var quick_do = function(quick, pane, img) { img.css("opacity", "0.2"); - quick.addClass("gLoadingLarge"); - $.ajax({ - type: "GET", - url: pane.attr("quick_link"), - dataType: "json", - success: function(data) { - img.css("opacity", "1"); - img.attr("width", data.width); - img.attr("height", data.height); - img.attr("src", data.src); - var pos = img.position(); - quick.removeClass("gLoadingLarge"); - $("#gQuickPane").css({ - "position": "absolute", - "top": pos.top, - "left": pos.left, - "width": img.innerWidth() + 1, - "height": 32 - }); - } - }); + if (pane.hasClass("gDialogLink")) { + openDialog(pane); + } else { + quick.addClass("gLoadingLarge"); + $.ajax({ + type: "GET", + 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); + var pos = img.position(); + quick.removeClass("gLoadingLarge"); + $("#gQuickPane").css({ + "position": "absolute", + "top": pos.top, + "left": pos.left, + "width": img.innerWidth() + 1, + "height": 32 + }); + } + }); + } }; var hide_quick = function() { diff --git a/core/views/quick_edit.html.php b/core/views/quick_edit.html.php deleted file mode 100644 index 940c5c2a..00000000 --- a/core/views/quick_edit.html.php +++ /dev/null @@ -1,15 +0,0 @@ - -type == "photo"): ?> -
id/ccw?csrf=" . access::csrf_token()) ?>"> - - - -
-
id/cw?csrf=" . access::csrf_token()) ?>"> - - - -
- diff --git a/core/views/quick_pane.html.php b/core/views/quick_pane.html.php new file mode 100644 index 00000000..88da9d3e --- /dev/null +++ b/core/views/quick_pane.html.php @@ -0,0 +1,21 @@ + +type == "photo"): ?> +
id/ccw?csrf=" . access::csrf_token()) ?>"> + + + +
+ +
id/cw?csrf=" . access::csrf_token()) ?>"> + + + +
+ -- cgit v1.2.3