Improved companies view
This commit is contained in:
@ -27,6 +27,7 @@ component Sidebar(user *arn.User)
|
|||||||
SidebarButton("Calendar", "/calendar", "calendar")
|
SidebarButton("Calendar", "/calendar", "calendar")
|
||||||
SidebarButton("Soundtracks", "/soundtracks", "headphones")
|
SidebarButton("Soundtracks", "/soundtracks", "headphones")
|
||||||
SidebarButton("Quotes", "/quotes", "quote-left")
|
SidebarButton("Quotes", "/quotes", "quote-left")
|
||||||
|
SidebarButton("Companies", "/companies", "building")
|
||||||
SidebarButton("Users", "/users", "globe")
|
SidebarButton("Users", "/users", "globe")
|
||||||
|
|
||||||
if user != nil
|
if user != nil
|
||||||
|
@ -3,6 +3,7 @@ package companies
|
|||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"unicode"
|
||||||
|
|
||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
@ -30,6 +31,10 @@ func All(ctx *aero.Context) string {
|
|||||||
for _, company := range companies {
|
for _, company := range companies {
|
||||||
firstLetter := strings.ToLower(company.Name.English[:1])
|
firstLetter := strings.ToLower(company.Name.English[:1])
|
||||||
|
|
||||||
|
if !unicode.IsLetter([]rune(firstLetter)[0]) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if firstLetter != previousFirstLetter {
|
if firstLetter != previousFirstLetter {
|
||||||
groups = append(groups, []*arn.Company{})
|
groups = append(groups, []*arn.Company{})
|
||||||
currentGroupIndex++
|
currentGroupIndex++
|
||||||
|
@ -3,14 +3,14 @@ component Companies(groups [][]*arn.Company, user *arn.User)
|
|||||||
|
|
||||||
h1.page-title All companies
|
h1.page-title All companies
|
||||||
|
|
||||||
.companies
|
.company-groups
|
||||||
each group in groups
|
each group in groups
|
||||||
.companies-group
|
.company-group.mountable
|
||||||
h3= group[0].Name.English[:1]
|
h3= strings.ToUpper(group[0].Name.English[:1])
|
||||||
|
|
||||||
ul
|
ul
|
||||||
each company in group
|
each company in group
|
||||||
li.mountable
|
li
|
||||||
a.ajax(href=company.Link())= company.Name.English
|
a.ajax(href=company.Link())= company.Name.English
|
||||||
|
|
||||||
component CompaniesTabs(user *arn.User)
|
component CompaniesTabs(user *arn.User)
|
||||||
@ -19,7 +19,7 @@ component CompaniesTabs(user *arn.User)
|
|||||||
Tab("Popular", "globe", "/companies/popular")
|
Tab("Popular", "globe", "/companies/popular")
|
||||||
|
|
||||||
.corner-buttons
|
.corner-buttons
|
||||||
if user != nil
|
if user != nil && (user.Role == "editor" || user.Role == "admin")
|
||||||
if user.DraftIndex().CompanyID == ""
|
if user.DraftIndex().CompanyID == ""
|
||||||
button.action(data-action="newObject", data-trigger="click", data-type="company")
|
button.action(data-action="newObject", data-trigger="click", data-type="company")
|
||||||
Icon("plus")
|
Icon("plus")
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.companies
|
.company-groups
|
||||||
//
|
horizontal-wrap
|
||||||
|
|
||||||
.companies-group
|
.company-group
|
||||||
//
|
padding 1rem
|
Reference in New Issue
Block a user