diff options
-rw-r--r-- | core/controllers/quick.php | 11 | ||||
-rw-r--r-- | core/css/quick.css | 13 | ||||
-rw-r--r-- | core/helpers/core_block.php | 4 | ||||
-rw-r--r-- | core/js/quick.js | 48 | ||||
-rw-r--r-- | core/views/quick_edit.html.php | 15 | ||||
-rw-r--r-- | core/views/quick_pane.html.php | 21 | ||||
-rw-r--r-- | lib/gallery.dialog.js | 4 |
7 files changed, 74 insertions, 42 deletions
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 "<div class=\"gQuick\" quick_link=\"$edit_link\">"; + $edit_link = url::site("quick/pane/$child->id"); + return "<div class=\"gQuick\" href=\"$edit_link\">"; } } 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 @@ -<?php defined("SYSPATH") or die("No direct script access.") ?> -<? if ($item->type == "photo"): ?> -<div class="rotate-counter-clockwise" - quick_link="<?= url::site("quick/rotate/$item->id/ccw?csrf=" . access::csrf_token()) ?>"> - <span> - <?= _("Rotate CCW") ?> - </span> -</div> -<div class="rotate-clockwise" - quick_link="<?= url::site("quick/rotate/$item->id/cw?csrf=" . access::csrf_token()) ?>"> - <span> - <?= _("Rotate CCW") ?> - </span> -</div> -<? endif ?> 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 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<? if ($item->type == "photo"): ?> +<div class="rotate-counter-clockwise" + href="<?= url::site("quick/rotate/$item->id/ccw?csrf=" . access::csrf_token()) ?>"> + <span> + <?= _("Rotate CCW") ?> + </span> +</div> +<div class="edit gDialogLink" + href="<?= url::site("quick/form_edit/$item->id") ?>"> + <span> + <?= _("Edit") ?> + </span> +</div> +<div class="rotate-clockwise" + href="<?= url::site("quick/rotate/$item->id/cw?csrf=" . access::csrf_token()) ?>"> + <span> + <?= _("Rotate CCW") ?> + </span> +</div> +<? endif ?> diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index 0da04757..c91c07b7 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -36,7 +36,9 @@ function openDialog(element) { } if (data.result == "success") { $("#gDialog").dialog("close"); - if (data.location) { + if (data.reload) { + window.location.reload(); + } else if (data.location) { window.location = data.location; } else { window.location.reload(); |