diff options
-rw-r--r-- | app/assets/javascripts/repo/components/repo_commit_section.vue | 7 | ||||
-rw-r--r-- | app/assets/javascripts/repo/components/repo_preview.vue | 4 | ||||
-rw-r--r-- | app/assets/javascripts/repo/components/repo_sidebar.vue | 2 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/repo.scss | 23 | ||||
-rw-r--r-- | app/helpers/appearances_helper.rb | 6 | ||||
-rw-r--r-- | app/views/layouts/_page.html.haml | 5 | ||||
-rw-r--r-- | spec/javascripts/repo/components/repo_commit_section_spec.js | 12 |
7 files changed, 48 insertions, 11 deletions
diff --git a/app/assets/javascripts/repo/components/repo_commit_section.vue b/app/assets/javascripts/repo/components/repo_commit_section.vue index 1282828b504..4a852bfc024 100644 --- a/app/assets/javascripts/repo/components/repo_commit_section.vue +++ b/app/assets/javascripts/repo/components/repo_commit_section.vue @@ -52,6 +52,13 @@ export default { this.changedFiles = []; this.commitMessage = ''; this.editMode = false; + this.openedFiles = this.openedFiles.map((file) => { + const f = file; + f.changed = false; + + return f; + }); + Store.setViewToPreview(); window.scrollTo(0, 0); }, }, diff --git a/app/assets/javascripts/repo/components/repo_preview.vue b/app/assets/javascripts/repo/components/repo_preview.vue index 2200754cbef..ebd6e7c4cb6 100644 --- a/app/assets/javascripts/repo/components/repo_preview.vue +++ b/app/assets/javascripts/repo/components/repo_preview.vue @@ -14,7 +14,9 @@ export default { methods: { highlightFile() { - $(this.$el).find('.file-content').syntaxHighlight(); + this.$nextTick(() => { + $(this.$el).find('.file-content').syntaxHighlight(); + }); }, }, diff --git a/app/assets/javascripts/repo/components/repo_sidebar.vue b/app/assets/javascripts/repo/components/repo_sidebar.vue index 3414128526d..29bec8f75d9 100644 --- a/app/assets/javascripts/repo/components/repo_sidebar.vue +++ b/app/assets/javascripts/repo/components/repo_sidebar.vue @@ -27,7 +27,7 @@ export default { addPopEventListener() { window.addEventListener('popstate', () => { if (location.href.indexOf('#') > -1) return; - this.linkClicked({ + this.fileClicked({ url: location.href, }); }); diff --git a/app/assets/stylesheets/pages/repo.scss b/app/assets/stylesheets/pages/repo.scss index efc47861768..fb610721930 100644 --- a/app/assets/stylesheets/pages/repo.scss +++ b/app/assets/stylesheets/pages/repo.scss @@ -3,6 +3,10 @@ transition: opacity $sidebar-transition-duration; } +.repo-wrapper { + padding: 0; +} + .monaco-loader { position: absolute; top: 0; @@ -54,12 +58,13 @@ .tree-content-holder { display: flex; - max-height: 100vh; + max-height: 80vh; min-height: 300px; + overflow: auto; } .tree-content-holder-mini { - height: 100vh; + height: 80vh; } .panel-right { @@ -142,11 +147,12 @@ list-style-type: none; background: $gray-normal; display: inline-block; - padding: 10px 18px; + padding: 8px 16px; border-right: 1px solid $white-dark; border-bottom: 1px solid $white-dark; white-space: nowrap; cursor: pointer; + min-width: 145px; &.remove { animation: swipeRightDissapear ease-in 0.1s; @@ -166,10 +172,10 @@ a { @include str-truncated(100px); color: $black; - width: 100px; - text-align: center; + text-align: left; vertical-align: middle; text-decoration: none; + max-width: 100px; &.close { width: auto; @@ -184,7 +190,11 @@ float: right; margin-top: 3px; margin-left: 15px; - color: $gray-darkest; + color: $dropdown-title-btn-color; + + &:hover { + color: darken($dropdown-title-btn-color, 15%); + } } .unsaved-icon { @@ -202,7 +212,6 @@ #repo-file-buttons { background-color: $white-light; - border-bottom: 1px solid $white-normal; padding: 5px 10px; position: relative; border-top: 1px solid $white-normal; diff --git a/app/helpers/appearances_helper.rb b/app/helpers/appearances_helper.rb index cdf5fa5d4b7..c6582f56fa6 100644 --- a/app/helpers/appearances_helper.rb +++ b/app/helpers/appearances_helper.rb @@ -36,4 +36,10 @@ module AppearancesHelper # File.read(Rails.root.join("app/views/shared/icons/_#{icon_name}.svg")).html_safe render "shared/icons/#{icon_name}.svg", size: size end + + def repo_wrapper_class + is_repo_page = body_data_page == 'projects:tree:show' || body_data_page == 'projects:blob:show' + + 'repo-wrapper' if show_new_repo? && is_repo_page + end end diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index c4f8cd71395..39424478ec5 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -1,3 +1,6 @@ +- wrapper_class = layout_nav_class +- wrapper_class << " #{repo_wrapper_class}" if repo_wrapper_class + .page-with-sidebar{ class: page_with_sidebar_class } - if show_new_nav? - if defined?(nav) && nav @@ -9,7 +12,7 @@ = render "layouts/nav/#{nav}" - if content_for?(:sub_nav) = yield :sub_nav - .content-wrapper{ class: layout_nav_class } + .content-wrapper{ class: wrapper_class } - if show_new_nav? .mobile-overlay .alert-wrapper diff --git a/spec/javascripts/repo/components/repo_commit_section_spec.js b/spec/javascripts/repo/components/repo_commit_section_spec.js index e604dcc152d..bd9609c79f2 100644 --- a/spec/javascripts/repo/components/repo_commit_section_spec.js +++ b/spec/javascripts/repo/components/repo_commit_section_spec.js @@ -139,20 +139,30 @@ describe('RepoCommitSection', () => { describe('methods', () => { describe('resetCommitState', () => { - it('should reset store vars and scroll to top', () => { + it('should reset store vars, calls setViewToPreview and scroll to top', () => { const vm = { submitCommitsLoading: true, changedFiles: new Array(10), commitMessage: 'commitMessage', editMode: true, + openedFiles: [{ + changed: true, + }, { + changed: true, + }], }; + spyOn(RepoStore, 'setViewToPreview'); + repoCommitSection.methods.resetCommitState.call(vm); expect(vm.submitCommitsLoading).toEqual(false); expect(vm.changedFiles).toEqual([]); expect(vm.commitMessage).toEqual(''); expect(vm.editMode).toEqual(false); + expect(vm.openedFiles[0].changed).toBeFalsy(); + expect(vm.openedFiles[1].changed).toBeFalsy(); + expect(RepoStore.setViewToPreview).toHaveBeenCalled(); }); }); }); |