module_blog.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package modules
  2. import (
  3. //"html"
  4. "golang-fave/assets"
  5. "golang-fave/consts"
  6. //"golang-fave/engine/builder"
  7. "golang-fave/engine/wrapper"
  8. //"golang-fave/utils"
  9. )
  10. func (this *Modules) RegisterModule_Blog() *Module {
  11. return this.newModule(MInfo{
  12. WantDB: true,
  13. Mount: "blog",
  14. Name: "Blog",
  15. Order: 1,
  16. System: false,
  17. Icon: assets.SysSvgIconPage,
  18. Sub: &[]MISub{
  19. {Mount: "default", Name: "List of posts", Show: true, Icon: assets.SysSvgIconList},
  20. {Mount: "add", Name: "Add new post", Show: true, Icon: assets.SysSvgIconPlus},
  21. {Mount: "modify", Name: "Modify post", Show: false},
  22. {Sep: true, Show: true},
  23. {Mount: "cats", Name: "List of categories", Show: true, Icon: assets.SysSvgIconList},
  24. {Mount: "cats-add", Name: "Add new category", Show: true, Icon: assets.SysSvgIconPlus},
  25. {Mount: "cats-modify", Name: "Modify category", Show: false},
  26. },
  27. }, nil, func(wrap *wrapper.Wrapper) (string, string, string) {
  28. content := ""
  29. sidebar := ""
  30. if wrap.CurrSubModule == "" || wrap.CurrSubModule == "default" {
  31. content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
  32. {Name: "List of posts"},
  33. })
  34. //
  35. } else if wrap.CurrSubModule == "cats" {
  36. content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
  37. {Name: "List of categories"},
  38. })
  39. //
  40. } else if wrap.CurrSubModule == "add" || wrap.CurrSubModule == "modify" {
  41. if wrap.CurrSubModule == "add" {
  42. content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
  43. {Name: "Add new post"},
  44. })
  45. } else {
  46. content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
  47. {Name: "Modify post"},
  48. })
  49. }
  50. //
  51. } else if wrap.CurrSubModule == "cats-add" || wrap.CurrSubModule == "cats-modify" {
  52. if wrap.CurrSubModule == "cats-add" {
  53. content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
  54. {Name: "Add new category"},
  55. })
  56. } else {
  57. content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
  58. {Name: "Modify category"},
  59. })
  60. }
  61. //
  62. }
  63. return this.getSidebarModules(wrap), content, sidebar
  64. })
  65. }