Browse Source

Sidebar sub-items separator

Vova Tkach 6 years ago
parent
commit
7fa6315ffa
4 changed files with 24 additions and 14 deletions
  1. 4 0
      assets/cp.styles.css
  2. 0 0
      assets/cp.styles.css.go
  3. 1 0
      modules/module_blog.go
  4. 19 14
      modules/modules.go

+ 4 - 0
assets/cp.styles.css

@@ -169,6 +169,10 @@ body.cp .wrap .sidebar.sidebar-left ul.nav {
 	padding: 1rem 0px;
 	padding: 1rem 0px;
 }
 }
 
 
+body.cp .wrap .sidebar.sidebar-left ul.nav li.nav-separator {
+	height: 1rem;
+}
+
 body.cp .wrap .sidebar.sidebar-left ul.nav li.nav-item a {
 body.cp .wrap .sidebar.sidebar-left ul.nav li.nav-item a {
 	color: #444;
 	color: #444;
 }
 }

File diff suppressed because it is too large
+ 0 - 0
assets/cp.styles.css.go


+ 1 - 0
modules/module_blog.go

@@ -22,6 +22,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 			{Mount: "default", Name: "List of posts", Show: true, Icon: assets.SysSvgIconList},
 			{Mount: "default", Name: "List of posts", Show: true, Icon: assets.SysSvgIconList},
 			{Mount: "add", Name: "Add new post", Show: true, Icon: assets.SysSvgIconPlus},
 			{Mount: "add", Name: "Add new post", Show: true, Icon: assets.SysSvgIconPlus},
 			{Mount: "modify", Name: "Modify post", Show: false},
 			{Mount: "modify", Name: "Modify post", Show: false},
+			{Sep: true, Show: true},
 			{Mount: "cats", Name: "List of categories", Show: true, Icon: assets.SysSvgIconList},
 			{Mount: "cats", Name: "List of categories", Show: true, Icon: assets.SysSvgIconList},
 			{Mount: "cats-add", Name: "Add new category", Show: true, Icon: assets.SysSvgIconPlus},
 			{Mount: "cats-add", Name: "Add new category", Show: true, Icon: assets.SysSvgIconPlus},
 			{Mount: "cats-modify", Name: "Modify category", Show: false},
 			{Mount: "cats-modify", Name: "Modify category", Show: false},

+ 19 - 14
modules/modules.go

@@ -19,6 +19,7 @@ type MISub struct {
 	Name  string
 	Name  string
 	Icon  string
 	Icon  string
 	Show  bool
 	Show  bool
+	Sep   bool
 }
 }
 
 
 type MInfo struct {
 type MInfo struct {
@@ -143,21 +144,25 @@ func (this *Modules) getSidebarModuleSubMenu(wrap *wrapper.Wrapper, mod *MInfo)
 	if mod.Sub != nil {
 	if mod.Sub != nil {
 		for _, item := range *mod.Sub {
 		for _, item := range *mod.Sub {
 			if item.Show {
 			if item.Show {
-				class := ""
-				if (item.Mount == "default" && len(wrap.UrlArgs) <= 1) || (len(wrap.UrlArgs) >= 2 && item.Mount == wrap.UrlArgs[1]) {
-					class = " active"
-				}
-				icon := item.Icon
-				if icon == "" {
-					icon = assets.SysSvgIconGear
-				}
-				href := "/cp/" + mod.Mount + "/" + item.Mount + "/"
-				if mod.Mount == "index" && item.Mount == "default" {
-					href = "/cp/"
-				} else if item.Mount == "default" {
-					href = "/cp/" + mod.Mount + "/"
+				if !item.Sep {
+					class := ""
+					if (item.Mount == "default" && len(wrap.UrlArgs) <= 1) || (len(wrap.UrlArgs) >= 2 && item.Mount == wrap.UrlArgs[1]) {
+						class = " active"
+					}
+					icon := item.Icon
+					if icon == "" {
+						icon = assets.SysSvgIconGear
+					}
+					href := "/cp/" + mod.Mount + "/" + item.Mount + "/"
+					if mod.Mount == "index" && item.Mount == "default" {
+						href = "/cp/"
+					} else if item.Mount == "default" {
+						href = "/cp/" + mod.Mount + "/"
+					}
+					html += `<li class="nav-item` + class + `"><a class="nav-link" href="` + href + `">` + icon + item.Name + `</a></li>`
+				} else {
+					html += `<li class="nav-separator"></li>`
 				}
 				}
-				html += `<li class="nav-item` + class + `"><a class="nav-link" href="` + href + `">` + icon + item.Name + `</a></li>`
 			}
 			}
 		}
 		}
 		if html != "" {
 		if html != "" {

Some files were not shown because too many files changed in this diff