]> source.dussan.org Git - gitea.git/commitdiff
Fix admin notice view-detail (#30450) (#30458)
authorGiteabot <teabot@gitea.io>
Sat, 13 Apr 2024 08:49:44 +0000 (16:49 +0800)
committerGitHub <noreply@github.com>
Sat, 13 Apr 2024 08:49:44 +0000 (10:49 +0200)
Backport #30450 by @silverwind

Fix https://github.com/go-gitea/gitea/issues/30434, regression from
https://github.com/go-gitea/gitea/pull/30115.

I also removed the date insertion into the modal which was also broken
since that date was switched to `absolute-date` because I see no real
purpose to putting that date into the modal.

Result:

<img width="1038" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/aa2eb8b4-73dc-4d98-9b80-3f276f89d9e5">

Co-authored-by: silverwind <me@silverwind.io>
templates/admin/notice.tmpl
web_src/js/features/admin/common.js

index 5ea003e5ec12da8b831e30b628ea209e11152a1d..33d8a2f9632df46cf2e801f7172d65afce09808b 100644 (file)
 
 <div class="ui modal admin" id="detail-modal">
        <div class="header">{{ctx.Locale.Tr "admin.notices.view_detail_header"}}</div>
-       <div class="content">
-               <div class="sub header"></div>
-               <pre></pre>
-       </div>
+       <div class="content"><pre></pre></div>
 </div>
 
 {{template "admin/layout_footer" .}}
index f388b1122ec5e5dd7205b0eb7082cff970d89def..b35502d52f9fa7d77d6630df1aab2122a736c5e6 100644 (file)
@@ -207,13 +207,13 @@ export function initAdminCommon() {
 
   // Notice
   if (document.querySelector('.admin.notice')) {
-    const $detailModal = document.getElementById('detail-modal');
+    const detailModal = document.getElementById('detail-modal');
 
     // Attach view detail modals
     $('.view-detail').on('click', function () {
-      $detailModal.find('.content pre').text($(this).parents('tr').find('.notice-description').text());
-      $detailModal.find('.sub.header').text(this.closest('tr')?.querySelector('relative-time')?.getAttribute('title'));
-      $detailModal.modal('show');
+      const description = this.closest('tr').querySelector('.notice-description').textContent;
+      detailModal.querySelector('.content pre').textContent = description;
+      $(detailModal).modal('show');
       return false;
     });