Add unsubscribe button to broken feed itemsUnverified
92019fa parent: 016bf11 modified
internal/tmpl/feeds.html +14 -6 | @@ -13,16 +13,24 @@ | ||
| 13 | 13 | <p class="text-sm text-spot-secondary mb-6">Manage your RSS and Atom subscriptions.</p> |
| 14 | 14 | |
| 15 | 15 | {{if .DeadFeeds}} |
| 16 | -<div class="bg-spot-red/10 border border-spot-red/30 rounded-lg p-4 mb-6"> | |
| 16 | +<div id="dead-feeds" class="bg-spot-red/10 border border-spot-red/30 rounded-lg p-4 mb-6"> | |
| 17 | 17 | <h3 class="text-sm font-bold text-spot-red mb-2">Feeds with errors ({{len .DeadFeeds}})</h3> |
| 18 | 18 | <div class="space-y-2"> |
| 19 | 19 | {{range .DeadFeeds}} |
| 20 | - <div class="flex items-center justify-between text-sm"> | |
| 21 | - <span class="text-spot-text">{{if .Title.Valid}}{{.Title.String}}{{else}}{{.FeedURL}}{{end}}</span> | |
| 22 | - <div class="flex items-center gap-2"> | |
| 23 | - <span class="text-spot-red text-xs">{{.ErrorCount}} errors</span> | |
| 24 | - {{if .LastError.Valid}}<span class="text-spot-secondary text-xs truncate max-w-48" title="{{.LastError.String}}">{{.LastError.String}}</span>{{end}} | |
| 20 | + <div class="dead-feed-item flex items-center justify-between text-sm"> | |
| 21 | + <div class="min-w-0 flex-1 flex items-center gap-3"> | |
| 22 | + <span class="text-spot-text truncate">{{if .Title.Valid}}{{.Title.String}}{{else}}{{.FeedURL}}{{end}}</span> | |
| 23 | + <div class="flex items-center gap-2 shrink-0"> | |
| 24 | + <span class="text-spot-red text-xs">{{.ErrorCount}} errors</span> | |
| 25 | + {{if .LastError.Valid}}<span class="text-spot-secondary text-xs truncate max-w-48" title="{{.LastError.String}}">{{.LastError.String}}</span>{{end}} | |
| 26 | + </div> | |
| 25 | 27 | </div> |
| 28 | + <form hx-delete="/feeds/remove" hx-target="closest .dead-feed-item" hx-swap="outerHTML swap:0.3s" | |
| 29 | + hx-confirm="Unsubscribe from this broken feed?" class="inline shrink-0 ml-3"> | |
| 30 | + {{csrfInput $.CSRFToken}} | |
| 31 | + <input type="hidden" name="url" value="{{.FeedURL}}"> | |
| 32 | + <button type="submit" class="text-xs text-spot-secondary hover:text-spot-red transition font-bold uppercase">Unsubscribe</button> | |
| 33 | + </form> | |
| 26 | 34 | </div> |
| 27 | 35 | {{end}} |
| 28 | 36 | </div> |
| @@ -13,16 +13,24 @@ | |||
| 13 | <p class="text-sm text-spot-secondary mb-6">Manage your RSS and Atom subscriptions.</p> | 13 | <p class="text-sm text-spot-secondary mb-6">Manage your RSS and Atom subscriptions.</p> |
| 14 | 14 | ||
| 15 | {{if .DeadFeeds}} | 15 | {{if .DeadFeeds}} |
| 16 | -<div class="bg-spot-red/10 border border-spot-red/30 rounded-lg p-4 mb-6"> | 16 | +<div id="dead-feeds" class="bg-spot-red/10 border border-spot-red/30 rounded-lg p-4 mb-6"> |
| 17 | <h3 class="text-sm font-bold text-spot-red mb-2">Feeds with errors ({{len .DeadFeeds}})</h3> | 17 | <h3 class="text-sm font-bold text-spot-red mb-2">Feeds with errors ({{len .DeadFeeds}})</h3> |
| 18 | <div class="space-y-2"> | 18 | <div class="space-y-2"> |
| 19 | {{range .DeadFeeds}} | 19 | {{range .DeadFeeds}} |
| 20 | - <div class="flex items-center justify-between text-sm"> | 20 | + <div class="dead-feed-item flex items-center justify-between text-sm"> |
| 21 | - <span class="text-spot-text">{{if .Title.Valid}}{{.Title.String}}{{else}}{{.FeedURL}}{{end}}</span> | 21 | + <div class="min-w-0 flex-1 flex items-center gap-3"> |
| 22 | - <div class="flex items-center gap-2"> | 22 | + <span class="text-spot-text truncate">{{if .Title.Valid}}{{.Title.String}}{{else}}{{.FeedURL}}{{end}}</span> |
| 23 | - <span class="text-spot-red text-xs">{{.ErrorCount}} errors</span> | 23 | + <div class="flex items-center gap-2 shrink-0"> |
| 24 | - {{if .LastError.Valid}}<span class="text-spot-secondary text-xs truncate max-w-48" title="{{.LastError.String}}">{{.LastError.String}}</span>{{end}} | 24 | + <span class="text-spot-red text-xs">{{.ErrorCount}} errors</span> |
| 25 | + {{if .LastError.Valid}}<span class="text-spot-secondary text-xs truncate max-w-48" title="{{.LastError.String}}">{{.LastError.String}}</span>{{end}} | ||
| 26 | + </div> | ||
| 25 | </div> | 27 | </div> |
| 28 | + <form hx-delete="/feeds/remove" hx-target="closest .dead-feed-item" hx-swap="outerHTML swap:0.3s" | ||
| 29 | + hx-confirm="Unsubscribe from this broken feed?" class="inline shrink-0 ml-3"> | ||
| 30 | + {{csrfInput $.CSRFToken}} | ||
| 31 | + <input type="hidden" name="url" value="{{.FeedURL}}"> | ||
| 32 | + <button type="submit" class="text-xs text-spot-secondary hover:text-spot-red transition font-bold uppercase">Unsubscribe</button> | ||
| 33 | + </form> | ||
| 26 | </div> | 34 | </div> |
| 27 | {{end}} | 35 | {{end}} |
| 28 | </div> | 36 | </div> |