summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Kieffer <chad@2tbsp.com>2009-03-31 05:14:40 +0000
committerChad Kieffer <chad@2tbsp.com>2009-03-31 05:14:40 +0000
commita57d0d93a8c741e64ac18bbb36aad4164569f266 (patch)
treeada30e528c19bbe80d3097d3437846a479f7d4a5
parent9f04fef3e046d7b4778ddf449589c9b1a3a67857 (diff)
Add quick edit pane to resize images, ticket #189
-rw-r--r--core/helpers/core_theme.php16
-rw-r--r--core/js/quick.js8
-rw-r--r--core/libraries/Theme_View.php2
-rw-r--r--core/views/quick_pane.html.php10
-rw-r--r--themes/default/css/screen.css4
-rw-r--r--themes/default/views/photo.html.php7
6 files changed, 36 insertions, 11 deletions
diff --git a/core/helpers/core_theme.php b/core/helpers/core_theme.php
index fbb8aef3..03018d48 100644
--- a/core/helpers/core_theme.php
+++ b/core/helpers/core_theme.php
@@ -25,7 +25,8 @@ class core_theme_Core {
$buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
url::file("core/css/debug.css") . "\" />";
}
- if ($theme->page_type == "album" && access::can("edit", $theme->item())) {
+ if (($theme->page_type == "album" || $theme->page_type == "photo")
+ && access::can("edit", $theme->item())) {
$buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
url::file("core/css/quick.css") . "\" />";
$buf .= html::script("core/js/quick.js");
@@ -51,6 +52,19 @@ class core_theme_Core {
return $buf;
}
+ static function resize_top($theme, $item) {
+ if (access::can("edit", $item)) {
+ $edit_link = url::site("quick/pane/$item->id");
+ return "<div class=\"gQuick\" href=\"$edit_link\">";
+ }
+ }
+
+ static function resize_bottom($theme, $item) {
+ if (access::can("edit", $item)) {
+ return "</div>";
+ }
+ }
+
static function thumb_top($theme, $child) {
if (access::can("edit", $child)) {
$edit_link = url::site("quick/pane/$child->id");
diff --git a/core/js/quick.js b/core/js/quick.js
index bfef0d65..15297c03 100644
--- a/core/js/quick.js
+++ b/core/js/quick.js
@@ -3,8 +3,8 @@ $(document).ready(function() {
// @todo Add quick edit pane for album (meta, move, permissions, delete)
$(".gItem").hover(show_quick, function() {});
}
- if ($("#gItem").length) {
- // @todo Apply quick edit to resize view
+ if ($("#gPhoto").length) {
+ $("#gPhoto").hover(show_quick, function() {});
}
});
@@ -19,8 +19,9 @@ var show_quick = function() {
"position": "absolute",
"top": pos.top,
"left": pos.left,
+ "text-align": "center",
"width": cont.innerWidth() + 1,
- "height": 32
+ "height": "auto"
}).hide();
cont.hover(function() {}, hide_quick);
$.get(
@@ -28,7 +29,6 @@ var show_quick = function() {
{},
function(data, textStatus) {
$("#gQuickPane").html(data).slideDown("fast");
- // @todo Move hover to a function
$(".ui-state-default").hover(
function(){
$(this).addClass("ui-state-hover");
diff --git a/core/libraries/Theme_View.php b/core/libraries/Theme_View.php
index bcd1604f..e28df958 100644
--- a/core/libraries/Theme_View.php
+++ b/core/libraries/Theme_View.php
@@ -176,6 +176,8 @@ class Theme_View_Core extends View {
case "photo_blocks":
case "photo_bottom":
case "photo_top":
+ case "resize_bottom":
+ case "resize_top":
case "sidebar_blocks":
case "sidebar_bottom":
case "sidebar_top":
diff --git a/core/views/quick_pane.html.php b/core/views/quick_pane.html.php
index d6f097d4..9bdff325 100644
--- a/core/views/quick_pane.html.php
+++ b/core/views/quick_pane.html.php
@@ -1,5 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<? if ($item->type == "photo"): ?>
+<? if ($item->type == "photo" || $item->type == "resize"): ?>
<? $title = t("Edit this photo") ?>
<? elseif ($item->type == "movie"): ?>
<? $title = t("Edit this movie") ?>
@@ -13,7 +13,7 @@
</span>
</a>
-<? if ($item->is_photo() && graphics::can("rotate")): ?>
+<? if (($item->is_photo() || $item->type == "resize") && graphics::can("rotate")): ?>
<a class="gButtonLink ui-corner-all ui-state-default" href="<?= url::site("quick/rotate/$item->id/ccw?csrf=$csrf") ?>"
title="<?= t("Rotate 90 degrees counter clockwise") ?>">
<span class="ui-icon ui-icon-rotate-ccw">
@@ -29,7 +29,7 @@
</a>
<? endif ?>
-<? if ($item->type == "photo"): ?>
+<? if ($item->type == "photo" || $item->type == "resize"): ?>
<? $title = t("Move this photo to another album") ?>
<? elseif ($item->type == "movie"): ?>
<? $title = t("Move this movie to another album") ?>
@@ -44,7 +44,7 @@
</a>
<? if (access::can("edit", $item->parent())): ?>
-<? if ($item->type == "photo"): ?>
+<? if ($item->type == "photo" || $item->type == "resize"): ?>
<? $title = t("Choose this photo as the album cover") ?>
<? elseif ($item->type == "movie"): ?>
<? $title = t("Choose this movie as the album cover") ?>
@@ -58,7 +58,7 @@
</span>
</a>
-<? if ($item->type == "photo"): ?>
+<? if ($item->type == "photo" || $item->type == "resize"): ?>
<? $title = t("Delete this photo") ?>
<? elseif ($item->type == "movie"): ?>
<? $title = t("Delete this movie") ?>
diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css
index 5ea424cc..bc6cf13e 100644
--- a/themes/default/css/screen.css
+++ b/themes/default/css/screen.css
@@ -478,6 +478,10 @@ form .gError,
width: 99%;
}
+#gContent #gPhoto {
+
+}
+
#gContent #gItem .gFullSizeLink img {
display: block;
margin: 1em auto !important;
diff --git a/themes/default/views/photo.html.php b/themes/default/views/photo.html.php
index 25eae327..7f830f13 100644
--- a/themes/default/views/photo.html.php
+++ b/themes/default/views/photo.html.php
@@ -24,7 +24,12 @@
</li>
</ul>
- <a href="#" class="gFullSizeLink" title="<?= t("View full size") ?>"><?= $item->resize_tag(array("id" => "gPhotoId-{$item->id}")) ?></a>
+ <div id="gPhoto">
+ <?= $theme->resize_top($item) ?>
+ <a href="#" class="gFullSizeLink" title="<?= t("View full size") ?>">
+ <?= $item->resize_tag(array("id" => "gPhotoId-{$item->id}")) ?></a>
+ <?= $theme->resize_bottom($item) ?>
+ </div>
<div id="gInfo">
<h1><?= $item->title ?></h1>