1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

Move UI middlewares and routes to ui package

This commit is contained in:
Frédéric Guillot 2018-11-11 11:28:29 -08:00
parent 0925899cee
commit 5a69a61d48
70 changed files with 739 additions and 769 deletions

View file

@ -14,18 +14,17 @@ import (
"miniflux.app/ui/view"
)
// AddSubscription shows the form to add a new feed.
func (c *Controller) AddSubscription(w http.ResponseWriter, r *http.Request) {
sess := session.New(c.store, request.SessionID(r))
view := view.New(c.tpl, r, sess)
func (h *handler) showAddSubscriptionPage(w http.ResponseWriter, r *http.Request) {
sess := session.New(h.store, request.SessionID(r))
view := view.New(h.tpl, r, sess)
user, err := c.store.UserByID(request.UserID(r))
user, err := h.store.UserByID(request.UserID(r))
if err != nil {
html.ServerError(w, r, err)
return
}
categories, err := c.store.Categories(user.ID)
categories, err := h.store.Categories(user.ID)
if err != nil {
html.ServerError(w, r, err)
return
@ -34,8 +33,8 @@ func (c *Controller) AddSubscription(w http.ResponseWriter, r *http.Request) {
view.Set("categories", categories)
view.Set("menu", "feeds")
view.Set("user", user)
view.Set("countUnread", c.store.CountUnreadEntries(user.ID))
view.Set("countErrorFeeds", c.store.CountErrorFeeds(user.ID))
view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
view.Set("countErrorFeeds", h.store.CountErrorFeeds(user.ID))
view.Set("defaultUserAgent", client.DefaultUserAgent)
html.OK(w, r, view.Render("add_subscription"))