diff options
author | David Lawrence <dkl@mozilla.com> | 2015-01-28 17:20:19 +0100 |
---|---|---|
committer | David Lawrence <dkl@mozilla.com> | 2015-01-28 17:20:19 +0100 |
commit | 5cc88fd55c94b5dc9a310ad5c5d87942d4154d3d (patch) | |
tree | 9f83dda8c781cf919a14f7a2c26e08bbea55a721 /template/en/default/global | |
parent | a496214a165549c36ac4a65dfc00d963d3902e9e (diff) | |
download | bugzilla-5cc88fd55c94b5dc9a310ad5c5d87942d4154d3d.tar.gz bugzilla-5cc88fd55c94b5dc9a310ad5c5d87942d4154d3d.tar.xz |
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
Diffstat (limited to 'template/en/default/global')
-rw-r--r-- | template/en/default/global/header.html.tmpl | 128 | ||||
-rw-r--r-- | template/en/default/global/user.html.tmpl | 4 |
2 files changed, 82 insertions, 50 deletions
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 @@ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> [% 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 @@ <script type="text/javascript"> <!-- - YAHOO.namespace('bugzilla'); - YAHOO.util.Event.addListener = function (el, sType, fn, obj, overrideContext) { - if ( ("onpagehide" in window || YAHOO.env.ua.gecko) && sType === "unload") { sType = "pagehide"; }; - var capture = ((sType == "focusin" || sType == "focusout") && !YAHOO.env.ua.ie) ? true : false; - return this._addListener(el, this._getType(sType), fn, obj, overrideContext, capture); - }; - if ( "onpagehide" in window || YAHOO.env.ua.gecko) { - YAHOO.util.Event._simpleRemove(window, "unload", - YAHOO.util.Event._unload); - } + [% IF NOT no_yui %] + YAHOO.namespace('bugzilla'); + YAHOO.util.Event.addListener = function (el, sType, fn, obj, overrideContext) { + if ( ("onpagehide" in window || YAHOO.env.ua.gecko) && sType === "unload") { sType = "pagehide"; }; + var capture = ((sType == "focusin" || sType == "focusout") && !YAHOO.env.ua.ie) ? true : false; + return this._addListener(el, this._getType(sType), fn, obj, overrideContext, capture); + }; + if ( "onpagehide" in window || YAHOO.env.ua.gecko) { + YAHOO.util.Event._simpleRemove(window, "unload", + YAHOO.util.Event._unload); + } + [% END %] + [%# The language selector needs javascript to set its cookie, # so it is hidden in HTML/CSS by the "bz_default_hidden" class. # If the browser can run javascript, it will then "unhide" # the language selector using the following code. #%] - function unhide_language_selector() { - YAHOO.util.Dom.removeClass( - 'lang_links_container', 'bz_default_hidden' - ); + function unhide_language_selector() { + $('#lang_links_container').removeClass('bz_default_hidden'); } - YAHOO.util.Event.onDOMReady(unhide_language_selector); + $(document).ready(unhide_language_selector); [%# Make some Bugzilla information available to all scripts. # We don't import every parameter and constant because we @@ -199,11 +228,14 @@ } }; - [% FOREACH yui_name = yui %] - [% FOREACH yui_template = yui_templates.$yui_name %] - [% INCLUDE $yui_template %] + [% IF NOT no_yui %] + [% FOREACH yui_name = yui %] + [% FOREACH yui_template = yui_templates.$yui_name %] + [% INCLUDE $yui_template %] + [% END %] [% END %] [% END %] + [% IF javascript %] [% javascript %] [% END %] diff --git a/template/en/default/global/user.html.tmpl b/template/en/default/global/user.html.tmpl index 38c1da113..847643c38 100644 --- a/template/en/default/global/user.html.tmpl +++ b/template/en/default/global/user.html.tmpl @@ -23,11 +23,11 @@ # who: A Bugzilla::User object that we are going to represent. #%] -<span class="vcard"> +<span class="vcard vcard_[% who.id FILTER html %]"> [% FILTER collapse %] [% IF user.id %] <a class="email" href="mailto:[% who.email FILTER html %]" - onclick="return show_usermenu(event, [% who.id FILTER none %], '[% who.email FILTER js %]', + onclick="return show_usermenu([% who.id FILTER none %], '[% who.email FILTER js %]', [% user.in_group('editusers') || user.bless_groups.size > 0 ? "true" : "false" %]);" title="[% who.identity FILTER html %]"> [%- END -%] |