|
@@ -21,6 +21,8 @@ var (
|
|
|
"dict": dict,
|
|
|
"yaml": yaml,
|
|
|
"create": create,
|
|
|
+ "update": update,
|
|
|
+ "delete": delete,
|
|
|
"show": show,
|
|
|
"all": all,
|
|
|
"isSlice": isSlice,
|
|
@@ -150,3 +152,19 @@ func show(model string, id uint) string {
|
|
|
|
|
|
return fmt.Sprintf("/%s/%d?%s", plural, id, q)
|
|
|
}
|
|
|
+
|
|
|
+func update(model string, id uint) string {
|
|
|
+ action := "update"
|
|
|
+ plural := inflection.Plural(strings.ToLower(model))
|
|
|
+ q := query("tpl_layout", "base", "tpl_content", fmt.Sprintf("%s_add_update", plural), "update", "true")
|
|
|
+
|
|
|
+ return fmt.Sprintf("/%s/%d/%s?%s", plural, id, action, q)
|
|
|
+}
|
|
|
+
|
|
|
+func delete(model string, id uint) string {
|
|
|
+ action := "delete"
|
|
|
+ plural := inflection.Plural(strings.ToLower(model))
|
|
|
+ q := query("tpl_layout", "base", "tpl_content", fmt.Sprintf("%s_%s", plural, action))
|
|
|
+
|
|
|
+ return fmt.Sprintf("/%s/%d/%s?%s", plural, id, action, q)
|
|
|
+}
|