Browse Source

NavBar system menu is not static

Vova Tkach 6 years ago
parent
commit
59e3c31527

+ 5 - 2
engine/backend/backend.go

@@ -30,6 +30,7 @@ type TmplData struct {
 	UserPassword       string
 	UserAvatarLink     string
 	NavBarModules      template.HTML
+	NavBarModulesSys   template.HTML
 	ModuleCurrentAlias string
 	SidebarLeft        template.HTML
 	Content            template.HTML
@@ -76,7 +77,8 @@ func (this *Backend) Run() bool {
 
 	mdl := modules.New(this.wrapper, this.db, this.user, this.urls)
 	page_sb_left := mdl.GetSidebarLeft()
-	nav_bar_modules := mdl.GetNavMenuModules()
+	nav_bar_modules_all := mdl.GetNavMenuModules()
+	nav_bar_modules_sys := mdl.GetNavMenuModulesSys()
 
 	if mdl.Run() {
 		page_content = mdl.GetContent()
@@ -113,7 +115,8 @@ func (this *Backend) Run() bool {
 			UserEmail:          this.user.A_email,
 			UserPassword:       "",
 			UserAvatarLink:     "https://s.gravatar.com/avatar/" + utils.GetMd5(this.user.A_email) + "?s=80&r=g",
-			NavBarModules:      template.HTML(nav_bar_modules),
+			NavBarModules:      template.HTML(nav_bar_modules_all),
+			NavBarModulesSys:   template.HTML(nav_bar_modules_sys),
 			ModuleCurrentAlias: malias,
 			SidebarLeft:        template.HTML(page_sb_left),
 			Content:            template.HTML(page_content),

+ 15 - 0
engine/backend/modules/modules.go

@@ -156,6 +156,21 @@ func (this *Module) GetNavMenuModules() string {
 	return html
 }
 
+func (this *Module) GetNavMenuModulesSys() string {
+	html := ""
+	list := this.module_get_list_of_modules()
+	for _, value := range *list {
+		if !value.Display {
+			class := ""
+			if value.Alias == this.mmod {
+				class = " active"
+			}
+			html += `<a class="dropdown-item` + class + `" href="/cp/` + value.Alias + `/">` + value.Name + `</a>`
+		}
+	}
+	return html
+}
+
 func (this *Module) GetSidebarLeft() string {
 	list := this.module_get_list_of_modules()
 

File diff suppressed because it is too large
+ 0 - 0
engine/wrapper/resources/templates/cp.base.go


+ 1 - 3
engine/wrapper/resources/templates/cp.base.html

@@ -70,9 +70,7 @@
 							System
 						</a>
 						<div class="dropdown-menu" aria-labelledby="nbSystemDropdown">
-							<a class="dropdown-item{{if eq $.Data.ModuleCurrentAlias "users"}} active{{end}}" href="/cp/users/">Users</a>
-							<div class="dropdown-divider"></div>
-							<a class="dropdown-item{{if eq $.Data.ModuleCurrentAlias "settings"}} active{{end}}" href="/cp/settings/">Settings</a>
+							{{$.Data.NavBarModulesSys}}
 						</div>
 					</li>
 				</ul>

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