Commit 45988b78 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'new-board-reload-page' into 'master'

Open new board after creating it

Closes gitlab-ce#29611

See merge request !1449
parents 93c1ed5a 161d77e0
...@@ -78,6 +78,7 @@ $(() => { ...@@ -78,6 +78,7 @@ $(() => {
} }
gl.boardService = new BoardService(this.endpoint, this.bulkUpdatePath, this.boardId); gl.boardService = new BoardService(this.endpoint, this.bulkUpdatePath, this.boardId);
Store.rootPath = this.endpoint;
this.filterManager = new FilteredSearchBoards(Store.filter, true, [(this.milestoneTitle ? 'milestone' : null)]); this.filterManager = new FilteredSearchBoards(Store.filter, true, [(this.milestoneTitle ? 'milestone' : null)]);
......
...@@ -81,7 +81,7 @@ const extraMilestones = require('../mixins/extra_milestones'); ...@@ -81,7 +81,7 @@ const extraMilestones = require('../mixins/extra_milestones');
}, },
submit() { submit() {
gl.boardService.createBoard(this.board) gl.boardService.createBoard(this.board)
.then(() => { .then((resp) => {
if (this.currentBoard && this.currentPage !== 'new') { if (this.currentBoard && this.currentPage !== 'new') {
this.currentBoard.name = this.board.name; this.currentBoard.name = this.board.name;
...@@ -89,14 +89,17 @@ const extraMilestones = require('../mixins/extra_milestones'); ...@@ -89,14 +89,17 @@ const extraMilestones = require('../mixins/extra_milestones');
// We reload the page to make sure the store & state of the app are correct // We reload the page to make sure the store & state of the app are correct
this.refreshPage(); this.refreshPage();
} }
}
// Enable the button thanks to our jQuery disabling it // Enable the button thanks to our jQuery disabling it
$(this.$refs.submitBtn).enable(); $(this.$refs.submitBtn).enable();
// Reset the selectors current page // Reset the selectors current page
Store.state.currentPage = ''; Store.state.currentPage = '';
Store.state.reload = true; Store.state.reload = true;
} else if (this.currentPage === 'new') {
const data = resp.json();
gl.utils.visitUrl(`${Store.rootPath}/${data.id}`);
}
}); });
}, },
cancel() { cancel() {
......
...@@ -24,9 +24,8 @@ describe 'Board with milestone', :feature, :js do ...@@ -24,9 +24,8 @@ describe 'Board with milestone', :feature, :js do
it 'creates board with milestone' do it 'creates board with milestone' do
create_board_with_milestone create_board_with_milestone
click_link 'test'
expect(find('.tokens-container')).to have_content(milestone.title) expect(find('.tokens-container')).to have_content(milestone.title)
wait_for_vue_resource
expect(all('.board')[1]).to have_selector('.card', count: 1) expect(all('.board')[1]).to have_selector('.card', count: 1)
end end
end end
......
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