Browse Source

CP pages list, change users order

Vova Tkach 6 years ago
parent
commit
13b4f96ecd
2 changed files with 32 additions and 1 deletions
  1. 31 0
      modules/module_index.go
  2. 1 1
      modules/module_users.go

+ 31 - 0
modules/module_index.go

@@ -5,11 +5,13 @@ import (
 	_ "github.com/go-sql-driver/mysql"
 	_ "github.com/go-sql-driver/mysql"
 
 
 	"fmt"
 	"fmt"
+	"html"
 	"os"
 	"os"
 	"strconv"
 	"strconv"
 
 
 	"golang-fave/assets"
 	"golang-fave/assets"
 	"golang-fave/consts"
 	"golang-fave/consts"
+	"golang-fave/engine/builder"
 	"golang-fave/engine/wrapper"
 	"golang-fave/engine/wrapper"
 	"golang-fave/utils"
 	"golang-fave/utils"
 )
 )
@@ -46,6 +48,35 @@ func (this *Modules) RegisterModule_Index() *Module {
 			content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
 			content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
 				{Name: "List of Pages"},
 				{Name: "List of Pages"},
 			})
 			})
+			content += builder.DataTable(wrap, "pages", "id", "DESC", []builder.DataTableRow{
+				{
+					DBField: "id",
+				},
+				{
+					DBField:     "name",
+					NameInTable: "Page",
+					CallBack: func(values *[]string) string {
+						name := `<a href="/cp/` + wrap.CurrModule + `/modify/` + (*values)[0] + `/">` + html.EscapeString((*values)[1]) + `</a>`
+						slug := html.EscapeString((*values)[2])
+						return `<div>` + name + `</div><div><small>` + slug + `</small></div>`
+					},
+				},
+				{
+					DBField: "slug",
+				},
+				{
+					DBField:     "datetime",
+					NameInTable: "Date/Time",
+				},
+				{
+					DBField:     "status",
+					NameInTable: "Active",
+				},
+			}, func(values *[]string) string {
+				return `<a class="ico" href="/cp/` + wrap.CurrModule + `/modify/` + (*values)[0] + `/">` +
+					assets.SysSvgIconEdit + `</a>` +
+					`<a class="ico" href="#">` + assets.SysSvgIconRemove + `</a>`
+			}, "/cp/"+wrap.CurrModule+"/")
 		} else if wrap.CurrSubModule == "add" {
 		} else if wrap.CurrSubModule == "add" {
 			content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
 			content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
 				{Name: "Add New Page"},
 				{Name: "Add New Page"},

+ 1 - 1
modules/module_users.go

@@ -28,7 +28,7 @@ func (this *Modules) RegisterModule_Users() *Module {
 			content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
 			content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
 				{Name: "List of Users"},
 				{Name: "List of Users"},
 			})
 			})
-			content += builder.DataTable(wrap, "users", "email", "ASC", []builder.DataTableRow{
+			content += builder.DataTable(wrap, "users", "id", "DESC", []builder.DataTableRow{
 				{
 				{
 					DBField: "id",
 					DBField: "id",
 				},
 				},