summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-05-14 16:55:15 -0700
committerBharat Mediratta <bharat@menalto.com>2010-05-14 16:55:15 -0700
commit1240878df0f4a2b0ad0cdb32814717038ff2773f (patch)
tree7cf95c440d91c2a6db28b2221ad0b063599dc8c4
parentdc4fdca2ab1160e6fea1d51694a7b66ae18ef5e9 (diff)
Fix-ups for d98b85f7d3142676e6b4f407a18ed81564823f88
- Pass the CSS selector of the active image in as an arg to site_menu so that quick operations know what they're operating on. - Change the ids from g-{photo,movie}-id to the generic g-item-id - Initialize ajax handlers for site menu on the photo and movie page - Drop the movie context menu, it's now in the site menu
-rw-r--r--modules/gallery/helpers/gallery_event.php9
-rw-r--r--modules/gallery/libraries/Theme_View.php4
-rw-r--r--modules/gallery/models/item.php2
-rw-r--r--themes/wind/js/ui.init.js3
-rw-r--r--themes/wind/views/movie.html.php3
-rw-r--r--themes/wind/views/page.html.php2
-rw-r--r--themes/wind/views/photo.html.php2
7 files changed, 15 insertions, 10 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 9b3aa82d..89ad6a4c 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -167,7 +167,7 @@ class gallery_event_Core {
}
}
- static function site_menu($menu, $theme) {
+ static function site_menu($menu, $theme, $item_css_selector) {
if ($theme->page_subtype != "login") {
$menu->append(Menu::factory("link")
->id("home")
@@ -239,6 +239,9 @@ class gallery_event_Core {
}
}
+ $csrf = access::csrf_token();
+ $theme_item = $theme->item();
+ $page_type = $theme->page_type();
if ($item->is_photo() && graphics::can("rotate")) {
$options_menu
->append(
@@ -247,7 +250,7 @@ class gallery_event_Core {
->label(t("Rotate 90° counter clockwise"))
->css_class("ui-icon-rotate-ccw")
->ajax_handler("function(data) { " .
- "\$.gallery_replace_image(data, \$('$thumb_css_selector')) }")
+ "\$.gallery_replace_image(data, \$('$item_css_selector')) }")
->url(url::site("quick/rotate/$item->id/ccw?csrf=$csrf&amp;from_id=$theme_item->id&amp;page_type=$page_type")))
->append(
Menu::factory("ajax_link")
@@ -255,7 +258,7 @@ class gallery_event_Core {
->label(t("Rotate 90° clockwise"))
->css_class("ui-icon-rotate-cw")
->ajax_handler("function(data) { " .
- "\$.gallery_replace_image(data, \$('$thumb_css_selector')) }")
+ "\$.gallery_replace_image(data, \$('$item_css_selector')) }")
->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&amp;from_id=$theme_item->id&amp;page_type=$page_type")));
}
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index 8b432fb6..6246c6f1 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -86,9 +86,9 @@ class Theme_View_Core extends Gallery_View {
return $menu->render();
}
- public function site_menu() {
+ public function site_menu($item_css_selector) {
$menu = Menu::factory("root");
- module::event("site_menu", $menu, $this);
+ module::event("site_menu", $menu, $this, $item_css_selector);
return $menu->render();
}
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 7fc37325..409ed3cc 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -674,7 +674,7 @@ class Item_Model extends ORM_MPTT {
$v->attrs = array_merge($extra_attrs,
array("style" => "display:block;width:{$this->width}px;height:{$this->height}px"));
if (empty($v->attrs["id"])) {
- $v->attrs["id"] = "g-movie-id-{$this->id}";
+ $v->attrs["id"] = "g-item-id-{$this->id}";
}
return $v;
}
diff --git a/themes/wind/js/ui.init.js b/themes/wind/js/ui.init.js
index 6edf6be4..53b58516 100644
--- a/themes/wind/js/ui.init.js
+++ b/themes/wind/js/ui.init.js
@@ -108,6 +108,9 @@ $(document).ready(function() {
duration: 1000,
hash: true
});
+
+ $(this).find(".g-dialog-link").gallery_dialog();
+ $(this).find(".g-ajax-link").gallery_ajax();
}
// Initialize button hover effect
diff --git a/themes/wind/views/movie.html.php b/themes/wind/views/movie.html.php
index 27c293ce..8481c7ce 100644
--- a/themes/wind/views/movie.html.php
+++ b/themes/wind/views/movie.html.php
@@ -5,8 +5,7 @@
<?= $theme->paginator() ?>
<div id="g-movie" class="ui-helper-clearfix">
- <?= $item->movie_img(array("class" => "g-movie", "id" => "g-movie-id-{$item->id}")) ?>
- <?= $theme->context_menu($item, "#g-movie-id-{$item->id}") ?>
+ <?= $item->movie_img(array("class" => "g-movie", "id" => "g-item-id-{$item->id}")) ?>
</div>
<div id="g-info">
diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php
index ebfbf700..4cc949ce 100644
--- a/themes/wind/views/page.html.php
+++ b/themes/wind/views/page.html.php
@@ -89,7 +89,7 @@
<!-- hide the menu and make it visible after the page has loaded, to minimize menu flicker -->
<div id="g-site-menu" style="visibility: hidden">
- <?= $theme->site_menu() ?>
+ <?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
</div>
<script type="text/javascript"> $(document).ready(function() { $("#g-site-menu").css("visibility", "visible"); }) </script>
diff --git a/themes/wind/views/photo.html.php b/themes/wind/views/photo.html.php
index 07952c94..f8b5511c 100644
--- a/themes/wind/views/photo.html.php
+++ b/themes/wind/views/photo.html.php
@@ -22,7 +22,7 @@
<? if (access::can("view_full", $item)): ?>
<a href="<?= $item->file_url() ?>" class="g-fullsize-link" title="<?= t("View full size")->for_html_attr() ?>">
<? endif ?>
- <?= $item->resize_img(array("id" => "g-photo-id-{$item->id}", "class" => "g-resize")) ?>
+ <?= $item->resize_img(array("id" => "g-item-id-{$item->id}", "class" => "g-resize")) ?>
<? if (access::can("view_full", $item)): ?>
</a>
<? endif ?>