Commit ffc1137e authored by Simon Knox's avatar Simon Knox

include author and assignee from board config

parent 83941288
......@@ -70,7 +70,10 @@ $(() => {
detailIssue: Store.detail,
milestoneTitle: $boardApp.dataset.boardMilestoneTitle,
weight: $boardApp.dataset.boardWeight,
authorUsername: $boardApp.dataset.boardAuthorUsername,
assigneeUsername: $boardApp.dataset.boardAssigneeUsername,
defaultAvatar: $boardApp.dataset.defaultAvatar,
cantEdit: [],
},
computed: {
detailIssueVisible () {
......@@ -78,26 +81,19 @@ $(() => {
},
},
created () {
const cantEdit = [];
if (this.milestoneTitle) {
const milestoneTitleParam = `milestone_title=${this.milestoneTitle}`;
Store.filter.path = [milestoneTitleParam].concat(
Store.filter.path.split('&').filter(param => param.match(/^milestone_title=(.*)$/g) === null)
).join('&');
cantEdit.push('milestone');
}
if (this.weight) {
const weightParam = `weight=${this.weight}`;
Store.filter.path = [weightParam].concat(
Store.filter.path.split('&').filter(param => param.match(/^weight=(.*)$/g) === null)
const updateFilterPath = (key, value, tokenName) => {
if (!value) return;
const querystring = `${key}=${value}`;
Store.filter.path = [querystring].concat(
Store.filter.path.split('&').filter(param => param.match(new RegExp(`^${key}=(.*)$`, 'g')) === null)
).join('&');
this.cantEdit.push(tokenName);
};
cantEdit.push('weight');
}
updateFilterPath('milestone_title', this.milestoneTitle, 'milestone');
updateFilterPath('weight', this.weight, 'weight');
updateFilterPath('author_username', this.authorUsername, 'author');
updateFilterPath('assignee_username', this.assigneeUsername, 'assignee');
Store.updateFiltersUrl(true);
......@@ -109,7 +105,7 @@ $(() => {
});
Store.rootPath = this.boardsEndpoint;
this.filterManager = new FilteredSearchBoards(Store.filter, true, cantEdit);
this.filterManager = new FilteredSearchBoards(Store.filter, true, this.cantEdit);
this.filterManager.setup();
// Listen for updateTokens event
......
......@@ -80,6 +80,16 @@
/>
</form-block>
<form-block>
<div>Author</div>
<input v-model="board.author_id" />
</form-block>
<form-block>
<div>Assignee</div>
<input v-model="board.assignee_id" />
</form-block>
<form-block
title="Weight"
defaultText="Any weight"
......
......@@ -46,18 +46,15 @@ gl.issueBoards.BoardsStore = {
this.state.reload = false;
this.state.currentPage = page;
},
updateBoardConfig({
name,
id,
milestone,
milestone_id,
labels = [],
}) {
this.boardConfig.name = name;
this.boardConfig.milestone = milestone;
this.boardConfig.milestone_id = milestone_id;
this.boardConfig.id = id;
this.boardConfig.labels = labels;
updateBoardConfig(board) {
this.boardConfig.name = board.name;
this.boardConfig.milestone = board.milestone;
this.boardConfig.milestone_id = board.milestone_id;
this.boardConfig.id = board.id;
this.boardConfig.weight = board.weight;
this.boardConfig.labels = board.labels || [];
this.boardConfig.author_id = board.author_id;
this.boardConfig.assignee_id = board.assignee_id;
},
addList (listObj, defaultAvatar) {
const list = new List(listObj, defaultAvatar);
......
......@@ -38,23 +38,14 @@ class FilteredSearchVisualTokens {
}
static createVisualTokenElementHTML(canEdit = true) {
if (!canEdit) return '';
let removeTokenMarkup = '';
if (canEdit) {
removeTokenMarkup = `
<div class="remove-token" role="button">
<i class="fa fa-close"></i>
</div>
`;
}
return `
<div class="selectable" role="button" ${canEdit ? '' : 'style="display: none;"'}>
<div class="name"></div>
<div class="value-container">
<div class="value"></div>
${removeTokenMarkup}
<div class="remove-token" role="button">
<i class="fa fa-close"></i>
</div>
</div>
</div>
`;
......
......@@ -26,9 +26,11 @@ module BoardsHelper
board = @board || @boards.first
board.to_json(
only: [:id, :name, :milestone_id],
only: [:id, :name, :milestone_id, :author_id, :assignee_id, :weight],
include: {
milestone: { only: [:title] }
milestone: { only: [:title] },
author: { only: [:name, :username ], methods: [:avatar_url] },
assignee: { only: [:name, :username ], methods: [:avatar_url] }
}
)
end
......
......@@ -7,6 +7,8 @@ module EE
def board_data
data = {
board_milestone_title: board&.milestone&.title,
board_author_username: board&.author&.username,
board_assignee_username: board&.assignee&.username,
board_weight: board&.weight,
focus_mode_available: parent.feature_available?(:issue_board_focus_mode).to_s,
show_promotion: (@project && show_promotions? && (!@project.feature_available?(:multiple_issue_boards) || !@project.feature_available?(:scoped_issue_board) || !@project.feature_available?(:issue_board_focus_mode))).to_s
......
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