1
0
Fork 0

Preserve category selection when no feed is found

This commit is contained in:
Frédéric Guillot 2018-12-12 21:31:50 -08:00
parent 82e08d0f69
commit 43ccaf52af
3 changed files with 5 additions and 3 deletions

View file

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

View file

@ -78,7 +78,7 @@ var templateViewsMap = map[string]string{
<label for="form-category">{{ t "form.feed.label.category" }}</label> <label for="form-category">{{ t "form.feed.label.category" }}</label>
<select id="form-category" name="category_id"> <select id="form-category" name="category_id">
{{ range .categories }} {{ range .categories }}
<option value="{{ .ID }}">{{ .Title }}</option> <option value="{{ .ID }}" {{ if eq $.form.CategoryID .ID }}selected="selected"{{ end }}>{{ .Title }}</option>
{{ end }} {{ end }}
</select> </select>
@ -1382,7 +1382,7 @@ var templateViewsMap = map[string]string{
var templateViewsMapChecksums = map[string]string{ var templateViewsMapChecksums = map[string]string{
"about": "844e3313c33ae31a74b904f6ef5d60299773620d8450da6f760f9f317217c51e", "about": "844e3313c33ae31a74b904f6ef5d60299773620d8450da6f760f9f317217c51e",
"add_subscription": "6eb055f887abffe9ddeb8977ae380c2cb1cc61767e85ed2026ef2fb5995e12d3", "add_subscription": "a0f1d2bc02b6adc83dbeae593f74d9b936102cd6dd73302cdbec2137cafdcdd9",
"bookmark_entries": "609f4b2342152fe495a219a32f17a4528b01807d61f53cee0cbebf728be73c42", "bookmark_entries": "609f4b2342152fe495a219a32f17a4528b01807d61f53cee0cbebf728be73c42",
"categories": "642ee3cddbd825ee6ab5a77caa0d371096b55de0f1bd4ae3055b8c8a70507d8d", "categories": "642ee3cddbd825ee6ab5a77caa0d371096b55de0f1bd4ae3055b8c8a70507d8d",
"category_entries": "a803570ba91268646b2c55cffc8a3f2f162388a73bc007dd9ab61e144faa359b", "category_entries": "a803570ba91268646b2c55cffc8a3f2f162388a73bc007dd9ab61e144faa359b",

View file

@ -10,6 +10,7 @@ import (
"miniflux.app/http/client" "miniflux.app/http/client"
"miniflux.app/http/response/html" "miniflux.app/http/response/html"
"miniflux.app/http/request" "miniflux.app/http/request"
"miniflux.app/ui/form"
"miniflux.app/ui/session" "miniflux.app/ui/session"
"miniflux.app/ui/view" "miniflux.app/ui/view"
) )
@ -36,6 +37,7 @@ func (h *handler) showAddSubscriptionPage(w http.ResponseWriter, r *http.Request
view.Set("countUnread", h.store.CountUnreadEntries(user.ID)) view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
view.Set("countErrorFeeds", h.store.CountErrorFeeds(user.ID)) view.Set("countErrorFeeds", h.store.CountErrorFeeds(user.ID))
view.Set("defaultUserAgent", client.DefaultUserAgent) view.Set("defaultUserAgent", client.DefaultUserAgent)
view.Set("form", &form.SubscriptionForm{CategoryID: 0})
html.OK(w, r, view.Render("add_subscription")) html.OK(w, r, view.Render("add_subscription"))
} }