From 5cc88fd55c94b5dc9a310ad5c5d87942d4154d3d Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 28 Jan 2015 16:20:19 +0000 Subject: Bug 1100382: backport upstream bug 1090727 to bmo/4.2 to support jquery in the global/header template, and update the header and footer to use jquery --- template/en/default/global/header.html.tmpl | 128 +++++++++++++++++----------- template/en/default/global/user.html.tmpl | 4 +- 2 files changed, 82 insertions(+), 50 deletions(-) (limited to 'template/en/default/global') diff --git a/template/en/default/global/header.html.tmpl b/template/en/default/global/header.html.tmpl index 04b0ee179..4ea41ebbd 100644 --- a/template/en/default/global/header.html.tmpl +++ b/template/en/default/global/header.html.tmpl @@ -47,39 +47,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", ] %] +[% style_urls.import(jquery_css, jq_css_urls) FILTER null %] +[%# 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, @@ -101,13 +122,13 @@ [% END %] -[%# Migration note: contents of the old Param 'headerhtml' would go here %] - [% PROCESS "global/site-navigation.html.tmpl" %] [% PROCESS 'global/setting-descs.none.tmpl' %] - [% 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 %] @@ -137,9 +158,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') %] @@ -149,27 +177,28 @@