summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-08-06 22:22:24 +0800
committerTim Almdal <tnalmdal@shaw.ca>2009-08-06 22:28:05 +0800
commitb826182b7a7b2d630b478d3e2bcf0628989a92d9 (patch)
treee4fd77f98413b9e5d903ea95568d7f4af1d37b9a
parentf0b3d37d18c19a170dc737dc01e002d26535a9b3 (diff)
Cleanup the javascript for enabling dialog or panel links.
1) We don't need to loop over the elements to bind the event handler. 2) Just include gallery.panel.js for all the admin pages. Signed-off-by: Tim Almdal <tnalmdal@shaw.ca>
-rw-r--r--modules/gallery/helpers/gallery_theme.php1
-rw-r--r--modules/user/helpers/user_theme.php6
-rw-r--r--themes/admin_default/js/ui.init.js12
-rw-r--r--themes/default/js/ui.init.js5
4 files changed, 5 insertions, 19 deletions
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index d3751b80..903827cc 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -78,6 +78,7 @@ class gallery_theme_Core {
}
static function admin_head($theme) {
+ $theme->script("gallery.panel.js");
$session = Session::instance();
if ($session->get("debug")) {
$theme->css("debug.css");
diff --git a/modules/user/helpers/user_theme.php b/modules/user/helpers/user_theme.php
index c5351f8e..69042aed 100644
--- a/modules/user/helpers/user_theme.php
+++ b/modules/user/helpers/user_theme.php
@@ -23,10 +23,4 @@ class user_theme_Core {
$view->user = user::active();
return $view->render();
}
-
- static function admin_head($theme) {
- if (strpos(Router::$current_uri, "admin/users") !== false) {
- $theme->script("gallery.panel.js");
- }
- }
}
diff --git a/themes/admin_default/js/ui.init.js b/themes/admin_default/js/ui.init.js
index 3f062a27..06cc1cd5 100644
--- a/themes/admin_default/js/ui.init.js
+++ b/themes/admin_default/js/ui.init.js
@@ -1,5 +1,5 @@
$(document).ready(function(){
-
+
// Initialize Superfish menus
$("#gSiteAdminMenu ul.gMenu").addClass("sf-menu");
$("ul.gMenu").addClass("sf-menu");
@@ -18,16 +18,10 @@ $(document).ready(function(){
$("#gMessage li").showMessage();
// Initialize modal dialogs
- var dialogLinks = $(".gDialogLink");
- for (var i=0; i < dialogLinks.length; i++) {
- $(dialogLinks[i]).bind("click", handleDialogEvent);
- }
+ $(".gDialogLink").bind("click", handleDialogEvent);
// Initialize panels
- var panelLinks = $(".gPanelLink");
- for (i=0; i<panelLinks.length; i++) {
- $(panelLinks[i]).bind("click", handlePanelEvent);
- }
+ $(".gPanelLink").bind("click", handlePanelEvent);
if ($("#gPhotoStream").length) {
// Vertically align thumbs in photostream
diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js
index 11cd06ed..ff76c79c 100644
--- a/themes/default/js/ui.init.js
+++ b/themes/default/js/ui.init.js
@@ -34,10 +34,7 @@ $(document).ready(function() {
// Initialize dialogs
$(".gMenuLink").addClass("gDialogLink");
$("#gLoginLink").addClass("gDialogLink");
- var dialogLinks = $(".gDialogLink");
- for (var i=0; i < dialogLinks.length; i++) {
- $(dialogLinks[i]).bind("click", handleDialogEvent);
- }
+ $(".gDialogLink").bind("click", handleDialogEvent);
// Initialize view menu
if ($("#gViewMenu").length) {