소스 검색

Preserve category selection when no feed is found

Frédéric Guillot 7 년 전
부모
커밋
43ccaf52af
3개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      template/html/add_subscription.html
  2. 2 2
      template/views.go
  3. 2 0
      ui/subscription_add.go

+ 1 - 1
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>
 

+ 2 - 2
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",

+ 2 - 0
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"))
 }