Closed Bug 1150448 Opened 5 years ago Closed 5 years ago

Replace the newline with " - " when the bug's id and summary are copied

Categories

(bugzilla.mozilla.org :: User Interface, defect)

Production
x86
Linux
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: gerv, Unassigned)

Details

Attachments

(1 file)

The default format has the header as:

Bug 1096798 - prototype modal show_bug view

which is very handy for copying and pasting directly into checkin messages (or onto command-line instructions for creating them). The modal format has the header as:

Bug 1096798
prototype modal show_bug view

...which is not so handy. Both the missing hyphen (a colon would also do) and the extra newline are problematic. Not sure if there's a way to fix this while exactly retaining the current styling, but it was a very useful capability.

Gerv
use the "copy summary" button, which does exactly what you describe.
unfortunately this requires flash.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
Our solution to this is Flash? Really? 3 cheers for "the web is the platform"...

Surely we can do something with CSS instead. Are you adamant that the bug number and the summary must be on different lines?

Gerv
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Apparently this is possible in JS during a clipboard copy event:
http://stackoverflow.com/a/27281043
So I suggest we add a copy listener, and if the contents start with "Bug NNNNN<newline>First-word-of-summary" then we simply change the first bit, replacing the newline with ": ".

Gerv
> Our solution to this is Flash? Really? 3 cheers for "the web is the platform"... 

it's a shame the web doesn't have clipboard management outside of trapping copy events.

> Apparently this is possible in JS during a clipboard copy event:
> http://stackoverflow.com/a/27281043
> So I suggest we add a copy listener, and if the contents start with "Bug
> NNNNN<newline>First-word-of-summary" then we simply change the first bit,
> replacing the newline with ": ".

ah, that looks promising, thanks for finding that.

i'll play around.
Assignee: nobody → glob
Status: REOPENED → ASSIGNED
Summary: No longer possible to easily copy and paste bug number and subject together, without newlines → Replace the newline with : when the bug's id and summary are copied
tricker than it sounds.  browsers, firefox in particular, are very protective about the clipboard and provide very limited access to it, so you can't read the contents of the clipboard in order to alter it.

however you _can_ get the selected text from the page, which is good enough for this to work.
i have a functional patch for firefox, just need to test in other browsers.
Summary: Replace the newline with : when the bug's id and summary are copied → Replace the newline with " - " when the bug's id and summary are copied
Attached patch 1150448_1.patchSplinter Review
- change \n to - and remove the (alias) when copying the bug and summary
- works in ie and modern browsers
Attachment #8589486 - Flags: review?(gerv)
Comment on attachment 8589486 [details] [diff] [review]
1150448_1.patch

Review of attachment 8589486 [details] [diff] [review]:
-----------------------------------------------------------------

r=gerv. :-)

Gerv
Attachment #8589486 - Flags: review?(gerv) → review+
To ssh://gitolite3@git.mozilla.org/webtools/bmo/bugzilla.git
   023ed1b..3eb141e  master -> master
Status: ASSIGNED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
Assignee: glob → nobody
Component: User Interface: Modal → User Interface
You need to log in before you can comment on or make changes to this bug.