aboutsummaryrefslogtreecommitdiffhomepage
path: root/template/html/edit_feed.html
blob: 73a2e27082b35442b99d1df913feba1de34259d5 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{{ define "title"}}{{ t "page.edit_feed.title" .feed.Title }}{{ end }}

{{ define "content"}}
<section class="page-header">
    <h1>{{ .feed.Title }}</h1>
    <ul>
        <li>
            <a href="{{ route "feeds" }}">{{ t "menu.feeds" }}</a>
        </li>
        <li>
            <a href="{{ route "addSubscription" }}">{{ t "menu.add_feed" }}</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 }}
    {{ if ne .feed.ParsingErrorCount 0 }}
    <div class="alert alert-error">
        <h3>{{ t "page.edit_feed.last_parsing_error" }}</h3>
        <p>{{ t .feed.ParsingErrorMsg }}</p>
    </div>
    {{ end }}

    <form action="{{ route "updateFeed" "feedID" .feed.ID }}" 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-title">{{ t "form.feed.label.title" }}</label>
        <input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus>

        <label for="form-site-url">{{ t "form.feed.label.site_url" }}</label>
        <input type="url" name="site_url" id="form-site-url" placeholder="https://domain.tld/" value="{{ .form.SiteURL }}" required>

        <label for="form-feed-url">{{ t "form.feed.label.feed_url" }}</label>
        <input type="url" name="feed_url" id="form-feed-url" placeholder="https://domain.tld/" value="{{ .form.FeedURL }}" required>

        <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 }}">

	    <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 }}">

        <label for="form-scraper-rules">{{ t "form.feed.label.scraper_rules" }}</label>
        <input type="text" name="scraper_rules" id="form-scraper-rules" value="{{ .form.ScraperRules }}">

        <label for="form-rewrite-rules">{{ t "form.feed.label.rewrite_rules" }}</label>
        <input type="text" name="rewrite_rules" id="form-rewrite-rules" value="{{ .form.RewriteRules }}">

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

        <label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "form.feed.label.crawler" }}</label>

        <div class="buttons">
            <button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button> {{ t "action.or" }} <a href="{{ route "feeds" }}">{{ t "action.cancel" }}</a>
        </div>
    </form>

    <div class="panel">
        <ul>
            <li><strong>{{ t "page.edit_feed.last_check" }} </strong><time datetime="{{ isodate .feed.CheckedAt }}" title="{{ isodate .feed.CheckedAt }}">{{ elapsed $.user.Timezone .feed.CheckedAt }}</time></li>
            <li><strong>{{ t "page.edit_feed.etag_header" }} </strong>{{ if .feed.EtagHeader }}{{ .feed.EtagHeader }}{{ else }}{{ t "page.edit_feed.no_header" }}{{ end }}</li>
            <li><strong>{{ t "page.edit_feed.last_modified_header" }} </strong>{{ if .feed.LastModifiedHeader }}{{ .feed.LastModifiedHeader }}{{ else }}{{ t "page.edit_feed.no_header" }}{{ end }}</li>
        </ul>
    </div>

    <div class="alert alert-error">
        <a href="#"
            data-confirm="true"
            data-action="remove-feed"
            data-label-question="{{ t "confirm.question" }}"
            data-label-yes="{{ t "confirm.yes" }}"
            data-label-no="{{ t "confirm.no" }}"
            data-label-loading="{{ t "confirm.loading" }}"
            data-url="{{ route "removeFeed" "feedID" .feed.ID }}"
            data-redirect-url="{{ route "feeds" }}">{{ t "action.remove_feed" }}</a>
    </div>
{{ end }}

{{ end }}