Previously, there was an issue where nagivating between diffs would
use the hash from the previous diff because the url had not been
updated when _paramsChanged was calls. Instead of getting the hash
from window.location, let the router handle it and pass it in as a
param.
Bug: Issue 6702
Change-Id: I03cb59e0f55813b0973eaf949e9e0958946d094e
Migrates all alert calls to toasts. Also corrects one test that checked
for an alert on the window.
Bug: Issue 6701
Change-Id: I4d41790f63edc15873014df4f98013ac2bb2af7c
Split the path at the last slash to provide only the basename as the
page title in diff-view.
Bug: Issue 4955
Change-Id: I242d38f5823415a53f837ad7d1a5b97bd16c6fa6
This allows for the functions which rely on the properties to be called when
the properties are set.
Change-Id: I306550a246c4c535ae5f165ce3fbe5282eea25f2
window.PANEL_FLOATING_DISABLED=true prevents diff header detaching from
the page flow and sticking to the window top border.
Change-Id: Idafab7f73fb52a9165b7610ae609e0a8fe52bbd9
On Latin American keyboards, the square bracket cannot be typed without
a modifier. An added check to exit if modifiers are pressed meant that
the shortcut could thus not be used on these keyboards.
Instead, check only for the meta key to avoid overriding native Chrome
shortcuts in OSX.
Bug: Issue 6217
Change-Id: Ia737c4c411b73b2ba42fe5f33fff5082c488a5fb
The Closure Compiler is very picky with regard to JSDoc formatting. This
change fixes a few invalid JSDoc issues, and removes the corresponding
suppresses from the BUILD file. Additionally, modify the transpilation
target language to ES5.
After this change, there should no longer be warnings from the Closure
Compiler during building of PolyGerrit.
Change-Id: If7566e40c2c419c55f2a634c0f558c6cc263f61c
Previously, gr-diff-preferences was the contents that was displayed in
an overlay contained in the gr-diff-view. There were a handful of
functions that crossed between the two-- the diff preferences element
would fire events that needed to be handled by the diff view.
Because the gr-diff-preferences element will be added to the change
view as well, the overlay has been moved to be part of the diff
preferences element. This way, the element can handle all of the actions
taken by the panel, and all the parent element needs to do is call
the open function.
A separate change will come with the addition of diff preferences in the
change view.
Bug: Issue 5426
Change-Id: Id7396147e73354122ea3825bde2c324b5daa1d26
This updates most of polygerrit links to use the implementation added in
I2b2d704fe33c90ea2f2a2183fc79897642a48175 .
Change-Id: Ib3bb694969e903fd76a1dad13cfb642bde086142
Previously, there was an issue where click events did not fire before
tap handlers closed a dropdown. If the dropdown was closed first, the
dropdown is gone and something random becomes the event target.
This change adds a short setTimeOut to ensure that the link is the click
target prior to closing the dropdown.
Bug: Issue 5932
Change-Id: I218893fd479eeb68361dd2c94d919740a8f542f2
GWT UI has this button but polygerrit dosen't. Makes it easier to view
your other diff's if you need to pick another file but it is way down
the list.
Change-Id: Ic62480315b3b00d7623d4ac444a0b554d255b4d1
In a recent change (Ib83ff5157), the promise strategy for processing and
rendering diffs changed so that they resolve after all the work (i.e.
processing, diff content, and syntax highlighting) had completed.
Beforehand the promise would actually resolve after the diff processing
had finished. The diff view would wait for this promise to resolve
(along with the resolution of network calls) before removing the
`_loading` flag.
Because the promise resolution now represents all of the diff rendering
work being complete, rather than the first step only, this use of the
promise was outdated.
With this change, the diff view sets `_loading` to `false` immediately
before starting the diff processing/content/syntax pipeline.
Bug: Issue 5533
Change-Id: I24fafe4d55166e2acbf1849e6a75fbcba122b997
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
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
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
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
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
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
+ 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
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
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
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
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
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
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
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
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
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
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
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
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
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
Sets the URL hash to the address of the cursor when a user selects a
diff line (either by clicking the line number or using the 'c' hotkey).
If the cursor is on a line of the revision, the address is the line
number. If the cursor is on a line of the base patch, the address is the
letter 'b' followed by the line number. Otherwise the address is the
empty string.
Bug: Issue 4206
Change-Id: Ic85da197eb6264ea1111cc34e781dccbc24d4d40
- gr-file-list recognizes local preferences (for hasRangedComments flag)
- gr-file-list reacts to cursor hotkey only if there is no range
selected (currently always false).
- Remove dead code from GrDiffBuilderSideBySide, GrDiffBuilder,
gr-diff-builder.html
- Bugfix: GrDiffBuilder.prototype.getGroupsByLineRange handles one-line
BOTH code sections correctly. Test updated as well.
- Added utitily methods added to gr-diff-builder.html to reduce
dependency on DOM structure and reduce amount of code copy-pasting:
- renderLineRange, getContentByLine, etc
- For gr-diff.js and gr-diff-comment-thread.js addDraft renamed to
addOrEditDraft because that's what it does.
- For both, addDraft method always creates a draft comment.
- Added support for ranged comments in gr-diff, gr-diff-comment-thread.
- Added mouseenter and mouseout events to gr-comment.js
- Refactored gr-comment.js to reduce code copy-paste, unify event
payload, and to eliminate need of accessing component instance for
patchNum. Tests updated as well.
- Refactored gr-diff.js UI data model update using gr-diff-builder.html
utility methods to make code more readable.
- Added support for creating ranged comments to gr-diff.js.
- gr-selection-action-box now reacts to click and tap to create a
comment.
Change-Id: I01480a4c6f460774a8b2826915702800b3f81d25