Move to column of same name by default.
This commit is contained in:
parent
de0a4e5dec
commit
7b1a2dc653
1 changed files with 22 additions and 4 deletions
26
index.html
26
index.html
|
|
@ -1858,6 +1858,10 @@ chmod 755 kbtd
|
||||||
const moveModal = createModal('move-modal', (data) => {
|
const moveModal = createModal('move-modal', (data) => {
|
||||||
moveModalState = data;
|
moveModalState = data;
|
||||||
|
|
||||||
|
const currentSection = state.sections[state.currentSectionIndex];
|
||||||
|
const currentColumn = currentSection.columns[data.sourceColIndex];
|
||||||
|
const currentColumnName = currentColumn.name;
|
||||||
|
|
||||||
const projectSelect = $('#target-project-select');
|
const projectSelect = $('#target-project-select');
|
||||||
projectSelect.replaceChildren(
|
projectSelect.replaceChildren(
|
||||||
...state.sections.map((section, index) =>
|
...state.sections.map((section, index) =>
|
||||||
|
|
@ -1869,7 +1873,7 @@ chmod 755 kbtd
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
updateColumnSelect();
|
updateColumnSelect(currentColumnName);
|
||||||
}, () => {
|
}, () => {
|
||||||
moveModalState = {
|
moveModalState = {
|
||||||
cardLineNumber: null,
|
cardLineNumber: null,
|
||||||
|
|
@ -1879,17 +1883,28 @@ chmod 755 kbtd
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateColumnSelect() {
|
function updateColumnSelect(defaultColumnName = null) {
|
||||||
const projectSelect = $('#target-project-select');
|
const projectSelect = $('#target-project-select');
|
||||||
const selectedProjectIndex = parseInt(projectSelect.value);
|
const selectedProjectIndex = parseInt(projectSelect.value);
|
||||||
const selectedProject = state.sections[selectedProjectIndex];
|
const selectedProject = state.sections[selectedProjectIndex];
|
||||||
|
|
||||||
|
let defaultIndex = 0;
|
||||||
|
if (defaultColumnName) {
|
||||||
|
const matchingIndex = selectedProject.columns.findIndex(
|
||||||
|
col => col.name === defaultColumnName
|
||||||
|
);
|
||||||
|
if (matchingIndex !== -1) {
|
||||||
|
defaultIndex = matchingIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const columnSelect = $('#target-column-select');
|
const columnSelect = $('#target-column-select');
|
||||||
columnSelect.replaceChildren(
|
columnSelect.replaceChildren(
|
||||||
...selectedProject.columns.map((column, index) =>
|
...selectedProject.columns.map((column, index) =>
|
||||||
h('option', {
|
h('option', {
|
||||||
value: index,
|
value: index,
|
||||||
textContent: column.name
|
textContent: column.name,
|
||||||
|
selected: index === defaultIndex
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -2722,7 +2737,10 @@ chmod 755 kbtd
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#target-project-select').onchange = () => {
|
$('#target-project-select').onchange = () => {
|
||||||
updateColumnSelect();
|
const currentSection = state.sections[state.currentSectionIndex];
|
||||||
|
const currentColumn = currentSection.columns[moveModalState.sourceColIndex];
|
||||||
|
const currentColumnName = currentColumn ? currentColumn.name : null;
|
||||||
|
updateColumnSelect(currentColumnName);
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#move-cancel-btn').onclick = () => {
|
$('#move-cancel-btn').onclick = () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue