Browse Source

Don't load debugging javascript if debugging is off

Chris Han 10 years ago
parent
commit
255cfe4cce
3 changed files with 14 additions and 2 deletions
  1. 4 0
      include/controller/ControllerBase.class.php
  2. 5 2
      js/common.js
  3. 5 0
      templates/main.tpl

+ 4 - 0
include/controller/ControllerBase.class.php

@@ -589,6 +589,10 @@ abstract class GitPHP_ControllerBase
 				}
 			}
 		}
+
+		if ($this->log && $this->log->GetEnabled()) {
+			$this->tpl->assign('debug', true);
+		}
 	}
 
 	/**

+ 5 - 2
js/common.js

@@ -9,8 +9,8 @@
  * @subpackage Javascript
  */
 
-define(["jquery", "modules/getproject", "modules/lang", "modules/tooltip.snapshot", "modules/tooltip.commit", "modules/tooltip.tag", 'modules/loginpopup', 'modernizr', 'modules/debug'],
-	function($, project, lang, tooltipSnapshot, tooltipCommit, tooltipTag, loginpopup) {
+define(["jquery", "module", "modules/getproject", "modules/lang", "modules/tooltip.snapshot", "modules/tooltip.commit", "modules/tooltip.tag", 'modules/loginpopup', 'modernizr'],
+	function($, module, project, lang, tooltipSnapshot, tooltipCommit, tooltipTag, loginpopup) {
 		$(function() {
 			lang($('div.lang_select'));
 			tooltipSnapshot($('a.snapshotTip'));
@@ -23,5 +23,8 @@ define(["jquery", "modules/getproject", "modules/lang", "modules/tooltip.snapsho
       }
       loginpopup('a.loginLink');
 		});
+    if (module.config().debug) {
+      require(['modules/debug']);
+    }
 	}
 );

+ 5 - 0
templates/main.tpl

@@ -62,6 +62,11 @@
 			project: '{$project->GetProject()}'
 		},
 		{/if}
+    {if $debug}
+    'common': {
+      debug: true
+    },
+    {/if}
 		'modules/geturl': {
 			baseurl: '{$baseurl}/'
 		},