summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal/web/bug_modal.js
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-06-15 09:24:42 +0200
committerByron Jones <glob@mozilla.com>2015-06-15 09:24:42 +0200
commit35cabc41dfbed750d225fb8be2c4dfa1736e84b6 (patch)
tree30bb64203597e3949ad01f21d9fdf8b6830c5268 /extensions/BugModal/web/bug_modal.js
parenta46479d0c8736db551c003024d0337bd4a68fcab (diff)
downloadbugzilla-35cabc41dfbed750d225fb8be2c4dfa1736e84b6.tar.gz
bugzilla-35cabc41dfbed750d225fb8be2c4dfa1736e84b6.tar.xz
Bug 1173398: reduce the number of visible buttons at the top right of the page
Diffstat (limited to 'extensions/BugModal/web/bug_modal.js')
-rw-r--r--extensions/BugModal/web/bug_modal.js107
1 files changed, 65 insertions, 42 deletions
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js
index 3d565e74f..a0f83803f 100644
--- a/extensions/BugModal/web/bug_modal.js
+++ b/extensions/BugModal/web/bug_modal.js
@@ -65,30 +65,6 @@ $(function() {
$('#editing').val('');
}
- // expand all modules
- $('#expand-all-btn')
- .click(function(event) {
- event.preventDefault();
- var btn = $(event.target);
- var modules;
- if (btn.data('expanded-modules')) {
- modules = btn.data('expanded-modules');
- btn.data('expanded-modules', false);
- modules.each(function() {
- slide_module($(this).parent('.module'));
- });
- btn.text('Expand All');
- }
- else {
- modules = $('.module-content:hidden');
- btn.data('expanded-modules', modules);
- modules.each(function() {
- slide_module($(this).parent('.module'));
- });
- btn.text('Collapse');
- }
- });
-
// expand/colapse module
$('.module-header')
.click(function(event) {
@@ -119,15 +95,6 @@ $(function() {
}
});
- // last comment btn
- $('#last-comment-btn')
- .click(function(event) {
- event.preventDefault();
- var id = $('.comment:last')[0].parentNode.id;
- $.scrollTo($('#' + id));
- window.location.hash = id;
- });
-
// top btn
$('#top-btn')
.click(function(event) {
@@ -241,6 +208,71 @@ $(function() {
}
});
+ // action button menu
+
+ $.contextMenu({
+ selector: '#action-menu-btn',
+ trigger: 'left',
+ items: $.contextMenu.fromMenu($('#action-menu'))
+ });
+
+ // reset
+ $('#action-reset')
+ .click(function(event) {
+ event.preventDefault();
+ var visible = $(this).data('modules');
+ $('.module-content').each(function() {
+ var content = $(this);
+ var moduleID = content.parent('.module').attr('id');
+ var isDefault = $.inArray(moduleID, visible) !== -1;
+ if (content.is(':visible') && !isDefault) {
+ slide_module($('#' + moduleID), 'hide');
+ }
+ else if (content.is(':hidden') && isDefault) {
+ slide_module($('#' + moduleID), 'show');
+ }
+ });
+ })
+ .data('modules', $('.module-content:visible').map(function() {
+ return $(this).parent('.module').attr('id');
+ }));
+
+ // expand all modules
+ $('#action-expand-all')
+ .click(function(event) {
+ event.preventDefault();
+ $('.module-content:hidden').each(function() {
+ slide_module($(this).parent('.module'));
+ });
+ });
+
+ // collapse all modules
+ $('#action-collapse-all')
+ .click(function(event) {
+ event.preventDefault();
+ $('.module-content:visible').each(function() {
+ slide_module($(this).parent('.module'));
+ });
+ });
+
+ // add comment menuitem, scroll the textarea into view
+ $('#action-add-comment')
+ .click(function(event) {
+ event.preventDefault();
+ // focus first to grow the textarea, so we scroll to the correct location
+ $('#comment').focus();
+ $.scrollTo($('#bottom-save-btn'));
+ });
+
+ // last comment menuitem
+ $('#action-last-comment')
+ .click(function(event) {
+ event.preventDefault();
+ var id = $('.comment:last')[0].parentNode.id;
+ $.scrollTo($('#' + id));
+ window.location.hash = id;
+ });
+
//
// anything after this point is only executed for logged in users
//
@@ -464,15 +496,6 @@ $(function() {
window.location.replace($('#this-bug').val());
});
- // top comment button, scroll the textarea into view
- $('.comment-btn')
- .click(function(event) {
- event.preventDefault();
- // focus first to grow the textarea, so we scroll to the correct location
- $('#comment').focus();
- $.scrollTo($('#bottom-save-btn'));
- });
-
// needinfo in people section -> scroll to near-comment ui
$('#needinfo-scroll')
.click(function(event) {