Added button to add companies

This commit is contained in:
2017-11-18 11:46:17 +01:00
parent c5cb497722
commit 54b08453dc
5 changed files with 23 additions and 8 deletions

View File

@ -1,8 +1,6 @@
package companies
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
@ -19,10 +17,6 @@ func Get(ctx *aero.Context) string {
return !company.IsDraft
})
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching companies", err)
}
if len(companies) > maxEntries {
companies = companies[:maxEntries]
}

View File

@ -0,0 +1,17 @@
component Companies(companies []*arn.Company, user *arn.User)
h1.page-title Companies
.music-buttons
if user != nil
if user.DraftIndex().CompanyID == ""
button.action(data-action="newObject", data-trigger="click", data-type="company")
Icon("plus")
span Add company
else
a.button.ajax(href="/company/" + user.DraftIndex().CompanyID + "/edit")
Icon("pencil")
span Edit draft
ul
each company in companies
li= company.Name.English