Improved companies view

This commit is contained in:
Eduard Urbach 2018-03-01 22:44:14 +01:00
parent 95a5b08453
commit 08b7a0e75c
4 changed files with 15 additions and 9 deletions

View File

@ -27,6 +27,7 @@ component Sidebar(user *arn.User)
SidebarButton("Calendar", "/calendar", "calendar")
SidebarButton("Soundtracks", "/soundtracks", "headphones")
SidebarButton("Quotes", "/quotes", "quote-left")
SidebarButton("Companies", "/companies", "building")
SidebarButton("Users", "/users", "globe")
if user != nil

View File

@ -3,6 +3,7 @@ package companies
import (
"sort"
"strings"
"unicode"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
@ -30,6 +31,10 @@ func All(ctx *aero.Context) string {
for _, company := range companies {
firstLetter := strings.ToLower(company.Name.English[:1])
if !unicode.IsLetter([]rune(firstLetter)[0]) {
continue
}
if firstLetter != previousFirstLetter {
groups = append(groups, []*arn.Company{})
currentGroupIndex++

View File

@ -3,14 +3,14 @@ component Companies(groups [][]*arn.Company, user *arn.User)
h1.page-title All companies
.companies
.company-groups
each group in groups
.companies-group
h3= group[0].Name.English[:1]
.company-group.mountable
h3= strings.ToUpper(group[0].Name.English[:1])
ul
each company in group
li.mountable
li
a.ajax(href=company.Link())= company.Name.English
component CompaniesTabs(user *arn.User)
@ -19,7 +19,7 @@ component CompaniesTabs(user *arn.User)
Tab("Popular", "globe", "/companies/popular")
.corner-buttons
if user != nil
if user != nil && (user.Role == "editor" || user.Role == "admin")
if user.DraftIndex().CompanyID == ""
button.action(data-action="newObject", data-trigger="click", data-type="company")
Icon("plus")

View File

@ -1,5 +1,5 @@
.companies
//
.company-groups
horizontal-wrap
.companies-group
//
.company-group
padding 1rem