From a50e8fd42e682ac115792677104a467445a1c0ad Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 17 Nov 2014 15:09:44 +0000 Subject: Bug 1090727: support jquery in the global/header template, and update the header and footer to use jquery r=glob,a=glob --- template/en/default/global/header.html.tmpl | 126 ++++++++++++++++++---------- 1 file changed, 80 insertions(+), 46 deletions(-) (limited to 'template') diff --git a/template/en/default/global/header.html.tmpl b/template/en/default/global/header.html.tmpl index 852d2c85e..c4c3849ec 100644 --- a/template/en/default/global/header.html.tmpl +++ b/template/en/default/global/header.html.tmpl @@ -32,39 +32,60 @@ onload = "" style_urls = [] yui = [] + yui_css = {} + yui_deps = {} + no_yui = 0 + jquery = [] + jquery_css = [] %] -[% SET yui_css = { - autocomplete => 1, - calendar => 1, - datatable => 1, - button => 1, -} %] - -[%# Note: This is simple dependency resolution--you can't have dependencies - # that depend on each other. You have to specify all of a module's deps, - # if that module is going to be specified in "yui". - #%] -[% SET yui_deps = { - autocomplete => ['json', 'connection', 'datasource'], - datatable => ['json', 'connection', 'datasource', 'element'], -} %] - -[%# When using certain YUI modules, we need to process certain - # extra JS templates. - #%] -[% SET yui_templates = { - datatable => ['global/value-descs.js.tmpl'], -} %] +[% IF NOT no_yui %] + [% SET yui_css = { + autocomplete => 1, + calendar => 1, + datatable => 1, + button => 1, + } %] + + [%# Note: This is simple dependency resolution--you can't have dependencies + # that depend on each other. You have to specify all of a module's deps, + # if that module is going to be specified in "yui". + #%] + [% SET yui_deps = { + autocomplete => ['json', 'connection', 'datasource'], + datatable => ['json', 'connection', 'datasource', 'element'], + } %] + + [%# When using certain YUI modules, we need to process certain + # extra JS templates. + #%] + [% SET yui_templates = { + datatable => ['global/value-descs.js.tmpl'], + } %] +[% END %] [%# These are JS URLs that are *always* on the page and come before # every other JS URL. #%] [% SET starting_js_urls = [ - "js/yui/yahoo-dom-event/yahoo-dom-event.js", - "js/yui/cookie/cookie-min.js", + "js/jquery/jquery-min.js", + "js/jquery/ui/jquery-ui-min.js" +] %] + +[% IF NOT no_yui %] + [% starting_js_urls.push("js/yui/yahoo-dom-event/yahoo-dom-event.js", + "js/yui/cookie/cookie-min.js") %] +[% END %] + +[% SET jq_css_urls = [ + "js/jquery/ui/jquery-ui-min.css", + "js/jquery/ui/jquery-ui-structure-min.css", + "js/jquery/ui/jquery-ui-theme-min.css", ] %] +[% undef = style_urls.import(jquery_css, jq_css_urls) %] +[%# Add jQuery cookie support %] +[% jquery.push("cookie") %] [%# We should be able to set the default value of the header variable # to the value of the title variable using the DEFAULT directive, @@ -85,7 +106,9 @@ [% END %] - [% SET yui = yui_resolve_deps(yui, yui_deps) %] + [% IF NOT no_yui %] + [% SET yui = yui_resolve_deps(yui, yui_deps) %] + [% END %] [% SET css_sets = css_files(style_urls, yui, yui_css) %] [% IF constants.CONCATENATE_ASSETS %] @@ -115,9 +138,16 @@ [% END %] [% END %] - [%# YUI Scripts %] - [% FOREACH yui_name = yui %] - [% starting_js_urls.push("js/yui/$yui_name/${yui_name}-min.js") %] + [% IF NOT no_yui %] + [%# YUI Scripts %] + [% FOREACH yui_name = yui %] + [% starting_js_urls.push("js/yui/$yui_name/${yui_name}-min.js") %] + [% END %] + [% END %] + + [%# jQuery Plugins %] + [% FOREACH jq_name = jquery %] + [% starting_js_urls.push("js/jquery/plugins/$jq_name/${jq_name}-min.js") %] [% END %] [% starting_js_urls.push('js/global.js') %] @@ -127,27 +157,28 @@