diff --git a/app/assets/javascripts/boards/boards_bundle.js.es6 b/app/assets/javascripts/boards/boards_bundle.js.es6 index 0cecdc4f50a1ea285c5de0f780c27556510bdb61..56f9150301724240afaec7043adff14f762c34f4 100644 --- a/app/assets/javascripts/boards/boards_bundle.js.es6 +++ b/app/assets/javascripts/boards/boards_bundle.js.es6 @@ -33,9 +33,15 @@ $(() => { endpoint: $boardApp.dataset.endpoint, boardId: $boardApp.dataset.boardId, disabled: $boardApp.dataset.disabled === 'true', - issueLinkBase: $boardApp.dataset.issueLinkBase + issueLinkBase: $boardApp.dataset.issueLinkBase, + detailIssue: Store.detail }, init: Store.create.bind(Store), + computed: { + detailIssueVisible () { + return Object.keys(this.detailIssue.issue).length; + } + }, created () { gl.boardService = new BoardService(this.endpoint, this.boardId); }, diff --git a/app/assets/javascripts/boards/components/board.js.es6 b/app/assets/javascripts/boards/components/board.js.es6 index cacb36a897f9939132e64c71fb32415c3f08877d..500213a3a432ce47d6e6476a57a55f2cd857d336 100644 --- a/app/assets/javascripts/boards/components/board.js.es6 +++ b/app/assets/javascripts/boards/components/board.js.es6 @@ -21,6 +21,7 @@ }, data () { return { + detailIssue: Store.detail, filters: Store.state.filters, showIssueForm: false }; @@ -32,6 +33,26 @@ this.list.getIssues(true); }, deep: true + }, + detailIssue: { + handler () { + if (!Object.keys(this.detailIssue.issue).length) return; + + const issue = this.list.findIssue(this.detailIssue.issue.id); + + if (issue) { + const boardsList = document.querySelectorAll('.boards-list')[0]; + const right = (this.$el.offsetLeft + this.$el.offsetWidth) - boardsList.offsetWidth; + const left = boardsList.scrollLeft - this.$el.offsetLeft; + + if (right - boardsList.scrollLeft > 0) { + boardsList.scrollLeft = right; + } else if (left > 0) { + boardsList.scrollLeft = this.$el.offsetLeft; + } + } + }, + deep: true } }, methods: { diff --git a/app/assets/javascripts/boards/components/board_card.js.es6 b/app/assets/javascripts/boards/components/board_card.js.es6 index bcb1b60b978834eb437a9db2b3876d48edae1fd9..f743d72f936e297a9d90b4bcf15028be16330cc3 100644 --- a/app/assets/javascripts/boards/components/board_card.js.es6 +++ b/app/assets/javascripts/boards/components/board_card.js.es6 @@ -20,11 +20,7 @@ }, computed: { issueDetailVisible () { - if (this.detailIssue.issue && this.detailIssue.issue.id === this.issue.id) { - return true; - } else { - return false; - } + return this.detailIssue.issue && this.detailIssue.issue.id === this.issue.id; } }, methods: { diff --git a/app/assets/javascripts/boards/components/board_sidebar.js.es6 b/app/assets/javascripts/boards/components/board_sidebar.js.es6 index 1c002a54bedab5c14ca4bc2683aef2cc423bc067..35d97531439e1397ec3c8131411b0c8bc799a5e2 100644 --- a/app/assets/javascripts/boards/components/board_sidebar.js.es6 +++ b/app/assets/javascripts/boards/components/board_sidebar.js.es6 @@ -29,15 +29,22 @@ issue () { if (this.showSidebar) { this.$nextTick(() => { - new IssuableContext(this.currentUser); - new MilestoneSelect(); - new gl.DueDateSelectors(); - new LabelsSelect(); - new Sidebar(); - new Subscription('.subscription'); + this.issuableContext = new IssuableContext(this.currentUser); + this.milestoneSelect = new MilestoneSelect(); + this.dueDateSelect = new gl.DueDateSelectors(); + this.labelsSelect = new LabelsSelect(); + this.sidebar = new Sidebar(); + this.subscription = new Subscription('.subscription'); }); } else { $('.right-sidebar').getNiceScroll().remove(); + + delete this.issuableContext; + delete this.milestoneSelect; + delete this.dueDateSelect; + delete this.labelsSelect; + delete this.sidebar; + delete this.subscription; } } }, diff --git a/app/assets/stylesheets/pages/boards.scss b/app/assets/stylesheets/pages/boards.scss index 0807d583207e88542b0be90b835f221b4fdcb6e2..8e972020234b5e1975353542a45f620c07819525 100644 --- a/app/assets/stylesheets/pages/boards.scss +++ b/app/assets/stylesheets/pages/boards.scss @@ -76,6 +76,10 @@ lex height: 475px; // Needed for PhantomJS height: calc(100vh - 220px); min-height: 475px; + + &.is-compact { + width: calc(100% - 290px); + } } } diff --git a/app/views/projects/boards/components/_sidebar.html.haml b/app/views/projects/boards/components/_sidebar.html.haml index cf70ad4927a37a0d050c8955e8bc7103766ab992..7907fdfa81073bdf54449e3a46cfcce2108dff1a 100644 --- a/app/views/projects/boards/components/_sidebar.html.haml +++ b/app/views/projects/boards/components/_sidebar.html.haml @@ -12,7 +12,7 @@ {{ issue.id }} %a.gutter-toggle.pull-right{ role: "button", href: "#", - "@click" => "closeSidebar", + "@click.prevent" => "closeSidebar", "aria-label" => "Toggle sidebar" } = icon("times") .js-issuable-update diff --git a/app/views/projects/boards/index.html.haml b/app/views/projects/boards/index.html.haml index 45c2e0ee2da383c7919c8995da17351d25fdd03e..29c9a43a0c1dc85d457559ab6345f23a8631f1be 100644 --- a/app/views/projects/boards/index.html.haml +++ b/app/views/projects/boards/index.html.haml @@ -11,7 +11,7 @@ = render 'shared/issuable/filter', type: :boards #board-app.boards-app{ "v-cloak" => true, data: board_data } - .boards-list + .boards-list{ ":class" => "{ 'is-compact': detailIssueVisible }" } .boards-app-loading.text-center{ "v-if" => "loading" } = icon("spinner spin") = render "projects/boards/components/board" diff --git a/app/views/projects/boards/show.html.haml b/app/views/projects/boards/show.html.haml index 45c2e0ee2da383c7919c8995da17351d25fdd03e..29c9a43a0c1dc85d457559ab6345f23a8631f1be 100644 --- a/app/views/projects/boards/show.html.haml +++ b/app/views/projects/boards/show.html.haml @@ -11,7 +11,7 @@ = render 'shared/issuable/filter', type: :boards #board-app.boards-app{ "v-cloak" => true, data: board_data } - .boards-list + .boards-list{ ":class" => "{ 'is-compact': detailIssueVisible }" } .boards-app-loading.text-center{ "v-if" => "loading" } = icon("spinner spin") = render "projects/boards/components/board"