Commit 6dce2963 authored by Clement Ho's avatar Clement Ho Committed by Jarka Kadlecová

Add ability to reorder issues in epic

parent 4ce70374
...@@ -162,7 +162,7 @@ export default { ...@@ -162,7 +162,7 @@ export default {
v-tooltip v-tooltip
ref="removeButton" ref="removeButton"
type="button" type="button"
class="js-issue-token-remove-button" class="js-issue-token-remove-button flex-right sortable-hidden"
:class="{ :class="{
'issue-token-remove-button': isCondensed, 'issue-token-remove-button': isCondensed,
'btn btn-default': !isCondensed 'btn btn-default': !isCondensed
......
...@@ -7,7 +7,6 @@ import addIssuableForm from './add_issuable_form.vue'; ...@@ -7,7 +7,6 @@ import addIssuableForm from './add_issuable_form.vue';
export default { export default {
name: 'RelatedIssuesBlock', name: 'RelatedIssuesBlock',
props: { props: {
isFetching: { isFetching: {
type: Boolean, type: Boolean,
...@@ -29,6 +28,11 @@ export default { ...@@ -29,6 +28,11 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
canReorder: {
type: Boolean,
required: false,
default: false,
},
isFormVisible: { isFormVisible: {
type: Boolean, type: Boolean,
required: false, required: false,
...@@ -60,17 +64,14 @@ export default { ...@@ -60,17 +64,14 @@ export default {
default: 'Related issues', default: 'Related issues',
}, },
}, },
directives: { directives: {
tooltip, tooltip,
}, },
components: { components: {
loadingIcon, loadingIcon,
addIssuableForm, addIssuableForm,
issueToken, issueToken,
}, },
computed: { computed: {
hasRelatedIssues() { hasRelatedIssues() {
return this.relatedIssues.length > 0; return this.relatedIssues.length > 0;
...@@ -88,11 +89,23 @@ export default { ...@@ -88,11 +89,23 @@ export default {
return this.helpPath.length > 0; return this.helpPath.length > 0;
}, },
}, },
methods: { methods: {
toggleAddRelatedIssuesForm() { toggleAddRelatedIssuesForm() {
eventHub.$emit('toggleAddRelatedIssuesForm'); eventHub.$emit('toggleAddRelatedIssuesForm');
}, },
reordered(event) {
console.log(event);
},
},
mounted() {
if (this.canReorder) {
this.sortable = Sortable.create(this.$refs.list, {
animation: 200,
ghostClass: 'is-ghost',
chosenClass: "sortable-chosen",
onEnd: this.reordered,
});
}
}, },
}; };
</script> </script>
...@@ -161,11 +174,15 @@ export default { ...@@ -161,11 +174,15 @@ export default {
label="Fetching related issues" /> label="Fetching related issues" />
</div> </div>
<ul <ul
class="flex-list content-list issuable-list"> ref="list"
class="flex-list content-list issuable-list"
>
<li <li
:key="issue.id" :key="issue.id"
v-for="issue in relatedIssues" v-for="issue in relatedIssues"
class="js-related-issues-token-list-item"> class="js-related-issues-token-list-item"
:class="{ 'is-dragging': canReorder }"
>
<issue-token <issue-token
event-namespace="relatedIssue" event-namespace="relatedIssue"
:id-key="issue.id" :id-key="issue.id"
......
...@@ -45,6 +45,11 @@ export default { ...@@ -45,6 +45,11 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
canReorder: {
type: Boolean,
required: false,
default: false,
},
helpPath: { helpPath: {
type: String, type: String,
required: false, required: false,
...@@ -228,6 +233,7 @@ export default { ...@@ -228,6 +233,7 @@ export default {
:is-submitting="isSubmitting" :is-submitting="isSubmitting"
:related-issues="state.relatedIssues" :related-issues="state.relatedIssues"
:can-admin="canAdmin" :can-admin="canAdmin"
:can-reorder="canReorder"
:pending-references="state.pendingReferences" :pending-references="state.pendingReferences"
:is-form-visible="isFormVisible" :is-form-visible="isFormVisible"
:input-value="inputValue" :input-value="inputValue"
......
...@@ -59,3 +59,4 @@ ...@@ -59,3 +59,4 @@
@import "framework/memory_graph"; @import "framework/memory_graph";
@import "framework/responsive_tables"; @import "framework/responsive_tables";
@import "framework/stacked-progress-bar"; @import "framework/stacked-progress-bar";
@import "framework/sortable";
.sortable-chosen .sortable-hidden {
display: none;
}
...@@ -664,7 +664,6 @@ ...@@ -664,7 +664,6 @@
padding-right: $gl-padding; padding-right: $gl-padding;
.issue-main-info { .issue-main-info {
flex: 1 auto;
margin-right: 10px; margin-right: 10px;
min-width: 0; min-width: 0;
} }
......
...@@ -140,6 +140,7 @@ ...@@ -140,6 +140,7 @@
<related-issues-root <related-issues-root
:endpoint="issueLinksEndpoint" :endpoint="issueLinksEndpoint"
:can-admin="canAdmin" :can-admin="canAdmin"
:can-reorder="canAdmin"
:allow-auto-complete="false" :allow-auto-complete="false"
title="Issues" title="Issues"
/> />
......
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