More cleanup

This commit is contained in:
Eduard Urbach 2018-03-14 20:23:45 +01:00
parent c67fad8f60
commit 2fd56207d2
4 changed files with 3 additions and 75 deletions

View File

@ -22,12 +22,12 @@ func FilterByStatus(status string) aero.Handle {
return frontpage.Get(ctx) return frontpage.Get(ctx)
} }
return HomeAnimeList(ctx, user, status) return AnimeList(ctx, user, status)
} }
} }
// HomeAnimeList renders the anime list items. // AnimeList renders the anime list items.
func HomeAnimeList(ctx *aero.Context, user *arn.User, status string) string { func AnimeList(ctx *aero.Context, user *arn.User, status string) string {
nick := ctx.Get("nick") nick := ctx.Get("nick")
index, _ := ctx.GetInt("index") index, _ := ctx.GetInt("index")
viewUser, err := arn.GetUserByNick(nick) viewUser, err := arn.GetUserByNick(nick)

View File

@ -1,33 +0,0 @@
//- component ProfileAnimeLists(animeLists map[string]*arn.AnimeList, viewUser *arn.User, user *arn.User, uri string)
//- ProfileHeader(viewUser, user, uri)
//- h1.page-title.anime-list-owner= viewUser.Nick + "'s collection"
//- AnimeLists(animeLists, viewUser, user)
//- component AnimeLists(animeLists map[string]*arn.AnimeList, viewUser *arn.User, user *arn.User)
//- if len(animeLists[arn.AnimeListStatusWatching].Items) == 0 && len(animeLists[arn.AnimeListStatusCompleted].Items) == 0 && len(animeLists[arn.AnimeListStatusPlanned].Items) == 0 && len(animeLists[arn.AnimeListStatusHold].Items) == 0 && len(animeLists[arn.AnimeListStatusDropped].Items) == 0
//- p.no-data.mountable= viewUser.Nick + " hasn't added any anime yet."
//- else
//- if len(animeLists[arn.AnimeListStatusWatching].Items) > 0
//- .anime-list-container
//- h3.status-name Watching
//- AnimeList(animeLists[arn.AnimeListStatusWatching].Items, -1, viewUser, user)
//- if len(animeLists[arn.AnimeListStatusCompleted].Items) > 0
//- .anime-list-container
//- h3.status-name Completed
//- AnimeList(animeLists[arn.AnimeListStatusCompleted].Items, -1, viewUser, user)
//- if len(animeLists[arn.AnimeListStatusPlanned].Items) > 0
//- .anime-list-container
//- h3.status-name Planned
//- AnimeList(animeLists[arn.AnimeListStatusPlanned].Items, -1, viewUser, user)
//- if len(animeLists[arn.AnimeListStatusHold].Items) > 0
//- .anime-list-container
//- h3.status-name On hold
//- AnimeList(animeLists[arn.AnimeListStatusHold].Items, -1, viewUser, user)
//- if len(animeLists[arn.AnimeListStatusDropped].Items) > 0
//- .anime-list-container
//- h3.status-name Dropped
//- AnimeList(animeLists[arn.AnimeListStatusDropped].Items, -1, viewUser, user)

View File

@ -1,36 +0,0 @@
package animelist
// // ProfileFilterByStatus returns a handler for the given anime list item status.
// func ProfileFilterByStatus(status string) aero.Handle {
// return func(ctx *aero.Context) string {
// user := utils.GetUser(ctx)
// list, response := statusList(ctx, status)
// if response != "" {
// return response
// }
// return ctx.HTML(components.ProfileAnimeListItems(list.Items, list.User(), user, status, ctx.URI()))
// }
// }
// // statusList handles the request for an anime list with a given status.
// func statusList(ctx *aero.Context, status string) (*arn.AnimeList, string) {
// nick := ctx.Get("nick")
// viewUser, err := arn.GetUserByNick(nick)
// if err != nil {
// return nil, ctx.Error(http.StatusNotFound, "User not found", err)
// }
// animeList := viewUser.AnimeList()
// if animeList == nil {
// return nil, ctx.Error(http.StatusNotFound, "Anime list not found", nil)
// }
// watchingList := animeList.FilterStatus(status)
// watchingList.Sort()
// return watchingList, ""
// }

View File

@ -1,3 +0,0 @@
component ProfileAnimeListItems(animeListItems []*arn.AnimeListItem, viewUser *arn.User, user *arn.User, status string, uri string)
ProfileHeader(viewUser, user, uri)
AnimeListItems(animeListItems, -1, viewUser, user)