-
Notifications
You must be signed in to change notification settings - Fork 9
/
user.go
47 lines (40 loc) · 1.4 KB
/
user.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2018 NDP Systèmes. All Rights Reserved.
// See LICENSE file for full licensing details.
package web
import (
"github.com/hexya-erp/hexya/src/models"
"github.com/hexya-erp/hexya/src/models/fields"
"github.com/hexya-erp/hexya/src/models/types"
"github.com/hexya-erp/pool/h"
"github.com/hexya-erp/pool/m"
)
var fields_User = map[string]models.FieldDefinition{
"ChatterPosition": fields.Selection{
Selection: types.Selection{"normal": "Normal", "sided": "Sided"},
String: "Chatter Position", Default: models.DefaultValue("sided"),
},
"SidebarVisible": fields.Boolean{String: "Show App Sidebar", Default: models.DefaultValue(true)},
}
func user_SelfWritableFields(rs m.UserSet) map[string]bool {
res := rs.Super().SelfWritableFields()
res["ChatterPosition"] = true
res["SidebarVisible"] = true
return res
}
func user_SelfReadableFields(rs m.UserSet) map[string]bool {
res := rs.Super().SelfReadableFields()
res["ChatterPosition"] = true
res["SidebarVisible"] = true
return res
}
func user_ContextGet(rs m.UserSet) *types.Context {
res := rs.Super().ContextGet()
res = res.WithKey("chatter_position", rs.ChatterPosition())
return res
}
func init() {
h.User().AddFields(fields_User)
h.User().Methods().SelfWritableFields().Extend(user_SelfWritableFields)
h.User().Methods().SelfReadableFields().Extend(user_SelfReadableFields)
h.User().Methods().ContextGet().Extend(user_ContextGet)
}