示例#1
0
文件: node.go 项目: chrneumann/monsti
func (t TextField) ToFormField(form *htmlwidgets.Form, data util.NestedMap,
	field *NodeField, locale string) {
	data.Set(field.Id, string(t))
	G, _, _, _ := gettext.DefaultLocales.Use("", locale)
	form.AddWidget(&htmlwidgets.TextWidget{
		MinLength: 1, ValidationError: G("Required.")}, "Fields."+field.Id,
		field.Name[locale], "")
}
示例#2
0
文件: node.go 项目: chrneumann/monsti
func (t HTMLField) ToFormField(form *htmlwidgets.Form, data util.NestedMap,
	field *NodeField, locale string) {
	//G, _, _, _ := gettext.DefaultLocales.Use("", locale)
	data.Set(field.Id, string(t))
	widget := form.AddWidget(new(htmlwidgets.TextAreaWidget), "Fields."+field.Id,
		field.Name[locale], "")
	widget.Base().Classes = []string{"html-field"}
}
示例#3
0
文件: node.go 项目: chrneumann/monsti
func (t *TextField) FromFormField(data util.NestedMap, field *NodeField) {
	*t = TextField(data.Get(field.Id).(string))
}
示例#4
0
文件: node.go 项目: chrneumann/monsti
func (t *DateTimeField) FromFormField(data util.NestedMap, field *NodeField) {
	time := data.Get(field.Id).(time.Time)
	*t = DateTimeField{Time: time}
}
示例#5
0
文件: node.go 项目: chrneumann/monsti
func (t DateTimeField) ToFormField(form *htmlwidgets.Form, data util.NestedMap,
	field *NodeField, locale string) {
	data.Set(field.Id, t.Time)
	form.AddWidget(&htmlwidgets.TimeWidget{Location: t.Location},
		"Fields."+field.Id, field.Name[locale], "")
}
示例#6
0
文件: node.go 项目: chrneumann/monsti
func (t FileField) ToFormField(form *htmlwidgets.Form, data util.NestedMap,
	field *NodeField, locale string) {
	data.Set(field.Id, "")
	form.AddWidget(new(htmlwidgets.FileWidget), "Fields."+field.Id,
		field.Name[locale], "")
}