summaryrefslogtreecommitdiffstats
path: root/extensions/BMO
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-01-28 17:20:19 +0100
committerDavid Lawrence <dkl@mozilla.com>2015-01-28 17:20:19 +0100
commit5cc88fd55c94b5dc9a310ad5c5d87942d4154d3d (patch)
tree9f83dda8c781cf919a14f7a2c26e08bbea55a721 /extensions/BMO
parenta496214a165549c36ac4a65dfc00d963d3902e9e (diff)
downloadbugzilla-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 'extensions/BMO')
-rw-r--r--extensions/BMO/template/en/default/hook/global/header-start.html.tmpl12
-rw-r--r--extensions/BMO/web/js/edituser_menu.js71
2 files changed, 53 insertions, 30 deletions
diff --git a/extensions/BMO/template/en/default/hook/global/header-start.html.tmpl b/extensions/BMO/template/en/default/hook/global/header-start.html.tmpl
index 2b2642148..0243345bb 100644
--- a/extensions/BMO/template/en/default/hook/global/header-start.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/global/header-start.html.tmpl
@@ -1,3 +1,11 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
[% IF !javascript_urls %]
[% javascript_urls = [] %]
[% END %]
@@ -35,7 +43,7 @@
[%# BMO - add user context menu %]
[% IF user.id %]
- [% yui.push('container', 'menu') %]
- [% style_urls.push('js/yui/assets/skins/sam/menu.css') %]
+ [% jquery.push('contextMenu') %]
+ [% style_urls.push('js/jquery/plugins/contextMenu/contextMenu.css') %]
[% javascript_urls.push('extensions/BMO/web/js/edituser_menu.js') %]
[% END %]
diff --git a/extensions/BMO/web/js/edituser_menu.js b/extensions/BMO/web/js/edituser_menu.js
index 383418430..85d933220 100644
--- a/extensions/BMO/web/js/edituser_menu.js
+++ b/extensions/BMO/web/js/edituser_menu.js
@@ -1,33 +1,48 @@
-var usermenu_widget;
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This Source Code Form is "Incompatible With Secondary Licenses", as
+ * defined by the Mozilla Public License, v. 2.0. */
-YAHOO.util.Event.onDOMReady(function() {
- usermenu_widget = new YAHOO.widget.Menu('usermenu_widget', { position : 'dynamic' });
- usermenu_widget.addItems([
- { text: 'Profile', url: '#', target: '_blank' },
- { text: 'Activity', url: '#', target: '_blank' },
- { text: 'Mail', url: '#', target: '_blank' },
- { text: 'Edit', url: '#', target: '_blank' }
- ]);
- usermenu_widget.render(document.body);
-});
-
-function show_usermenu(event, id, email, show_edit) {
- if (!usermenu_widget)
- return true;
- if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey)
- return true;
- usermenu_widget.getItem(0).cfg.setProperty('url',
- 'user_profile?login=' + encodeURIComponent(email));
- usermenu_widget.getItem(1).cfg.setProperty('url',
- 'page.cgi?id=user_activity.html&action=run&from=-14d&who=' + encodeURIComponent(email));
- usermenu_widget.getItem(2).cfg.setProperty('url', 'mailto:' + encodeURIComponent(email));
+function show_usermenu(id, email, show_edit) {
+ var items = {
+ profile: {
+ name: "Profile",
+ callback: function () {
+ var href = "user_profile?login=" + encodeURIComponent(email);
+ window.open(href, "_blank");
+ }
+ },
+ activity: {
+ name: "Activity",
+ callback: function () {
+ var href = "page.cgi?id=user_activity.html&action=run&from=-14d&who="
+ + encodeURIComponent(email);
+ window.open(href, "_blank");
+ }
+ },
+ mail: {
+ name: "Mail",
+ callback: function () {
+ var href = "mailto:" + encodeURIComponent(email);
+ window.open(href, "_blank");
+ }
+ },
+ };
if (show_edit) {
- usermenu_widget.getItem(3).cfg.setProperty('url', 'editusers.cgi?action=edit&userid=' + id);
- } else {
- usermenu_widget.removeItem(3);
+ items.edit = {
+ name: "Edit",
+ callback: function () {
+ var href = "editusers.cgi?action=edit&userid=" + id;
+ window.open(href, "_blank");
+ }
+ };
}
- usermenu_widget.cfg.setProperty('xy', YAHOO.util.Event.getXY(event));
- usermenu_widget.show();
- return false;
+ $.contextMenu({
+ selector: ".vcard_" + id,
+ trigger: "left",
+ items: items
+ });
}