Commit 22dc35a6 authored by Fatih Acet's avatar Fatih Acet

Merge branch 'issue-boards-animate' into 'master'

Added animations to issue boards

Closes #25630

See merge request !8417
parents 57652bf5 36fa45e7
...@@ -45,14 +45,28 @@ ...@@ -45,14 +45,28 @@
const issue = this.list.findIssue(this.detailIssue.issue.id); const issue = this.list.findIssue(this.detailIssue.issue.id);
if (issue) { if (issue) {
const offsetLeft = this.$el.offsetLeft;
const boardsList = document.querySelectorAll('.boards-list')[0]; const boardsList = document.querySelectorAll('.boards-list')[0];
const right = (this.$el.offsetLeft + this.$el.offsetWidth) - boardsList.offsetWidth; const left = boardsList.scrollLeft - offsetLeft;
const left = boardsList.scrollLeft - this.$el.offsetLeft; let right = (offsetLeft + this.$el.offsetWidth);
if (window.innerWidth > 768 && boardsList.classList.contains('is-compact')) {
// -290 here because width of boardsList is animating so therefore
// getting the width here is incorrect
// 290 is the width of the sidebar
right -= (boardsList.offsetWidth - 290);
} else {
right -= boardsList.offsetWidth;
}
if (right - boardsList.scrollLeft > 0) { if (right - boardsList.scrollLeft > 0) {
boardsList.scrollLeft = right; $(boardsList).animate({
scrollLeft: right
}, this.sortableOptions.animation);
} else if (left > 0) { } else if (left > 0) {
boardsList.scrollLeft = this.$el.offsetLeft; $(boardsList).animate({
scrollLeft: offsetLeft
}, this.sortableOptions.animation);
} }
} }
}, },
...@@ -65,7 +79,7 @@ ...@@ -65,7 +79,7 @@
} }
}, },
mounted () { mounted () {
const options = gl.issueBoards.getBoardSortableDefaultOptions({ this.sortableOptions = gl.issueBoards.getBoardSortableDefaultOptions({
disabled: this.disabled, disabled: this.disabled,
group: 'boards', group: 'boards',
draggable: '.is-draggable', draggable: '.is-draggable',
...@@ -84,7 +98,7 @@ ...@@ -84,7 +98,7 @@
} }
}); });
this.sortable = Sortable.create(this.$el.parentNode, options); this.sortable = Sortable.create(this.$el.parentNode, this.sortableOptions);
}, },
}); });
})(); })();
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
gl.issueBoards.getBoardSortableDefaultOptions = (obj) => { gl.issueBoards.getBoardSortableDefaultOptions = (obj) => {
let defaultSortOptions = { let defaultSortOptions = {
animation: 200,
forceFallback: true, forceFallback: true,
fallbackClass: 'is-dragging', fallbackClass: 'is-dragging',
fallbackOnBody: true, fallbackOnBody: true,
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
height: 475px; // Needed for PhantomJS height: 475px; // Needed for PhantomJS
height: calc(100vh - 220px); height: calc(100vh - 220px);
min-height: 475px; min-height: 475px;
transition: width .2s;
&.is-compact { &.is-compact {
width: calc(100% - 290px); width: calc(100% - 290px);
...@@ -338,3 +339,18 @@ ...@@ -338,3 +339,18 @@
} }
} }
} }
.right-sidebar.right-sidebar-expanded {
&.boards-sidebar-slide-enter-active,
&.boards-sidebar-slide-leave-active {
transition: width .2s,
padding .2s;
}
&.boards-sidebar-slide-enter,
&.boards-sidebar-slide-leave-active {
width: 0;
padding-left: 0;
padding-right: 0;
}
}
%board-sidebar{ "inline-template" => true, %board-sidebar{ "inline-template" => true,
":current-user" => "#{current_user ? current_user.to_json(only: [:username, :id, :name], methods: [:avatar_url]) : {}}" } ":current-user" => "#{current_user ? current_user.to_json(only: [:username, :id, :name], methods: [:avatar_url]) : {}}" }
%aside.right-sidebar.right-sidebar-expanded.issue-boards-sidebar{ "v-show" => "showSidebar" } %transition{ name: "boards-sidebar-slide" }
.issuable-sidebar %aside.right-sidebar.right-sidebar-expanded.issue-boards-sidebar{ "v-show" => "showSidebar" }
.block.issuable-sidebar-header .issuable-sidebar
%span.issuable-header-text.hide-collapsed.pull-left .block.issuable-sidebar-header
%strong %span.issuable-header-text.hide-collapsed.pull-left
{{ issue.title }} %strong
%br/ {{ issue.title }}
%span %br/
= precede "#" do %span
{{ issue.id }} = precede "#" do
%a.gutter-toggle.pull-right{ role: "button", {{ issue.id }}
href: "#", %a.gutter-toggle.pull-right{ role: "button",
"@click.prevent" => "closeSidebar", href: "#",
"aria-label" => "Toggle sidebar" } "@click.prevent" => "closeSidebar",
= custom_icon("icon_close", size: 15) "aria-label" => "Toggle sidebar" }
.js-issuable-update = custom_icon("icon_close", size: 15)
= render "projects/boards/components/sidebar/assignee" .js-issuable-update
= render "projects/boards/components/sidebar/milestone" = render "projects/boards/components/sidebar/assignee"
= render "projects/boards/components/sidebar/due_date" = render "projects/boards/components/sidebar/milestone"
= render "projects/boards/components/sidebar/labels" = render "projects/boards/components/sidebar/due_date"
= render "projects/boards/components/sidebar/notifications" = render "projects/boards/components/sidebar/labels"
= render "projects/boards/components/sidebar/notifications"
---
title: Added animations to issue boards interactions
merge_request:
author:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment