aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-12-12 21:31:50 -0800
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-12-12 21:31:50 -0800
commit43ccaf52af1ddaf847ed0fc4969418e6480dc18b (patch)
tree9d95da1bc6dc18eb2ad5ff68af115673f03ff15d
parent82e08d0f698a181617aa727345a29eb6500d1d4c (diff)
Preserve category selection when no feed is found
-rw-r--r--template/html/add_subscription.html2
-rw-r--r--template/views.go4
-rw-r--r--ui/subscription_add.go2
3 files changed, 5 insertions, 3 deletions
diff --git a/template/html/add_subscription.html b/template/html/add_subscription.html
index 2ebbca6..4a6fe7d 100644
--- a/template/html/add_subscription.html
+++ b/template/html/add_subscription.html
@@ -32,7 +32,7 @@
<label for="form-category">{{ t "form.feed.label.category" }}</label>
<select id="form-category" name="category_id">
{{ range .categories }}
- <option value="{{ .ID }}">{{ .Title }}</option>
+ <option value="{{ .ID }}" {{ if eq $.form.CategoryID .ID }}selected="selected"{{ end }}>{{ .Title }}</option>
{{ end }}
</select>
diff --git a/template/views.go b/template/views.go
index 2662b9a..76fab8a 100644
--- a/template/views.go
+++ b/template/views.go
@@ -78,7 +78,7 @@ var templateViewsMap = map[string]string{
<label for="form-category">{{ t "form.feed.label.category" }}</label>
<select id="form-category" name="category_id">
{{ range .categories }}
- <option value="{{ .ID }}">{{ .Title }}</option>
+ <option value="{{ .ID }}" {{ if eq $.form.CategoryID .ID }}selected="selected"{{ end }}>{{ .Title }}</option>
{{ end }}
</select>
@@ -1382,7 +1382,7 @@ var templateViewsMap = map[string]string{
var templateViewsMapChecksums = map[string]string{
"about": "844e3313c33ae31a74b904f6ef5d60299773620d8450da6f760f9f317217c51e",
- "add_subscription": "6eb055f887abffe9ddeb8977ae380c2cb1cc61767e85ed2026ef2fb5995e12d3",
+ "add_subscription": "a0f1d2bc02b6adc83dbeae593f74d9b936102cd6dd73302cdbec2137cafdcdd9",
"bookmark_entries": "609f4b2342152fe495a219a32f17a4528b01807d61f53cee0cbebf728be73c42",
"categories": "642ee3cddbd825ee6ab5a77caa0d371096b55de0f1bd4ae3055b8c8a70507d8d",
"category_entries": "a803570ba91268646b2c55cffc8a3f2f162388a73bc007dd9ab61e144faa359b",
diff --git a/ui/subscription_add.go b/ui/subscription_add.go
index db539c8..7cb201a 100644
--- a/ui/subscription_add.go
+++ b/ui/subscription_add.go
@@ -10,6 +10,7 @@ import (
"miniflux.app/http/client"
"miniflux.app/http/response/html"
"miniflux.app/http/request"
+ "miniflux.app/ui/form"
"miniflux.app/ui/session"
"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("countErrorFeeds", h.store.CountErrorFeeds(user.ID))
view.Set("defaultUserAgent", client.DefaultUserAgent)
+ view.Set("form", &form.SubscriptionForm{CategoryID: 0})
html.OK(w, r, view.Render("add_subscription"))
}