mirror of
https://codeberg.org/forgejo/forgejo
synced 2025-10-20 02:10:55 +02:00
Followup to https://codeberg.org/forgejo/forgejo/pulls/9317#issuecomment-7214470. Summary of changes: - implement new CSS for buttons that doesn't have problems Fomantic buttons have: - button height doesn't depend on it's content - `min-height:` is used instead of `padding-{top,bottom}:` - no margins to fit right in with the other elements while relying on `display:flex` and `flex-gap:` - other `.button` changes compared to `.ui.button`: - no semi-bold black text for now, I think it looks just as fine with normal weight - no variable `font-size` - should give better readability compared to existing `.small` and `.tiny` buttons - variable height depending on specified size (currently normal or `.small`) and on `@media (pointer: )` - apply the new buttons to areas where there are switches or dropdown openers near them Before: - https://codeberg.org/forgejo/forgejo/attachments/8d9a3941-8889-4420-8f4f-f44cb8c3726f - https://codeberg.org/forgejo/forgejo/attachments/e5804fae-a71f-43ba-918b-20d4f742124c - https://codeberg.org/forgejo/forgejo/attachments/65d4e31c-01b7-4050-89a1-4afe74aa574c - https://codeberg.org/forgejo/forgejo/attachments/c8057262-a834-4b61-a87f-70dab60b5506 - https://codeberg.org/forgejo/forgejo/attachments/aa9508e3-dca1-4ffe-913e-9cbddbb0d6ff - https://codeberg.org/forgejo/forgejo/attachments/4b2daa07-e0ca-4b44-8795-1609dff8968f - https://codeberg.org/forgejo/forgejo/attachments/93f7803f-1338-44dc-a428-e44e26231517 After: - https://codeberg.org/forgejo/forgejo/attachments/ca5426c4-d75e-493d-8b29-64eee1e1c9de - https://codeberg.org/forgejo/forgejo/attachments/f21c7219-6880-4a2e-9117-6267d46b3081 - https://codeberg.org/forgejo/forgejo/attachments/da3ee771-b5d5-4b4f-8c88-9a8de11b1a45 - https://codeberg.org/forgejo/forgejo/attachments/56f974c3-f72e-4f80-9bbd-5bc785a4a624 - https://codeberg.org/forgejo/forgejo/attachments/17f6e360-dfe5-4bb6-a6b5-dd747dbc2af8 - https://codeberg.org/forgejo/forgejo/attachments/91cd10e1-6c5e-4134-be4c-18223ed2a4f4 - https://codeberg.org/forgejo/forgejo/attachments/f0322c5c-ee9d-4889-9840-0c46838566cc - https://codeberg.org/forgejo/forgejo/attachments/96560fe7-3436-46dc-8456-c43bfaee2daf - https://codeberg.org/forgejo/forgejo/attachments/273cf795-6bb4-479f-804f-f40010fae825 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9359 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org>
130 lines
5.4 KiB
Go HTML Template
130 lines
5.4 KiB
Go HTML Template
<div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_div" data-sequence-number="{{.SequenceNumber}}">
|
|
<div class="ui container">
|
|
{{$notificationUnreadCount := call .NotificationUnreadCount}}
|
|
<div class="tw-flex tw-items-center tw-justify-between tw-mb-4 tw-gap-2">
|
|
<div class="switch">
|
|
<a class="{{if eq .Status 1}}active {{end}}item" href="{{AppSubUrl}}/notifications?q=unread">
|
|
{{ctx.Locale.Tr "notification.unread"}}
|
|
<div class="notifications-unread-count ui label {{if not $notificationUnreadCount}}tw-hidden{{end}}">{{$notificationUnreadCount}}</div>
|
|
</a>
|
|
<a class="{{if eq .Status 2}}active {{end}}item" href="{{AppSubUrl}}/notifications?q=read">
|
|
{{ctx.Locale.Tr "notification.read"}}
|
|
</a>
|
|
</div>
|
|
<div class="button-row tw-flex">
|
|
<a class="secondary button" href="{{AppSubUrl}}/notifications/subscriptions">
|
|
{{ctx.Locale.Tr "notification.subscriptions"}}
|
|
</a>
|
|
{{if and (eq .Status 1)}}
|
|
<form class="{{if not $notificationUnreadCount}}tw-hidden{{end}}" action="{{AppSubUrl}}/notifications/purge" method="post">
|
|
{{$.CsrfTokenHtml}}
|
|
<div>
|
|
<button class="primary button" title="{{ctx.Locale.Tr "notification.mark_all_as_read"}}">
|
|
{{svg "octicon-checklist"}}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<div class="tw-p-0">
|
|
<div id="notification_table">
|
|
{{if not .Notifications}}
|
|
<div class="tw-flex tw-items-center tw-flex-col tw-p-4">
|
|
{{svg "octicon-inbox" 56 "tw-mb-4"}}
|
|
{{if eq .Status 1}}
|
|
{{ctx.Locale.Tr "notification.no_unread"}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "notification.no_read"}}
|
|
{{end}}
|
|
</div>
|
|
{{else}}
|
|
{{range $notification := .Notifications}}
|
|
<div class="notifications-item tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-p-2" id="notification_{{.ID}}" data-status="{{.Status}}">
|
|
<div class="notifications-icon tw-ml-2 tw-mr-1 tw-self-start tw-mt-1">
|
|
{{if .Issue}}
|
|
{{template "shared/issueicon" .Issue}}
|
|
{{else}}
|
|
{{svg "octicon-repo" 16 "text grey"}}
|
|
{{end}}
|
|
</div>
|
|
<a class="notifications-link tw-flex tw-flex-1 tw-flex-col silenced" href="{{.Link ctx}}">
|
|
<div class="notifications-top-row tw-text-13 tw-break-anywhere">
|
|
{{.Repository.FullName}} {{if .Issue}}<span class="text light-3">#{{.Issue.Index}}</span>{{end}}
|
|
{{if eq .Status 3}}
|
|
{{svg "octicon-pin" 13 "text blue tw-mt-0.5 tw-ml-1"}}
|
|
{{end}}
|
|
</div>
|
|
<div class="notifications-bottom-row tw-text-16 tw-py-0.5">
|
|
<span class="issue-title tw-break-anywhere">
|
|
{{if .Issue}}
|
|
{{RenderRefIssueTitle $.Context .Issue.Title}}
|
|
{{else}}
|
|
{{.Repository.FullName}}
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
</a>
|
|
<div class="notifications-updated tw-items-center tw-mr-2">
|
|
{{if .Issue}}
|
|
{{DateUtils.TimeSince .Issue.UpdatedUnix}}
|
|
{{else}}
|
|
{{DateUtils.TimeSince .UpdatedUnix}}
|
|
{{end}}
|
|
</div>
|
|
<div class="notifications-buttons tw-items-center tw-justify-end tw-gap-1 tw-px-1">
|
|
{{if ne .Status 3}}
|
|
<form action="{{AppSubUrl}}/notifications/status" method="post">
|
|
{{$.CsrfTokenHtml}}
|
|
<input type="hidden" name="notification_id" value="{{.ID}}">
|
|
<input type="hidden" name="status" value="pinned">
|
|
<button class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.pin"}}"
|
|
data-url="{{AppSubUrl}}/notifications/status"
|
|
data-status="pinned"
|
|
data-page="{{$.Page.Paginater.Current}}"
|
|
data-notification-id="{{.ID}}"
|
|
data-q="{{$.Keyword}}">
|
|
{{svg "octicon-pin"}}
|
|
</button>
|
|
</form>
|
|
{{end}}
|
|
{{if or (eq .Status 1) (eq .Status 3)}}
|
|
<form action="{{AppSubUrl}}/notifications/status" method="post">
|
|
{{$.CsrfTokenHtml}}
|
|
<input type="hidden" name="notification_id" value="{{.ID}}">
|
|
<input type="hidden" name="status" value="read">
|
|
<input type="hidden" name="page" value="{{$.Page.Paginater.Current}}">
|
|
<button class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.mark_as_read"}}"
|
|
data-url="{{AppSubUrl}}/notifications/status"
|
|
data-status="read"
|
|
data-page="{{$.Page.Paginater.Current}}"
|
|
data-notification-id="{{.ID}}"
|
|
data-q="{{$.Keyword}}">
|
|
{{svg "octicon-check"}}
|
|
</button>
|
|
</form>
|
|
{{else if eq .Status 2}}
|
|
<form action="{{AppSubUrl}}/notifications/status" method="post">
|
|
{{$.CsrfTokenHtml}}
|
|
<input type="hidden" name="notification_id" value="{{.ID}}">
|
|
<input type="hidden" name="status" value="unread">
|
|
<input type="hidden" name="page" value="{{$.Page.Paginater.Current}}">
|
|
<button class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.mark_as_unread"}}"
|
|
data-url="{{AppSubUrl}}/notifications/status"
|
|
data-status="unread"
|
|
data-page="{{$.Page.Paginater.Current}}"
|
|
data-notification-id="{{.ID}}"
|
|
data-q="{{$.Keyword}}">
|
|
{{svg "octicon-bell"}}
|
|
</button>
|
|
</form>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{template "base/paginate" .}}
|
|
</div>
|
|
</div>
|