21 Commits

Author SHA1 Message Date
Andrew Bonventre
73d85d7545 Small cleanup within gr-diff and gr-diff-view
+ There is no longer a window resize handler needed in gr-diff.
+ The “show preferences” keyboard shortcut is now fixed.

Change-Id: I22b2ff358d345cff9ef40ade0bdcbb5cb71ba7f4
2016-05-15 13:16:52 -04:00
Wyatt Allen
f93f1c24ee Add toggle to PolyGerrit diff view to switch between diff styles
The gr-diff element was already capable of rendering diffs in either
side-by-side or unified style, but was configured by default to use
side-by-side. The GWT diff UI included an icon button toggle to switch
between these two styles above and to the right of the diff near the
"Diff View Preferences" button. This change introduces a selector in the
PolyGerrit UI to allow similar switching behavior.

Previously, the diff mode was encoded as a private property of the
gr-diff element. Now that the switcher is introduced at the same level
as the "Diff View Preferences" button (one level up from the gr-diff
element) it is changed to be a public property of the element so that it
can be changed through the parent view (in this case the gr-diff-view
element).

A dropdown is added to the gr-diff-view based in style on the
gr-patch-range-select element (which plays a similar role). This
dropdown has options for either of the two diff modes and controls the
diff display through a property on the view.

The view gets a new, computed property called _diffMode which encodes
which diff state should be displayed based on the changeViewState and
the user's preferences. The user's choice of diff view is persisted
across diff views, but is reverted to the preference when the change
view is visited.

A test is added to the gr-diff-view element.

Bug: Issue 3909
Change-Id: I00d93500f8d210394acc9c8f3398c9406ae74276
2016-05-09 15:56:23 -07:00
Urs Wolfer
c37b69ab9b Fix issues detected by 'JSHint' and 'JSCS'
Change-Id: Ibee5d0843da5776ab1ad43158227178105467d2e
2016-04-29 22:25:51 +02:00
Andrew Bonventre
c80291ca05 Move gr-diff controls into gr-diff-view
This will allow for an easier time in implementing expanding
inline diffs by having gr-diff only responsible for rendering the
diff itself and not other controls.

Change-Id: I254ad5900091c731e2197590d6043c103216785e
2016-04-23 23:28:55 -04:00
Andrew Bonventre
102f8793a7 Fix bug where copying text inside a comment box wasn’t working
Change-Id: Ifc4866f82fab22db21c2494601ae4173e2c46af5
2016-04-22 16:01:12 +00:00
Andrew Bonventre
ee9b2f96c6 Fix bug where tabs were not taken into account for line length
Also clean up inline CSS for tab-width.

Bug: Issue 4049
Change-Id: Ie2e2b83e3da6791e32526da171e4568762bfecc9
2016-04-11 21:33:32 -04:00
Andrew Bonventre
1c75cebe0a Show errors on views when main requests fail
Bug: Issue 3953
Change-Id: Ic20ac5cfc8cbf25c0744e0208b60f447ba9da718
2016-04-05 20:08:03 +00:00
Andrew Bonventre
30938ca111 Merge "Switch to using fetch for gr-change-actions" 2016-04-05 14:08:58 +00:00
Andrew Bonventre
1508cac26d Switch to using fetch for gr-change-actions
Bug: Issue 3945
Bug: Issue 3988
Change-Id: I471c63695300b2e410013d637285f897c4f6c703
2016-04-05 09:54:33 -04:00
Andrew Bonventre
ac802cd3bd Set min/max width on content cells
For table cells, setting the width css attribute isn’t sufficient to
prevent them from shrinking. Set min and max width.

Change-Id: I02592a8e41f55a9f250cee2735c4cc7ec9566e09
2016-04-02 21:53:35 -04:00
Andrew Bonventre
c6857c537c Fix var scoping issue while doing intraline highlights
+ I hate var scoping in JS.
+ Also update server.go to point to Gerrit.

Change-Id: I9bb035cd7eca5d5c029052611ea28b7d67fd6f98
2016-03-29 17:16:09 -04:00
Andrew Bonventre
29ab77d7a2 Specify width for table cell in diff view instead of min-width
Change-Id: I3dca0f8714c95f5ae1bd7462685842dea8ebd1e2
2016-03-29 15:34:14 -04:00
Andrew Bonventre
2aa22125b6 Move gr-diff-new to gr-diff
Change-Id: Ifaad016f806c31f3df43143b3238b757faa18b20
2016-03-25 17:56:08 -04:00
Andrew Bonventre
6a9312f7b1 Properly remove discarded comments from model in gr-new-diff
Change-Id: Icb5d3ba1edd2cd3a75aa6568a152bacc5e0babda
2016-03-25 16:17:06 +00:00
Urs Wolfer
f531d0aeb9 Fix tests which are wonky in Safari
Change-Id: I5f60afd9302581204c9ab08eda10a2273677b4fa
2016-03-14 17:12:03 +01:00
Andrew Bonventre
8e5ac9d92a Move fake-app.js to test folder
Also exclude *_test.html files from BUCK app glob

Change-Id: If1890b46ffb7d4657bdea83786de5262343835ff
2016-03-10 19:30:31 -05:00
Shawn Pearce
54e7de87a5 Merge changes Idea54a38,Iaa77c408
* changes:
  Fetch diff comments via getDiffComments call
  Add getDiff() method to gr-rest-api-interface
2016-03-07 22:06:58 +00:00
Andrew Bonventre
af1c602139 Fetch diff comments via getDiffComments call
+ Cleans up interface for grouping comments within
  gr-rest-api-interface.
+ Removes gr-diff’s dep on gr-ajax and rest-client-behavior.

Change-Id: Idea54a38fa5d0b136ff00b7ec7322bd24ad5d1bd
2016-03-07 16:55:04 -05:00
Urs Wolfer
b603694158 Remove 'element#async' usages in tests
Tests which are using 'element#async' are wonky in Safari.
'flush' is also the documented way of testing dom manipulations.

Change-Id: I3ea99c7c80c952fa1c15bbd6289690e57bf8414b
2016-03-06 17:23:36 +01:00
Andrew Bonventre
cba7d44e69 Add getDiff() method to gr-rest-api-interface
+ Replace use of gr-ajax for retrieving the diff in gr-diff.
+ Add opt_params to fetchJSON so that query parameters can be
  passed.

Change-Id: Iaa77c4082d6e83099e23f49205d859a5c938dd31
2016-03-05 19:20:09 -05:00
Andrew Bonventre
78792e8e98 Refactor directory structure of components
There is no change in functionality. Only moving things around.

+ Separate html from the js.
+ Place the unit test for a component within the same folder.
+ Organize the components in subfolders.

Change-Id: I51fdc510db75fc1b33f040ca63decbbdfd4d5513
2016-03-04 18:02:24 -05:00