summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue')
-rw-r--r--app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue30
1 files changed, 6 insertions, 24 deletions
diff --git a/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue b/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue
index 3398cd091ba..e618fb3daae 100644
--- a/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue
+++ b/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue
@@ -24,25 +24,19 @@ export default {
discardModalTitle() {
return sprintf(__('Discard changes to %{path}?'), { path: this.activeFile.path });
},
- actionButtonText() {
- return this.activeFile.staged ? __('Unstage') : __('Stage');
- },
isStaged() {
return !this.activeFile.changed && this.activeFile.staged;
},
},
methods: {
...mapActions(['stageChange', 'unstageChange', 'discardFileChanges']),
- actionButtonClicked() {
- if (this.activeFile.staged) {
- this.unstageChange(this.activeFile.path);
- } else {
- this.stageChange(this.activeFile.path);
- }
- },
showDiscardModal() {
this.$refs.discardModal.show();
},
+ discardChanges(path) {
+ this.unstageChange(path);
+ this.discardFileChanges(path);
+ },
},
};
</script>
@@ -65,19 +59,7 @@ export default {
class="btn btn-remove btn-inverted append-right-8"
@click="showDiscardModal"
>
- {{ __('Discard') }}
- </button>
- <button
- ref="actionButton"
- :class="{
- 'btn-success': !isStaged,
- 'btn-warning': isStaged,
- }"
- type="button"
- class="btn btn-inverted"
- @click="actionButtonClicked"
- >
- {{ actionButtonText }}
+ {{ __('Discard changes') }}
</button>
</div>
<gl-modal
@@ -87,7 +69,7 @@ export default {
:ok-title="__('Discard changes')"
:modal-id="discardModalId"
:title="discardModalTitle"
- @ok="discardFileChanges(activeFile.path)"
+ @ok="discardChanges(activeFile.path)"
>
{{ __("You will lose all changes you've made to this file. This action cannot be undone.") }}
</gl-modal>