Browse Source

Pages module, delete action and link

Vova Tkach 6 years ago
parent
commit
12fc9422d4
1 changed files with 12 additions and 1 deletions
  1. 12 1
      modules/module_index.go

+ 12 - 1
modules/module_index.go

@@ -85,7 +85,7 @@ func (this *Modules) RegisterModule_Index() *Module {
 			}, 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>`
+					`<a class="ico" href="javascript:ActionDataTableDelete(this,'index-delete','` + (*values)[0] + `','Are you sure want to delete page?');">` + assets.SysSvgIconRemove + `</a>`
 			}, "/cp/"+wrap.CurrModule+"/")
 		} else if wrap.CurrSubModule == "add" || wrap.CurrSubModule == "modify" {
 			if wrap.CurrSubModule == "add" {
@@ -324,6 +324,17 @@ func (this *Modules) RegisterAction_IndexModify() *Action {
 	})
 }
 
+func (this *Modules) RegisterAction_IndexDelete() *Action {
+	return this.newAction(AInfo{
+		WantDB:    true,
+		Mount:     "index-delete",
+		WantAdmin: true,
+	}, func(wrap *wrapper.Wrapper) {
+		pf_id := wrap.R.FormValue("id")
+		wrap.Write(`alert('Delete (` + pf_id + `)!');`)
+	})
+}
+
 func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 	return this.newAction(AInfo{
 		WantDB: false,