Skip to content

Commit e72290f

Browse files
yp05327techknowlogickzeripath
authored
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 <[email protected]> Co-authored-by: zeripath <[email protected]>
1 parent c6f5029 commit e72290f

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

templates/projects/view.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128

129129
<div class="text right actions">
130130
<div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
131-
<button data-url="{{$.Link}}/{{.ID}}" class="ui primary button">{{$.locale.Tr "repo.projects.column.edit"}}</button>
131+
<button data-url="{{$.Link}}/{{.ID}}" class="ui primary button edit-column-button">{{$.locale.Tr "repo.projects.column.edit"}}</button>
132132
</div>
133133
</form>
134134
</div>

web_src/js/features/repo-projects.js

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -95,39 +95,35 @@ export function initRepoProject() {
9595
$('.edit-project-board').each(function () {
9696
const projectHeader = $(this).closest('.board-column-header');
9797
const projectTitleLabel = projectHeader.find('.board-label');
98-
const projectTitleInput = $(this).find(
99-
'.content > .form > .field > .project-board-title',
100-
);
101-
const projectColorInput = $(this).find('.content > .form > .field #new_board_color');
98+
const projectTitleInput = $(this).find('.project-board-title');
99+
const projectColorInput = $(this).find('#new_board_color');
102100
const boardColumn = $(this).closest('.board-column');
103101

104102
if (boardColumn.css('backgroundColor')) {
105103
setLabelColor(projectHeader, rgbToHex(boardColumn.css('backgroundColor')));
106104
}
107105

108-
$(this)
109-
.find('.content > .form > .actions > .red')
110-
.on('click', function (e) {
111-
e.preventDefault();
112-
113-
$.ajax({
114-
url: $(this).data('url'),
115-
data: JSON.stringify({title: projectTitleInput.val(), color: projectColorInput.val()}),
116-
headers: {
117-
'X-Csrf-Token': csrfToken,
118-
},
119-
contentType: 'application/json',
120-
method: 'PUT',
121-
}).done(() => {
122-
projectTitleLabel.text(projectTitleInput.val());
123-
projectTitleInput.closest('form').removeClass('dirty');
124-
if (projectColorInput.val()) {
125-
setLabelColor(projectHeader, projectColorInput.val());
126-
}
127-
boardColumn.attr('style', `background: ${projectColorInput.val()}!important`);
128-
$('.ui.modal').modal('hide');
129-
});
106+
$(this).find('.edit-column-button').on('click', function (e) {
107+
e.preventDefault();
108+
109+
$.ajax({
110+
url: $(this).data('url'),
111+
data: JSON.stringify({title: projectTitleInput.val(), color: projectColorInput.val()}),
112+
headers: {
113+
'X-Csrf-Token': csrfToken,
114+
},
115+
contentType: 'application/json',
116+
method: 'PUT',
117+
}).done(() => {
118+
projectTitleLabel.text(projectTitleInput.val());
119+
projectTitleInput.closest('form').removeClass('dirty');
120+
if (projectColorInput.val()) {
121+
setLabelColor(projectHeader, projectColorInput.val());
122+
}
123+
boardColumn.attr('style', `background: ${projectColorInput.val()}!important`);
124+
$('.ui.modal').modal('hide');
130125
});
126+
});
131127
});
132128

133129
$(document).on('click', '.set-default-project-board', async function (e) {

0 commit comments

Comments
 (0)