aboutsummaryrefslogtreecommitdiffhomepage
path: root/template/html/add_subscription.html
blob: 4a6fe7d1be48853c1b938ee6ceda76e16cc19084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{{ define "title"}}{{ t "page.add_feed.title" }}{{ end }}

{{ define "content"}}
<section class="page-header">
    <h1>{{ t "page.add_feed.title" }}</h1>
    <ul>
        <li>
            <a href="{{ route "feeds" }}">{{ t "menu.feeds" }}</a>
        </li>
        <li>
            <a href="{{ route "export" }}">{{ t "menu.export" }}</a>
        </li>
        <li>
            <a href="{{ route "import" }}">{{ t "menu.import" }}</a>
        </li>
    </ul>
</section>

{{ if not .categories }}
    <p class="alert alert-error">{{ t "page.add_feed.no_category" }}</p>
{{ else }}
    <form action="{{ route "submitSubscription" }}" method="post" autocomplete="off">
        <input type="hidden" name="csrf" value="{{ .csrf }}">

        {{ if .errorMessage }}
            <div class="alert alert-error">{{ t .errorMessage }}</div>
        {{ end }}

        <label for="form-url">{{ t "page.add_feed.label.url" }}</label>
        <input type="url" name="url" id="form-url" placeholder="https://domain.tld/" value="{{ .form.URL }}" required autofocus>

        <label for="form-category">{{ t "form.feed.label.category" }}</label>
        <select id="form-category" name="category_id">
            {{ range .categories }}
                <option value="{{ .ID }}" {{ if eq $.form.CategoryID .ID }}selected="selected"{{ end }}>{{ .Title }}</option>
            {{ end }}
        </select>

        <details>
            <summary>{{ t "page.add_feed.legend.advanced_options" }}</summary>
            <div class="details-content">
                <label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "form.feed.label.crawler" }}</label>

                <label for="form-user-agent">{{ t "form.feed.label.user_agent" }}</label>
                <input type="text" name="user_agent" id="form-user-agent" placeholder="{{ .defaultUserAgent }}" value="{{ .form.UserAgent }}" autocomplete="off">

                <label for="form-feed-username">{{ t "form.feed.label.feed_username" }}</label>
                <input type="text" name="feed_username" id="form-feed-username" value="{{ .form.Username }}">

                <label for="form-feed-password">{{ t "form.feed.label.feed_password" }}</label>
                <!--
                    We are using the type "text" otherwise Firefox always autocomplete this password:

                    - autocomplete="off" or autocomplete="new-password" doesn't change anything
                    - Changing the input ID doesn't change anything
                    - Using a different input name doesn't change anything
                -->
                <input type="text" name="feed_password" id="form-feed-password" value="{{ .form.Password }}">
            </div>
        </details>

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

{{ end }}