Commit aaf176f2 authored by Phil Hughes's avatar Phil Hughes

Updates new dropdown list when removing lists

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