//@Mapper("/admin") func Admin(flash *peony.Flash) peony.Renderer { rp := map[interface{}]interface{}{} if e, ok := flash.In["error"]; ok && e != "" { rp["info"] = e } return peony.Render(rp) }
//@Mapper("/admin/vendor/<id>/edit") func (v *Vendor) Edit(id int64) peony.Renderer { var vendor = &model.Vendor{Id: id} engine.Get(vendor) return peony.Render(map[string]interface{}{ "vendor": vendor, }) }
//@Mapper("/admin/users/json") func (u *User) UsersJson(offset, limit int, orderCol int, order string) peony.Renderer { var users []*model.User if orderCol < 0 || orderCol > len(userSortedCols)-1 { orderCol = 0 } s := engine.Limit(limit, offset) if order == "desc" { s.Desc(userSortedCols[orderCol]) } else { s.Asc(userSortedCols[orderCol]) } s.Find(&users) var rsData [][]interface{} for _, item := range users { rsData = append(rsData, []interface{}{ item.Id, item.LoginId, item.Name, item.MaxOnline, item.Status, item.Id, }) } count, _ := engine.Count(new(model.Online)) return peony.Render(map[string]interface{}{ "iTotalRecords": count, "iTotalDisplayRecords": count, "data": rsData, }) }
//@Mapper("/admin/nas/add") func (v *Nas) Add() peony.Renderer { var vendors []*model.Vendor engine.Find(&vendors) return peony.Render(map[string]interface{}{ "vendors": vendors, }) }
//@Mapper("/admin/online/json") func (b *Online) OnlineJson(offset, limit int, orderCol int, order string) peony.Renderer { var onlines []*model.Online if orderCol < 0 || orderCol > len(onlineSortedCols)-1 { orderCol = 0 } s := engine.Limit(limit, offset) if order == "desc" { s.Desc(onlineSortedCols[orderCol]) } else { s.Asc(onlineSortedCols[orderCol]) } s.Find(&onlines) var rsData [][]interface{} for _, item := range onlines { rsData = append(rsData, []interface{}{ item.Id, item.User, item.SessionId, item.SessionTime, item.StartTime.Format("2006-01-02 15:04:05"), item.UpdateTime.Format("2006-01-02 15:04:05"), item.Status, item.In, item.Out, }) } count, _ := engine.Count(new(model.Online)) return peony.Render(map[string]interface{}{ "iTotalRecords": count, "iTotalDisplayRecords": count, "data": rsData, }) }
//@Mapper("/admin/attrs") func (v *Attr) Attrs() peony.Renderer { var attrs []*model.Attr engine.Find(&attrs) return peony.Render(map[string]interface{}{ "attrs": attrs, "vendors": getVendorsMap(), }) }
//@Mapper("/admin/nass") func (v *Nas) Nass() peony.Renderer { var nass []*model.Nas engine.Find(&nass) return peony.Render(map[string]interface{}{ "nass": nass, "vendors": getVendorsMap(), }) }
//@Mapper("/admin/attr/add") func (v *Attr) Add() peony.Renderer { var vendors []*model.Vendor engine.Find(&vendors) return peony.Render(map[string]interface{}{ "vendors": vendors, "dataTypes": attrDataTypes, }) }
//@Mapper("/admin/nas/<id>/edit") func (v *Nas) Edit(id int64) peony.Renderer { var nas = &model.Nas{Id: id} engine.Get(nas) var vendors []*model.Vendor engine.Find(&vendors) return peony.Render(map[string]interface{}{ "nas": nas, "vendors": vendors, }) }
//@Mapper("/admin/attr/<id>/edit") func (v *Attr) Edit(id int64) peony.Renderer { var attr = &model.Attr{Id: id} engine.Get(attr) var vendors []*model.Vendor engine.Find(&vendors) return peony.Render(map[string]interface{}{ "attr": attr, "vendors": vendors, "dataTypes": attrDataTypes, }) }
//@Mapper("/") func Index(url string, app *peony.App) peony.Renderer { return peony.Render() }
//@Mapper("/admin/online") func (b *Online) Online() peony.Renderer { return peony.Render(map[string]interface{}{}) }
//@Mapper("/admin/vendor/add") func (v *Vendor) Add() peony.Renderer { return peony.Render() }
//@Mapper("/admin/home") func (oc *Operator) Home() peony.Renderer { return peony.Render() }
// @Mapper func Index(s *controllers.S, ss string) app.Renderer { return app.Render("haha") }
//@Mapper("/admin/user/<id>/edit") func (u *User) Edit(id int64) peony.Renderer { user, _ := getUser(id) return peony.Render(map[string]interface{}{ "user": user, }) }
//@Mapper("/") func (c Application) Index() peony.Renderer { return peony.Render(map[string]interface{}{}) }
//@Mapper("/admin/users") func (u *User) Users() peony.Renderer { return peony.Render() }
//@Mapper("/admin/user/add") func (u *User) Add() peony.Renderer { return peony.Render() }
//@Mapper("/") func Index() peony.Renderer { return peony.Render() }
// @Mapper(url="/") func (l *Login) Index(user []*Mail, m *model.User) app.Renderer { println(l.xx) return app.Render("welcome~!") }