Commit aaf176f2 authored by Phil Hughes's avatar Phil Hughes

Updates new dropdown list when removing lists

parent 9982dc1d
......@@ -11,11 +11,10 @@ $(() => {
});
},
renderRow: (label) => {
const isHidden = BoardsStore.findList('title', label.title),
$li = $('<li />', {
class: (isHidden ? 'hidden' : '')
}),
const active = BoardsStore.findList('title', label.title),
$li = $('<li />',),
$a = $('<a />', {
class: (active ? 'is-active' : ''),
text: label.title,
href: '#'
}),
......@@ -33,6 +32,8 @@ $(() => {
selectable: true,
clicked: (label, $el, e) => {
e.preventDefault();
if (!BoardsStore.findList('title', label.title)) {
BoardsStore.new({
title: label.title,
position: BoardsStore.state.lists.length - 1,
......@@ -40,10 +41,10 @@ $(() => {
id: label.id,
title: label.title,
color: label.color
},
issues: []
}
});
}
}
});
});
});
......@@ -18,10 +18,15 @@
if (persist) {
list.save();
this.removeBlankState();
this.updateNewListDropdown();
}
return list;
},
updateNewListDropdown: function () {
const data = $('.js-new-board-list').data('glDropdown').renderedData;
$('.js-new-board-list').data('glDropdown').renderData(data);
},
shouldAddBlankState: function () {
// Decide whether to add the blank state
let addBlankState = true;
......@@ -73,6 +78,8 @@
this.state.lists = _.reject(this.state.lists, (list) => {
return list.id === id;
});
this.updateNewListDropdown();
},
moveList: function (oldIndex, newIndex) {
const listFrom = this.findList('position', oldIndex),
......
......@@ -33,7 +33,7 @@
.dropdown
%button.btn.btn-create.js-new-board-list{ type: "button", data: { toggle: "dropdown", labels: labels_filter_path } }
Create new list
.dropdown-menu.dropdown-menu-paging.dropdown-menu-align-right.dropdown-menu-issues-board-new
.dropdown-menu.dropdown-menu-paging.dropdown-menu-align-right.dropdown-menu-issues-board-new.dropdown-menu-selectable
= render partial: "shared/issuable/label_page_default", locals: { show_footer: true, show_create: true, show_boards_content: true, title: "Create a new list" }
- if can?(current_user, :admin_label, @project)
= render partial: "shared/issuable/label_page_create"
......
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