Browse Source

Render for checkbox value

Vova Tkach 6 years ago
parent
commit
3405c04d12
2 changed files with 17 additions and 0 deletions
  1. 11 0
      engine/builder/builder.go
  2. 6 0
      modules/module_users.go

+ 11 - 0
engine/builder/builder.go

@@ -1 +1,12 @@
 package builder
+
+import (
+	"golang-fave/assets"
+)
+
+func CheckBox(value int) string {
+	if value > 0 {
+		return assets.SysSvgIconChecked
+	}
+	return assets.SysSvgIconAlert
+}

+ 6 - 0
modules/module_users.go

@@ -58,10 +58,16 @@ func (this *Modules) RegisterModule_Users() *Module {
 				{
 					DBField:     "admin",
 					NameInTable: "Admin",
+					CallBack: func(values *[]string) string {
+						return builder.CheckBox(utils.StrToInt((*values)[4]))
+					},
 				},
 				{
 					DBField:     "active",
 					NameInTable: "Active",
+					CallBack: func(values *[]string) string {
+						return builder.CheckBox(utils.StrToInt((*values)[5]))
+					},
 				},
 			}, func(values *[]string) string {
 				return `<a class="ico" href="/cp/` + wrap.CurrModule + `/modify/` + (*values)[0] + `/">` +