Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 01:44:24 +01:00

ui: improve git notes

This commit is contained in:
0ko 2024-11-19 10:27:57 +05:00
parent 298863c701
commit f5c0570533
3 changed files with 9 additions and 8 deletions

View file

@ -2622,9 +2622,9 @@ diff.browse_source = Browse source
diff.parent = parent diff.parent = parent
diff.commit = commit diff.commit = commit
diff.git-notes = Notes diff.git-notes = Notes
diff.git-notes.add = Add Note diff.git-notes.add = Add note
diff.git-notes.remove-header = Remove Note diff.git-notes.remove-header = Remove note
diff.git-notes.remove-body = This will remove this Note diff.git-notes.remove-body = This note will be removed.
diff.data_not_available = Diff content is not available diff.data_not_available = Diff content is not available
diff.options_button = Diff options diff.options_button = Diff options
diff.show_diff_stats = Show stats diff.show_diff_stats = Show stats

View file

@ -128,6 +128,9 @@
</form> </form>
</div> </div>
</div> </div>
<div id="commit-notes-add-button" class="item">
{{ctx.Locale.Tr "repo.diff.git-notes.add"}}
</div>
</div> </div>
</div> </div>
{{end}} {{end}}
@ -277,20 +280,20 @@
<span class="text grey" id="note-authored-time">{{DateUtils.TimeSince .NoteCommit.Author.When}}</span> <span class="text grey" id="note-authored-time">{{DateUtils.TimeSince .NoteCommit.Author.When}}</span>
{{if or ($.Permission.CanWrite $.UnitTypeCode) (not $.Repository.IsArchived) (not .IsDeleted)}} {{if or ($.Permission.CanWrite $.UnitTypeCode) (not $.Repository.IsArchived) (not .IsDeleted)}}
<div class="ui right"> <div class="ui right">
<button id="commit-notes-edit-button" class="ui tiny button yellow" data-modal="#delete-note-modal">{{ctx.Locale.Tr "edit"}}</button> <button id="commit-notes-edit-button" class="ui tiny primary button" data-modal="#delete-note-modal">{{ctx.Locale.Tr "edit"}}</button>
<button class="ui tiny button red show-modal" data-modal="#delete-note-modal">{{ctx.Locale.Tr "remove"}}</button> <button class="ui tiny button red show-modal" data-modal="#delete-note-modal">{{ctx.Locale.Tr "remove"}}</button>
</div> </div>
<div class="ui small modal" id="delete-note-modal"> <div class="ui small modal" id="delete-note-modal">
<div class="header"> <div class="header">
{{ctx.Locale.Tr "repo.diff.git-notes.remove-header"}} {{ctx.Locale.Tr "repo.diff.git-notes.remove-header"}}
</div> </div>
<p>{{ctx.Locale.Tr "repo.diff.git-notes.remove-body"}}</p>
<div class="content"> <div class="content">
<p>{{ctx.Locale.Tr "repo.diff.git-notes.remove-body"}}</p>
<div class="text right actions"> <div class="text right actions">
<form action="{{.Link}}/notes/remove" method="post"> <form action="{{.Link}}/notes/remove" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<button type="button" class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button type="button" class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button type="submit" class="ui primary button red" href="{{.Link}}/notes/remove">{{ctx.Locale.Tr "remove"}}</button> <button type="submit" class="ui red button" href="{{.Link}}/notes/remove">{{ctx.Locale.Tr "remove"}}</button>
</form> </form>
</div> </div>
</div> </div>
@ -316,7 +319,6 @@
</div> </div>
{{end}} {{end}}
{{else if and ($.Permission.CanWrite $.UnitTypeCode) (not $.Repository.IsArchived) (not .IsDeleted)}} {{else if and ($.Permission.CanWrite $.UnitTypeCode) (not $.Repository.IsArchived) (not .IsDeleted)}}
<button id="commit-notes-add-button" class="ui primary button green tw-mt-3">{{ctx.Locale.Tr "repo.diff.git-notes.add"}}</button>
<div id="commit-notes-add-area" class="ui tw-mt-3 segment tw-hidden"> <div id="commit-notes-add-area" class="ui tw-mt-3 segment tw-hidden">
<form class="ui form" action="{{.Link}}/notes" method="post"> <form class="ui form" action="{{.Link}}/notes" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}

View file

@ -38,7 +38,6 @@ export function initCommitNotes() {
const notesAddButton = document.getElementById('commit-notes-add-button'); const notesAddButton = document.getElementById('commit-notes-add-button');
if (notesAddButton !== null) { if (notesAddButton !== null) {
notesAddButton.addEventListener('click', () => { notesAddButton.addEventListener('click', () => {
notesAddButton.classList.add('tw-hidden');
document.getElementById('commit-notes-add-area').classList.remove('tw-hidden'); document.getElementById('commit-notes-add-area').classList.remove('tw-hidden');
}); });
} }