{{ define "title"}}{{ t "page.add_feed.title" }}{{ end }}

{{ define "page_header"}}
<section class="page-header" aria-labelledby="page-header-title">
    <h1 id="page-header-title">{{ t "page.add_feed.title" }}</h1>
    {{ template "feed_menu" }}
</section>
{{ end }}

{{ define "content"}}
<form action="{{ route "chooseSubscription" }}" method="POST">
    <input type="hidden" name="csrf" value="{{ .csrf }}">
    <input type="hidden" name="category_id" value="{{ .form.CategoryID }}">
    <input type="hidden" name="user_agent" value="{{ .form.UserAgent }}">
    <input type="hidden" name="cookie" value="{{ .form.Cookie }}">
    <input type="hidden" name="feed_username" value="{{ .form.Username }}">
    <input type="hidden" name="feed_password" value="{{ .form.Password }}">
    <input type="hidden" name="scraper_rules" value="{{ .form.ScraperRules }}">
    <input type="hidden" name="rewrite_rules" value="{{ .form.RewriteRules }}">
    <input type="hidden" name="urlrewrite_rules" value="{{ .form.UrlRewriteRules }}">
    <input type="hidden" name="blocklist_rules" value="{{ .form.BlocklistRules }}">
    <input type="hidden" name="keeplist_rules" value="{{ .form.KeeplistRules }}">
    <input type="hidden" name="block_filter_entry_rules" value="{{ .form.BlockFilterEntryRules }}">
    <input type="hidden" name="keep_filter_entry_rules" value="{{ .form.KeepFilterEntryRules }}">
    <input type="hidden" name="proxy_url" value="{{ .form.ProxyURL }}">
    {{ if .form.FetchViaProxy }}
    <input type="hidden" name="fetch_via_proxy" value="1">
    {{ end }}
    {{ if .form.Crawler }}
        <input type="hidden" name="crawler" value="1">
    {{ end }}
    {{ if .form.IgnoreEntryUpdates }}
        <input type="hidden" name="ignore_entry_updates" value="1">
    {{ end }}
    {{ if .form.AllowSelfSignedCertificates }}
        <input type="hidden" name="allow_self_signed_certificates" value="1">
    {{ end }}
    {{ if .form.DisableHTTP2 }}
        <input type="hidden" name="disable_http2" value="1">
    {{ end }}

    <h3>{{ t "page.add_feed.choose_feed" }}</h3>

    {{ range .subscriptions }}
        <div class="radio-group">
            <label title="{{ .URL | safeURL  }}"><input type="radio" name="url" value="{{ .URL | safeURL  }}"> {{ .Title }}</label> ({{ .Type }})
            <small title="Type = {{ .Type }}"><a href="{{ .URL | safeURL  }}" {{ if $.user.OpenExternalLinksInNewTab }}target="_blank"{{ else }}rel="noopener"{{ end }}>{{ .URL | safeURL  }}</a></small>
        </div>
    {{ end }}

    <div class="buttons">
        <button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.loading" }}">{{ t "action.subscribe" }}</button>
    </div>
</form>
{{ end }}
