Commit ffc1137e authored by Simon Knox's avatar Simon Knox

include author and assignee from board config

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