Company UI improvements
This commit is contained in:
parent
604a41c503
commit
d540ea1ffb
@ -1,6 +1,8 @@
|
|||||||
package companies
|
package companies
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sort"
|
||||||
|
|
||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
"github.com/animenotifier/notify.moe/components"
|
"github.com/animenotifier/notify.moe/components"
|
||||||
@ -17,6 +19,10 @@ func Get(ctx *aero.Context) string {
|
|||||||
return !company.IsDraft
|
return !company.IsDraft
|
||||||
})
|
})
|
||||||
|
|
||||||
|
sort.Slice(companies, func(i, j int) bool {
|
||||||
|
return companies[i].Created > companies[j].Created
|
||||||
|
})
|
||||||
|
|
||||||
if len(companies) > maxEntries {
|
if len(companies) > maxEntries {
|
||||||
companies = companies[:maxEntries]
|
companies = companies[:maxEntries]
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,5 @@ component Companies(companies []*arn.Company, user *arn.User)
|
|||||||
|
|
||||||
ul
|
ul
|
||||||
each company in companies
|
each company in companies
|
||||||
li= company.Name.English
|
li
|
||||||
|
a.ajax(href=company.Link())= company.Name.English
|
3
pages/company/company.scarlet
Normal file
3
pages/company/company.scarlet
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.company-description
|
||||||
|
max-width 700px
|
||||||
|
margin 0 auto
|
@ -33,7 +33,16 @@ func Render(obj interface{}, title string, user *arn.User) string {
|
|||||||
|
|
||||||
if user != nil {
|
if user != nil {
|
||||||
b.WriteString(`<div class="buttons">`)
|
b.WriteString(`<div class="buttons">`)
|
||||||
b.WriteString(`<div class="buttons"><button class="action" data-action="publish" data-trigger="click">` + utils.Icon("share-alt") + `Publish</button></div>`)
|
|
||||||
|
_, ok := t.FieldByName("IsDraft")
|
||||||
|
|
||||||
|
if ok {
|
||||||
|
isDraft := v.FieldByName("IsDraft").Interface().(bool)
|
||||||
|
|
||||||
|
if isDraft {
|
||||||
|
b.WriteString(`<div class="buttons"><button class="action" data-action="publish" data-trigger="click">` + utils.Icon("share-alt") + `Publish</button></div>`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if user.Role == "editor" || user.Role == "admin" {
|
if user.Role == "editor" || user.Role == "admin" {
|
||||||
b.WriteString(`<button class="action" data-action="deleteObject" data-trigger="click" data-return-path="/` + lowerCaseTypeName + "s" + `" data-confirm-type="` + lowerCaseTypeName + `">` + utils.Icon("trash") + `Delete</button>`)
|
b.WriteString(`<button class="action" data-action="deleteObject" data-trigger="click" data-return-path="/` + lowerCaseTypeName + "s" + `" data-confirm-type="` + lowerCaseTypeName + `">` + utils.Icon("trash") + `Delete</button>`)
|
||||||
|
Loading…
Reference in New Issue
Block a user