Change `Cancel` to `Close` in gr-editor-view
Previously, tapping `Cancel` would discard any unsaved changes and
navigate directly to the edit patch set in the change view. This was
wrong for a couple of reasons:
- If the user came from a non-edit patch set and cancelled immediately,
they would be taken to an unexpected patch set
- If the user started modifying a file and never saved, `Cancel` would
navigate to a patch set that may not exist at all
This change restyles the buttons on the editor view to flat link
buttons, re-orders them, renames `Cancel` to `Close`, and modifies the
`Close` behavior to only navigate to the edit patch set if a file was
successfully modified.
Bug: Issue 4437
Change-Id: I130c417e8cda961f4d7cd9e384137f8bc2cba181
diff --git a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.html b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.html
index 23f1824..56c2ca8 100644
--- a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.html
+++ b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.html
@@ -70,11 +70,15 @@
on-changed="_handlePathChanged"></gr-editable-label>
<span class="rightControls">
<gr-button
+ id="close"
+ link
+ on-tap="_handleCloseTap">Close</gr-button>
+ <gr-button
id="save"
disabled$="[[_saveDisabled]]"
primary
+ link
on-tap="_saveEdit">Save</gr-button>
- <gr-button id="cancel" on-tap="_handleCancelTap">Cancel</gr-button>
</span>
</header>
</gr-fixed-panel>