Sync the class change of Edit Column Button to JS code (#23400)
In #22767, we changed the class of `Edit Column` button from `red` to `primary` But `red` is used to find this button in js..... --------- Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
c6f5029708
commit
e72290fd9a
|
@ -128,7 +128,7 @@
|
||||||
|
|
||||||
<div class="text right actions">
|
<div class="text right actions">
|
||||||
<div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
|
<div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
|
||||||
<button data-url="{{$.Link}}/{{.ID}}" class="ui primary button">{{$.locale.Tr "repo.projects.column.edit"}}</button>
|
<button data-url="{{$.Link}}/{{.ID}}" class="ui primary button edit-column-button">{{$.locale.Tr "repo.projects.column.edit"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -95,39 +95,35 @@ export function initRepoProject() {
|
||||||
$('.edit-project-board').each(function () {
|
$('.edit-project-board').each(function () {
|
||||||
const projectHeader = $(this).closest('.board-column-header');
|
const projectHeader = $(this).closest('.board-column-header');
|
||||||
const projectTitleLabel = projectHeader.find('.board-label');
|
const projectTitleLabel = projectHeader.find('.board-label');
|
||||||
const projectTitleInput = $(this).find(
|
const projectTitleInput = $(this).find('.project-board-title');
|
||||||
'.content > .form > .field > .project-board-title',
|
const projectColorInput = $(this).find('#new_board_color');
|
||||||
);
|
|
||||||
const projectColorInput = $(this).find('.content > .form > .field #new_board_color');
|
|
||||||
const boardColumn = $(this).closest('.board-column');
|
const boardColumn = $(this).closest('.board-column');
|
||||||
|
|
||||||
if (boardColumn.css('backgroundColor')) {
|
if (boardColumn.css('backgroundColor')) {
|
||||||
setLabelColor(projectHeader, rgbToHex(boardColumn.css('backgroundColor')));
|
setLabelColor(projectHeader, rgbToHex(boardColumn.css('backgroundColor')));
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this)
|
$(this).find('.edit-column-button').on('click', function (e) {
|
||||||
.find('.content > .form > .actions > .red')
|
e.preventDefault();
|
||||||
.on('click', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: $(this).data('url'),
|
url: $(this).data('url'),
|
||||||
data: JSON.stringify({title: projectTitleInput.val(), color: projectColorInput.val()}),
|
data: JSON.stringify({title: projectTitleInput.val(), color: projectColorInput.val()}),
|
||||||
headers: {
|
headers: {
|
||||||
'X-Csrf-Token': csrfToken,
|
'X-Csrf-Token': csrfToken,
|
||||||
},
|
},
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
}).done(() => {
|
}).done(() => {
|
||||||
projectTitleLabel.text(projectTitleInput.val());
|
projectTitleLabel.text(projectTitleInput.val());
|
||||||
projectTitleInput.closest('form').removeClass('dirty');
|
projectTitleInput.closest('form').removeClass('dirty');
|
||||||
if (projectColorInput.val()) {
|
if (projectColorInput.val()) {
|
||||||
setLabelColor(projectHeader, projectColorInput.val());
|
setLabelColor(projectHeader, projectColorInput.val());
|
||||||
}
|
}
|
||||||
boardColumn.attr('style', `background: ${projectColorInput.val()}!important`);
|
boardColumn.attr('style', `background: ${projectColorInput.val()}!important`);
|
||||||
$('.ui.modal').modal('hide');
|
$('.ui.modal').modal('hide');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.set-default-project-board', async function (e) {
|
$(document).on('click', '.set-default-project-board', async function (e) {
|
||||||
|
|
Loading…
Reference in New Issue