Commit c42728f0 authored by Simon Knox's avatar Simon Knox

fix form to work with popup_dialog, remove some unused values

parent f6dd6228
...@@ -12,6 +12,15 @@ window.gl = window.gl || {}; ...@@ -12,6 +12,15 @@ window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {}; window.gl.issueBoards = window.gl.issueBoards || {};
const Store = gl.issueBoards.BoardsStore; const Store = gl.issueBoards.BoardsStore;
const boardDefaults = {
id: false,
name: '',
labels: [],
milestone_id: undefined,
assignee: {},
assignee_id: undefined,
weight: null,
};
export default { export default {
props: { props: {
...@@ -49,7 +58,7 @@ export default { ...@@ -49,7 +58,7 @@ export default {
}, },
data() { data() {
return { return {
board: { ...Store.state.currentBoard }, board: { ...boardDefaults, ...this.currentBoard },
expanded: false, expanded: false,
issue: {}, issue: {},
currentBoard: Store.state.currentBoard, currentBoard: Store.state.currentBoard,
...@@ -151,18 +160,9 @@ export default { ...@@ -151,18 +160,9 @@ export default {
resetFormState() { resetFormState() {
if (this.isNewForm) { if (this.isNewForm) {
// Clear the form when we open the "New board" modal // Clear the form when we open the "New board" modal
this.board = { this.board = { ...boardDefaults };
id: false,
name: '',
labels: [],
milestone: {},
milestone_id: undefined,
assignee: {},
assignee_id: undefined,
weight: null,
};
} else if (this.currentBoard && Object.keys(this.currentBoard).length) { } else if (this.currentBoard && Object.keys(this.currentBoard).length) {
this.board = { ...this.currentBoard }; this.board = { ...boardDefaults, ...this.currentBoard };
} }
}, },
}, },
...@@ -187,88 +187,88 @@ export default { ...@@ -187,88 +187,88 @@ export default {
@toggle="cancel" @toggle="cancel"
@submit="submit" @submit="submit"
> >
<p v-if="isDeleteForm"> <template slot="body">
Are you sure you want to delete this board? <p v-if="isDeleteForm">
</p> Are you sure you want to delete this board?
<form </p>
v-else <form
class="js-board-config-modal" v-else
> class="js-board-config-modal"
<div
v-if="!readonly"
class="append-bottom-20"
> >
<label
class="form-section-title label-light"
for="board-new-name"
>
Board name
</label>
<input
ref="name"
class="form-control"
type="text"
id="board-new-name"
v-model="board.name"
placeholder="Enter board name"
>
</div>
<div v-if="scopedIssueBoardFeatureEnabled">
<div <div
v-if="canAdminBoard" v-if="!readonly"
class="media append-bottom-10" class="append-bottom-20"
> >
<label class="form-section-title label-light media-body"> <label
Board scope class="form-section-title label-light"
for="board-new-name"
>
Board name
</label> </label>
<button <input
type="button" ref="name"
class="btn" class="form-control"
@click="expanded = !expanded" type="text"
v-if="collapseScope" id="board-new-name"
v-model="board.name"
placeholder="Enter board name"
> >
{{ expandButtonText }}
</button>
</div> </div>
<p class="text-secondary append-bottom-10"> <div v-if="scopedIssueBoardFeatureEnabled">
Board scope affects which issues are displayed for anyone who visits this board <div
</p> v-if="canAdminBoard"
<div v-if="!collapseScope || expanded"> class="media append-bottom-10"
<board-milestone-select >
:board="board" <label class="form-section-title label-light media-body">
:milestone-path="milestonePath" Board scope
title="Milestone" </label>
:can-edit="canAdminBoard" <button
/> type="button"
class="btn"
@click="expanded = !expanded"
v-if="collapseScope"
>
{{ expandButtonText }}
</button>
</div>
<p class="text-secondary append-bottom-10">
Board scope affects which issues are displayed for anyone who visits this board
</p>
<div v-if="!collapseScope || expanded">
<board-milestone-select
:board="board"
:milestone-path="milestonePath"
:can-edit="canAdminBoard"
/>
<board-labels-select <board-labels-select
:board="board" :board="board"
title="Labels" :can-edit="canAdminBoard"
:can-edit="canAdminBoard" :labels-path="labelsPath"
:labels-path="labelsPath" />
/>
<user-select <user-select
any-user-text="Any assignee" any-user-text="Any assignee"
:board="board" :board="board"
field-name="assignee_id" field-name="assignee_id"
label="Assignee" label="Assignee"
:selected="board.assignee" :selected="board.assignee"
:can-edit="canAdminBoard" :can-edit="canAdminBoard"
placeholder-text="Select assignee" placeholder-text="Select assignee"
:project-id="projectId" :project-id="projectId"
:group-id="groupId" :group-id="groupId"
wrapper-class="assignee" wrapper-class="assignee"
/> />
<board-weight-select <board-weight-select
:board="board" :board="board"
:weights="weightsArray" :weights="weightsArray"
v-model="board.weight" v-model="board.weight"
:can-edit="canAdminBoard" :can-edit="canAdminBoard"
/> />
</div>
</div> </div>
</div> </form>
</form> </template>
</popup-dialog> </popup-dialog>
</template> </template>
...@@ -45,12 +45,6 @@ body.modal-open { ...@@ -45,12 +45,6 @@ body.modal-open {
.modal.popup-dialog { .modal.popup-dialog {
display: block; display: block;
@media (min-width: $screen-md-min) {
.modal-dialog {
margin-top: $new-navbar-height;
}
}
} }
.modal-body { .modal-body {
......
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