75 Commits

Author SHA1 Message Date
Kasper Nilsson
6cff0e60d6 Fix race between comment saving and reply dialog
In some cases, the reply dialog could be opened before all comment
drafts have been saved, causing the draft to not appear in the dialog.

This change maintains an array corresponding to each draft request and
refers to it before opening the reply dialog. If the array is populated,
a non-blocking alert is shown with the text 'Try again when all comments
have saved.'

Bug: Issue 5369
Change-Id: Ieb73e7d7b4f66daff6cc2278a84c2195b7d0e541
2017-02-07 16:41:50 -08:00
Wyatt Allen
1bc4f2f565 Support jumping to next/previous file with comments via shortcut
Adds keyboard shortcuts to the diff view to navigate to the next or
previous file in the change's file list that has comments in the current
patch range.

Feature: Issue 5235
Change-Id: I1ad39089c1ac227e335093f25b72311f7e98b3f7
2017-01-19 12:18:52 -08:00
Kasper Nilsson
de8dc08d3a Allow for prev/next navigation out of diffbase
If a user in diff view changes the diff range to one that no longer
includes the file that they are on, the Prev/Next links are grayed out
and they are forced to return to the change view to navigate the diff.

This change sets Next to direct to the first file in the list and Prev
to point to the last file in the list.

Bug: Issue 4932
Change-Id: Ifb460c9721bfafbc19afa68253402b9dcd2f2c3e
2017-01-06 15:31:32 -08:00
Becky Siegel
fe99e263f6 Don't wrap prev/next text on diff view
This change prevents the wrapping of prev/next text in the diff view so
that the links are placed consistently on each page.

Bug: Issue 5195
Change-Id: Ic5a2c896858c00e43b8506b227c80458a3b85aed
2017-01-03 11:53:55 -08:00
Viktar Donich
1500fc6000 Merge "Changes to diff view for mobile" 2016-12-20 19:35:32 +00:00
Becky Siegel
a2ea634774 Changes to diff view for mobile
- Hide download link and file web links from patchsets.
- Add a full file path.
- Change next/prev buttons to be arrows on either side of full path
- Change subheader to flex/wrap so that the display mode wraps to the
next line instead of the second patch set item.

Bug: Issue 5114
Change-Id: Iefb8afe9d7e2417f8aa2070e52073708c052fa4f
2016-12-19 14:44:20 -08:00
Wyatt Allen
18406b5b85 Merge "Move diff view defaults to the rest api interface" 2016-12-16 18:33:08 +00:00
Becky Siegel
76ec59681d Move diff view defaults to the rest api interface
Previously, there was logic regarding diff view defaults in both the
diff view and also the file list views.  When the unified view became
the mobile default for the diff view, the file list was forgotten, and
if a user visited a change view first and then a diff view (without
refreshing the page) they wouldn't get defaulted to unified on mobile.

This change fixes the issue and moves the logic for which view type to
display to the rest interface, so that it doesn't have to be implemented
in multiple places.

Bug: Issue 5119
Change-Id: I95bfe1540cc9439bd6d3e3e39d13a5e32962b7fa
2016-12-15 10:37:59 -08:00
Wyatt Allen
b148a81817 Merge "Make file list more useful on mobile" 2016-12-15 18:16:04 +00:00
Becky Siegel
acf455a9b6 Make file list more useful on mobile
Previously, the file path was truncated and often the file name was cut
off completely, which had made it hard to tell what files were actually
changed.  With this change, the text appearing on the file list just
show ellipsis and the file name (ex: '.../filename.txt').

Additionally, for both mobile and larger screens, the full filename
appears (line wrapped if needed) when the file list item is expanded.
This way, if enough content is cut off that it's still not useful, there
is a way to see the path in it's entirety.

Bug: Issue 4609
Change-Id: Ic4aaf45bafbc3c5b31add8f7c43b18c9d2b2913b
2016-12-14 14:46:17 -08:00
Kasper Nilsson
d01ad017e4 Fix improper implementation of getKeyboardEvent
Bug: Issue 5088
Change-Id: Iee82c135230f78f823c25982aaeba1ea6ece1709
2016-12-09 11:00:44 -08:00
Kasper Nilsson
fa4b2fe374 Add check for modifiers in keyboard shortcut handlers
Bug: Issue 5079
Change-Id: I221bfcfc42e14159b5457d7177902b947906f75d
2016-12-09 08:36:59 -08:00
Andrew Bonventre
a289623b51 Don’t cause scrollbar to hide when dropdowns are shown
Bug: Issue 5095
Bug: Issue 4808
Change-Id: I92d0cd0f0217bcef18bb0b7346112a7d6c5b99bf
2016-12-08 09:15:20 -08:00
Kasper Nilsson
1ba850e594 Fix comment copy logic
The addition of formatting in comments broke a variety of things having
to do with the copying logic. This change updates the logic and tests
to reflect the new DOM.

This issue arose because of a lack of integration tests for copying and
selection. That test is coming in a descendant change.

Bug: Issue 4969
Change-Id: I4e1994ab07947506c77b07877a46a9369d666d50
2016-12-02 15:25:27 -08:00
Andrew Bonventre
4d22c7e835 Cleanup: use iron-a11y-keys-behavior for keyboard shortcuts
+ This does not cover on-keydown handlers within elements.
  A follow-up change will account for those.
+ Keyboard shortcuts are disabled within gr-overlay, input,
  and textarea elements.
+ Added tests for new behavior (plus some missing ones covering
  broken behavior).
+ Removed blur hacks used on elements to placate the kb
  shortcuts due to restrictions that have been removed.

Bug: Issue 4198
Change-Id: Ide8009a3bfc340a35a8ec8b9189a85b49c8a95aa
2016-11-17 15:27:59 -08:00
Kasper Nilsson
3ea4311f66 Utilize patch set description in PG
This change adds the patch set description, if it exists, in every patch
set select in the change view and the diff view. Also includes
refactoring of an existing function into a behavior for use in other
files, and removes some unnecessary DOM nodes from the change-view.

http://imgur.com/a/rEhOF

Feature: Issue 4544
Change-Id: Id5f8d2d5750f3f7afc677e16c411327f53487b19
2016-11-11 10:47:37 -08:00
Becky Siegel
6a7085e5ab Make line marker more distinguished
Previously, the line marker was only subtly visible by the highlighted
line number. This change adds a bottom border to the selected line if
the user is using keycodes (j, k, up, down) to more the cursor. When
the escape key is pressed, the distinguished line marker will dissapear.

Feature: Issue 4739
Change-Id: If8c751efc137ef87cfdad1c8bf7d905de1219107
2016-11-03 13:34:07 -07:00
Andrew Bonventre
4b60a0bd7e Merge changes I63f4aa2e,I805f31b2
* changes:
  Revert "Make horizontal scrolling visible on diff page"
  Revert "Allow diff to scroll for inline diff"
2016-11-02 19:20:23 +00:00
Viktar Donich
bcab19889b Revert "Make horizontal scrolling visible on diff page"
This reverts commit 52c943d88e088894e61e054964ec91ffe410a0bc.

Change-Id: I63f4aa2efd386300c070521c5bccf1c6ac5c594e
2016-11-02 19:10:30 +00:00
Wyatt Allen
20693de09f Properly encode file path in diff view
Bug: Issue 4827
Change-Id: Ia0815aca6649324fe9f3ad7c5e2168c25d1f8a7d
2016-11-01 16:11:07 -07:00
Kasper Nilsson
c59e88058e Add raw diff download link to PG diff-view
A dependent change added the ability to download a single file diff to
Gerrit. This change utilizes that new feature via a download link in the
diff-view.

Feature: Issue 4669
Change-Id: I87ef2324ff2cd7fab6eb4b2e066dd08defe7c4f0
2016-10-31 18:06:51 -07:00
Viktar Donich
52c943d88e Make horizontal scrolling visible on diff page
Diff header scrolls with content and sticks to the top.
Implemented custom gr-header wrapper to accomodate this.

Bug: Issue 4491
Change-Id: I451ecd4f6c454fd9ab3085ad8f9c5bdd27cb9269
2016-10-28 12:31:58 -07:00
Wyatt Allen
43ddaf6b1c Set line number hash using replaceState
When clicking a line number in the diff view, set the URL hash using
`history.replaceState` rather than `history.pushState` to avoid an
additional history entry.

Bug: Issue 4820
Change-Id: If2101508a49ac15e955d2981f7c7f93f22d5b9f9
2016-10-27 10:51:07 -07:00
Viktar Donich
74975da15e Merge "Revert "Fix app size to make scrollbars visible"" 2016-10-24 20:53:42 +00:00
Viktar Donich
cc6b8300d1 Revert "Fix app size to make scrollbars visible"
This reverts commit a7b89441bda7a1ea7e98969462c2def989bd68c2.

Reason for revert: Got a better idea for app layout, will send follow-up change.

Change-Id: I7b7c86288fb070114e76dd68701e05c539089eab
2016-10-24 20:53:30 +00:00
Viktar Donich
e2d1c6307f Revert "Layout fixes (mostly for Safari)"
This reverts commit 37ef1672f9133b605c5e14f8fbcc241d4c40eb50.

Reason for revert: Got a better idea for app layout, will send follow-up change.

Change-Id: I7bfddcef416d44c7af88d74da6b39c2a93565d32
2016-10-24 20:52:59 +00:00
Viktar Donich
37ef1672f9 Layout fixes (mostly for Safari)
Follow-up for c/89172 for the Safari.

Change-Id: Ifa85f42217f6020991b6644d95d490eb9a8d7b52
2016-10-23 21:28:00 -07:00
Viktar Donich
642c4ac19e Merge "Fix app size to make scrollbars visible" 2016-10-20 22:38:36 +00:00
Viktar Donich
a7b89441bd Fix app size to make scrollbars visible
Fixes footer at the bottom of the page for all pages and changes
scrolling behavior for diff page.

On the diff page:
- horizontal scrolling is right above footer when required
- all headers stay in place when scrolling

Bug: Issue 4491
Change-Id: I62fdf130376b210c26fadcadc90bf452361ac15d
2016-10-20 12:09:57 -07:00
Urs Wolfer
a010547eef Fix issues detected by 'JSHint' and 'JSCS'
Change-Id: Id16d7abe53d5f65c97bf778dc532e404b41283d8
2016-10-20 20:41:00 +02:00
Wyatt Allen
4e1d1b8427 Accept base patch line links
PolyGerrit uses the format b<line number> in URLs to indicate a specific
line number in the base patch, but the GWT UI would use the format of
a<line number>. Update PolyGerrit to understand both.

Bug: Issue 4792
Change-Id: I8d09be9cb952c66e085d3a4777c04e6d79eab518
2016-10-20 16:53:34 +00:00
Andrew Bonventre
a8e4332ba0 Remove extra network call to get change detail on diff view
An observer was causing an extra call to grab the change detail
when it wasn’t needed since it’s already called in _paramsChanged.

Change-Id: I9a9904145e5d88c377cd9d130a7f9a4be67454e3
2016-10-16 13:32:19 -07:00
Logan Hanks
610f80d3ec Add namespacing for keyboard shortcut disabling
The gr-overlay element attempts to manage disabling and enabling
keyboard shortcuts. When multiple gr-overlay elements are available
on a page and one of them opens immediately, that overlay tries to
disable keyboard shortcuts, but the other elements initialize as
closed and enable them.

This change offers a new method for disabling keyboard shortcuts.
The caller can pass in an identifier to enable or disable. If keyboard
shortcuts are disabled by one or more identifiers, then they are
suppressed.

Change-Id: I82fe6efd922f09279e76a2f2c8cb5781f3afe395
2016-10-14 14:05:43 -07:00
Becky Siegel
6c06e78cf6 Fix horizontal scrolling in file dropdown, comments, and gr diff view
Previously, long file names would display outside of the window size,
causing a horizontal scroll on mobile browsers.

With this change:
* In the file list on the change view, the rightControls are adjusted so
that they wrap on a new line on smaller/mobile screens.
* In the comment list, word-wrapping is used for long file paths
displayed above each comment.
* In the diff view, instead of displaying full paths in the dropdown,
the path is truncated to include an ellipsis, a slash and the file name
so that it can be seen both in the dropdown and also the native browser
select.

Bug: Issue 4722
Change-Id: Icd4644a45db71bc6666c21d62c864d91e9874654
2016-10-13 15:44:59 -07:00
Andrew Bonventre
99642e348e Merge "Default to unified view on small screen sizes" 2016-10-13 00:20:32 +00:00
Becky Siegel
74f531c6a6 Default to unified view on small screen sizes
Previously, the default view type was displayed for all screen sizes.
If side by side was the user's preference, and they viewed polygerrit
on mobile, side by side was displayed.

This change ignores user preference for small screen sizes (under 900
px wide). The user can still toggle to a split view, but unified will
be the first view shown.

Bug: Issue 4682
Change-Id: Id4e1cab17de433033e103c3cca582b7e9c656acf
2016-10-12 14:51:09 -07:00
Kasper Nilsson
624b070db7 Add dropdown for selecting diff view mode to file list
Setting persists for the duration of viewing a change. When a user
selects a new change, their default view mode is set.

Bug: Issue 4670
Change-Id: I4eade0e42c13bf2b3079ef38fb07239f98a243d8
2016-10-07 14:07:41 -07:00
Kasper Nilsson
bf457dd412 Fix data binding in gr-file-list, introduced in 86117
In https://gerrit-review.googlesource.com/c/86117/ the data binding
between the _files array and the dom-repeat in gr-file-list was not
properly enforced. This change fixes that, and also properly
references a static file-list property.

In addition, tests were implemented to ensure this regression is caught
in the future.

Bug: Issue 4575
Change-Id: I32a5645ec47d953ee6a7a71f4b14fc8c9483df3d
2016-09-30 13:04:15 -07:00
Kasper Nilsson
76aaa8cb33 Check for modifiers before creating comment
In some cases, the "press c to comment" feature was overriding default
browser copy behavior. This change checks for modifiers before creating
comments. This functionality is factored out into a function for future
use.

Bug: Issue 3989
Change-Id: I3ebe0dec2f5436b8339d81d99d1287799ff3568b
2016-09-27 16:10:09 -07:00
Andrew Bonventre
648121b946 Revert "Add 'Show 75 more' button to gr-file-list"
This reverts commit I84c7fc352da80609d424217250830f19a599c940.

Reason for revert: Neither “Show all diffs” nor the keyboard shortcuts
appear to work. However, clicking on the triangle works.

Original issue's description:
> Add 'Show 75 more' button to gr-file-list
> 
> gr-file-list has an issue handling very large (500+) amounts of files
> due to the dynamic rendering of many DOM elements. This change caps the
> number of files shown initially at 75, and allows the user to view more
> in chunks of 75.
> 
> Also added is a button that allows the user to show all files.
> 
> Bug: Issue 4575
> Change-Id: I84c7fc352da80609d424217250830f19a599c940
> 

Change-Id: I7acfad051e0a255d09ee6e02f9dfc0137d5d37ff
2016-09-27 06:49:54 +00:00
Kasper Nilsson
d311e7f7e6 Add 'Show 75 more' button to gr-file-list
gr-file-list has an issue handling very large (500+) amounts of files
due to the dynamic rendering of many DOM elements. This change caps the
number of files shown initially at 75, and allows the user to view more
in chunks of 75.

Also added is a button that allows the user to show all files.

Bug: Issue 4575
Change-Id: I84c7fc352da80609d424217250830f19a599c940
2016-09-23 12:07:51 -07:00
beckysiegel
c47410c816 Focus and tab between diff preferences inputs
Previously, the diff preferences form did not automatically focus to the
first textfield and did not allow tabbing between input fields. This
change adds autofocus when the overlay is opened and allows for tabbing
between the other input fields in the modal.

Bug: Issue 4140
Change-Id: If15812bb4404ca4061597755eeaf68d4cae23b3f
2016-09-20 18:30:29 -07:00
Andrew Bonventre
04e57d6361 Add next/prev links to the diff view
Bug: Issue 4514
Change-Id: I39927b397fda8d6bb80b7e3a9144e5cfe620fb5a
2016-09-07 18:28:47 -04:00
Kasper Nilsson
0deb7e3fb7 Blur dropdowns after selection
Blurring dropdowns after selection enables a more shortcut-based
workflow.

Bug: Issue 3868
Change-Id: Ie35e5458f10540d0498b32d9bf03f5a6888c2232
2016-08-31 11:42:34 -07:00
Logan Hanks
78ad03c542 Fix diff mode selector initial state
When gr-diff-view attaches, it may need the user's preferences in order
to set the diff mode selector to the correct state.

In the course of testing this change, I realized that an overriding
diff mode selection wasn't sticking across pages, especially when moving
back and forth in history. Modified gr-change-view to also update the
diff mode from the user's preferences when it notices a different change
is being loaded.

Bug: Issue 4434
Change-Id: Id2041b55bf66d7de66f74d7765ed0db717caeebf
2016-08-25 15:29:29 -07:00
Viktar Donich
c282d7b282 Toggle left diff on Shift+A
Feature: Issue 3926
Change-Id: Ia52334f2aefeae4b3f115e5779da3b61af25ba11
2016-08-10 12:54:49 -07:00
Viktar Donich
b34d1f87c7 Show file weblinks (e.g. gitles) in diff view
Bug: Issue 4205
Change-Id: Ib5c832bb29453aa51ebe73732c7b8e6885e7e12f
2016-08-03 14:52:13 -07:00
Urs Wolfer
33df005810 Fix issues detected by 'JSHint' and 'JSCS'
Change-Id: Ic1437333fcf82473ac57f8bdea25ee8188ddbfee
2016-07-15 20:32:27 +02:00
Viktar Donich
60d8bce771 Release range comments
Remove beta diff setting and enable range comments for all.

Change-Id: I0cee7e1717574ab54317cdce9e2332c8cda7a0cb
2016-07-14 14:45:15 -07:00
Wyatt Allen
bdd4e3498c Move the diff cursor to line number specified by the URL hash
If the gr-diff-view is loaded with a line number address in the URL
hash, moves the diff cursor to that line.

Bug: Issue 4206
Change-Id: I359a29d7a3fd97b0ce72228aec3f49ae2295bfee
2016-06-21 08:47:36 -07:00