番組登録を追加(登録時の過去回の選択、一時停止・再開・解除、既知の回の記録)
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
{{template "newer_page" .Newer}}
|
||||
{{else if .Queue}}
|
||||
{{template "queue_page" .Queue}}
|
||||
{{else if .Subscriptions}}
|
||||
{{template "subscriptions_page" .Subscriptions}}
|
||||
{{else}}
|
||||
<h1>{{.Title}}</h1>
|
||||
{{end}}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
</div>
|
||||
</a>
|
||||
{{template "episode_action" .}}
|
||||
{{template "subscription_action" .SubscriptionAction}}
|
||||
</article>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
{{define "subscription_action"}}
|
||||
<div class="subscription-action">
|
||||
{{if .Subscribed}}
|
||||
<span role="status">登録済み</span>
|
||||
{{else if .Choosing}}
|
||||
{{if .ErrorText}}<p role="alert">{{.ErrorText}}</p>{{end}}
|
||||
<form action="/subscriptions/register" method="post" hx-post="/subscriptions/register" hx-target="closest .subscription-action" hx-swap="outerHTML">
|
||||
<input type="hidden" name="episode_id" value="{{.ID}}">
|
||||
<input type="hidden" name="genre" value="{{.Genre}}">
|
||||
<label><input type="checkbox" name="download_existing" value="1" {{if .DownloadExisting}}checked{{end}}>公開中の回もダウンロードする</label>
|
||||
<button type="submit">登録</button>
|
||||
</form>
|
||||
{{else}}
|
||||
<button type="button" hx-get="/subscriptions/choice?genre={{.Genre}}&episode_id={{.ID}}" hx-target="closest .subscription-action" hx-swap="outerHTML">番組を登録</button>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{define "subscriptions_page"}}
|
||||
<h1>登録番組</h1>
|
||||
{{template "subscriptions_list" .}}
|
||||
{{end}}
|
||||
|
||||
{{define "subscriptions_list"}}
|
||||
<div id="subscriptions-list">
|
||||
{{range .Items}}
|
||||
<article class="subscription-item">
|
||||
<h2>{{.Title}}</h2>
|
||||
<p>登録日時: {{.CreatedAtText}}/最終確認: {{.LastCheckedText}}/状態: {{if .Enabled}}有効{{else}}一時停止{{end}}/関連ジョブ: {{.Jobs}}件</p>
|
||||
{{if .Enabled}}
|
||||
<form action="/subscriptions/{{.ID}}/pause" method="post" hx-post="/subscriptions/{{.ID}}/pause" hx-target="#subscriptions-list" hx-swap="outerHTML"><button type="submit">一時停止</button></form>
|
||||
{{else}}
|
||||
<form action="/subscriptions/{{.ID}}/resume" method="post" hx-post="/subscriptions/{{.ID}}/resume" hx-target="#subscriptions-list" hx-swap="outerHTML"><button type="submit">再開</button></form>
|
||||
{{end}}
|
||||
<form action="/subscriptions/{{.ID}}/delete" method="post" hx-post="/subscriptions/{{.ID}}/delete" hx-target="#subscriptions-list" hx-swap="outerHTML" hx-confirm="番組の登録を解除しますか?"><button type="submit">解除</button></form>
|
||||
</article>
|
||||
{{else}}
|
||||
<p>登録番組はありません</p>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user