diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-08-04 18:24:15 +0200 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-08-04 18:24:15 +0200 |
commit | f44392e8cdbea85ac308b2472f813ee605ebae4b (patch) | |
tree | 6e7adaf99a0e5a43eb1bf5a0d673d86b60f34f99 /extensions/BugModal/web | |
parent | 5be3a7fd0061aa0bc3059e09079741873b9b833f (diff) | |
parent | 4528b21bc922f8b1e0ba8581d230a492aa43c9cf (diff) | |
download | bugzilla-f44392e8cdbea85ac308b2472f813ee605ebae4b.tar.gz bugzilla-f44392e8cdbea85ac308b2472f813ee605ebae4b.tar.xz |
Merge branch 'mojo-poc'
Diffstat (limited to 'extensions/BugModal/web')
-rw-r--r-- | extensions/BugModal/web/bug_modal.css | 52 | ||||
-rw-r--r-- | extensions/BugModal/web/bug_modal.js | 80 |
2 files changed, 36 insertions, 96 deletions
diff --git a/extensions/BugModal/web/bug_modal.css b/extensions/BugModal/web/bug_modal.css index a8c469ad6..ee50c6b77 100644 --- a/extensions/BugModal/web/bug_modal.css +++ b/extensions/BugModal/web/bug_modal.css @@ -44,26 +44,6 @@ button.major { padding: 4px 12px; } -button.minor { - background-color: #eee; - background-image: linear-gradient(#fcfcfc, #eee); - color: #000; - font-size: inherit; - font-weight: 500; - padding: 4px 8px; - margin-bottom: 1px; - text-shadow: none; - -web-kit-box-shadow: 0 1px 0 0 rgba(0,0,0,0.1), inset 0 -1px 0 0 rgba(0,0,0,0.1); - -moz-box-shadow: 0 1px 0 0 rgba(0,0,0,0.1), inset 0 -1px 0 0 rgba(0,0,0,0.1); - box-shadow: 0 1px 0 0 rgba(0,0,0,0.1), inset 0 -1px 0 0 rgba(0,0,0,0.1), inset 0 0 1px 0 rgba(0,0,0,0.1); -} - -button.minor:hover { - -webkit-box-shadow: 0 1px 0 0 rgba(0,0,0,0.2), inset 0 -1px 0 0 rgba(0,0,0,0.3), inset 0 12px 24px 2px #ddd; - -moz-box-shadow: 0 1px 0 0 rgba(0,0,0,0.2), inset 0 -1px 0 0 rgba(0,0,0,0.3), inset 0 12px 24px 2px #ddd; - box-shadow: 0 1px 0 0 rgba(0,0,0,0.1), inset 0 -1px 0 0 rgba(0,0,0,0.1), inset 0 12px 24px 2px #ddd; -} - select[multiple], .text_input, .yui-ac-input, input { font-size: 12px !important; } @@ -329,16 +309,6 @@ input[type="number"] { margin-bottom: 50px; } -#product-info, #component-info { - color: #484; - white-space: normal; -} - -#product-latch, #component-latch { - padding-right: 0; - cursor: pointer; -} - #cc-latch { color: #999; } @@ -968,6 +938,28 @@ div.ui-tooltip { right: 8px; } +/* product/component popup */ + +.name-info-popup { + width: 320px; +} + +.name-info-popup header { + margin: 8px 16px; +} + +.name-info-popup header .title { + margin: 0 0 4px; + font-size: 16px; +} + +.name-info-popup header .description { + font-size: 12px; + line-height: 150%; + white-space: normal; + color: #666; +} + /* product search */ #field-product { diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index 4a770e66c..a4ae83d72 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -339,10 +339,6 @@ $(function() { // copy summary to clipboard - function clipboardSummary() { - return 'Bug ' + BUGZILLA.bug_id + ' - ' + $('#field-value-short_desc').text(); - } - if ($('#copy-summary').length) { var hasExecCopy = false; try { @@ -352,11 +348,24 @@ $(function() { } if (hasExecCopy) { + const url = BUGZILLA.bug_url; + const text = `Bug ${BUGZILLA.bug_id} - ${BUGZILLA.bug_summary}`; + const html = `<a href="${url}">${text}</a>`; + + document.addEventListener('copy', event => { + if (event.target.nodeType === 1 && event.target.matches('#clip')) { + event.clipboardData.setData('text/uri-list', url); + event.clipboardData.setData('text/plain', text); + event.clipboardData.setData('text/html', html); + event.preventDefault(); + } + }); + $('#copy-summary') .click(function() { // execCommand("copy") only works on selected text $('#clip-container').show(); - $('#clip').val(clipboardSummary()).select(); + $('#clip').val(text).select(); $('#floating-message-text') .text(document.execCommand("copy") ? 'Bug summary copied!' : 'Couldn’t copy bug summary'); $('#floating-message').fadeIn(250).delay(2500).fadeOut(); @@ -377,27 +386,6 @@ $(function() { lb_show(this); }); - // when copying the bug id and summary, reformat to remove \n and alias - $(document).on( - 'copy', function(event) { - var selection = document.getSelection().toString().trim(); - var match = selection.match(/^(Bug \d+)\s*\n(.+)$/) || - selection.match(/^(Bug \d+)\s+\([^\)]+\)\s*\n(.+)$/); - if (match) { - var content = match[1] + ' - ' + match[2].trim(); - if (event.originalEvent.clipboardData) { - event.originalEvent.clipboardData.setData('text/plain', content); - } - else if (window.clipboardData) { - window.clipboardData.setData('Text', content); - } - else { - return; - } - event.preventDefault(); - } - }); - // action button actions // reset @@ -1446,46 +1434,6 @@ if (history && history.replaceState) { } } -// ajax wrapper, to simplify error handling and auth -function bugzilla_ajax(request, done_fn, error_fn) { - $('#xhr-error').hide(''); - $('#xhr-error').html(''); - request.url += (request.url.match('\\?') ? '&' : '?') + - 'Bugzilla_api_token=' + encodeURIComponent(BUGZILLA.api_token); - if (request.type != 'GET') { - request.contentType = 'application/json'; - request.processData = false; - if (request.data && request.data.constructor === Object) { - request.data = JSON.stringify(request.data); - } - } - return $.ajax(request) - .done(function(data) { - if (data.error) { - if (!request.hideError) { - $('#xhr-error').html(data.message); - $('#xhr-error').show('fast'); - } - if (error_fn) - error_fn(data.message); - } - else if (done_fn) { - done_fn(data); - } - }) - .fail(function(data) { - if (data.statusText === 'abort') - return; - var message = data.responseJSON ? data.responseJSON.message : 'Unexpected Error'; // all errors are unexpected :) - if (!request.hideError) { - $('#xhr-error').html(message); - $('#xhr-error').show('fast'); - } - if (error_fn) - error_fn(message); - }); -} - // lightbox function lb_show(el) { |