diff options
author | Phil Hughes <me@iamphill.com> | 2019-01-24 17:48:03 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-01-24 17:48:03 +0300 |
commit | 2f40aa68d92f3f51167aaccc9fab2801ee185605 (patch) | |
tree | 54f8d590511170db8d7f4db6a16dda1830a9ec54 /app/assets/javascripts/diffs/index.js | |
parent | da251c6436d6e17b18911d37c1b18314fb29329d (diff) |
Added dropdown for diff settings
Dropdown includes buttons for tree view rendering mode
and buttons for the compare view (inline or side-by-side)
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55491
Diffstat (limited to 'app/assets/javascripts/diffs/index.js')
-rw-r--r-- | app/assets/javascripts/diffs/index.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/assets/javascripts/diffs/index.js b/app/assets/javascripts/diffs/index.js index b130cedc24c..094e5cdea9c 100644 --- a/app/assets/javascripts/diffs/index.js +++ b/app/assets/javascripts/diffs/index.js @@ -1,6 +1,9 @@ import Vue from 'vue'; -import { mapState } from 'vuex'; +import { mapActions, mapState } from 'vuex'; +import { parseBoolean } from '~/lib/utils/common_utils'; +import { getParameterValues } from '~/lib/utils/url_utility'; import diffsApp from './components/app.vue'; +import { TREE_LIST_STORAGE_KEY } from './constants'; export default function initDiffsApp(store) { return new Vue({ @@ -26,6 +29,16 @@ export default function initDiffsApp(store) { activeTab: state => state.page.activeTab, }), }, + created() { + const treeListStored = localStorage.getItem(TREE_LIST_STORAGE_KEY); + const renderTreeList = treeListStored !== null ? parseBoolean(treeListStored) : true; + + this.setRenderTreeList(renderTreeList); + this.setShowWhitespace({ showWhitespace: getParameterValues('w')[0] !== '1' }); + }, + methods: { + ...mapActions('diffs', ['setRenderTreeList', 'setShowWhitespace']), + }, render(createElement) { return createElement('diffs-app', { props: { |