Added check for disabled Packages (#21540)
At the moment, If admin disable Packages, still show the Packages on the admin dashboard This patch added a check to hide the Packages entry Signed-off-by: baronbunny <its@baronbunny.cn> Signed-off-by: baronbunny <its@baronbunny.cn>
This commit is contained in:
		
							parent
							
								
									1887c95254
								
							
						
					
					
						commit
						cd33979f5a
					
				| 
						 | 
					@ -591,6 +591,7 @@ func RegisterRoutes(m *web.Route) {
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	}, func(ctx *context.Context) {
 | 
						}, func(ctx *context.Context) {
 | 
				
			||||||
		ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable
 | 
							ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable
 | 
				
			||||||
 | 
							ctx.Data["EnablePackages"] = setting.Packages.Enabled
 | 
				
			||||||
	}, adminReq)
 | 
						}, adminReq)
 | 
				
			||||||
	// ***** END: Admin *****
 | 
						// ***** END: Admin *****
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,9 +12,11 @@
 | 
				
			||||||
		<a class="{{if .PageIsAdminRepositories}}active{{end}} item" href="{{AppSubUrl}}/admin/repos">
 | 
							<a class="{{if .PageIsAdminRepositories}}active{{end}} item" href="{{AppSubUrl}}/admin/repos">
 | 
				
			||||||
			{{.locale.Tr "admin.repositories"}}
 | 
								{{.locale.Tr "admin.repositories"}}
 | 
				
			||||||
		</a>
 | 
							</a>
 | 
				
			||||||
		<a class="{{if .PageIsAdminPackages}}active{{end}} item" href="{{AppSubUrl}}/admin/packages">
 | 
							{{if .EnablePackages}}
 | 
				
			||||||
			{{.locale.Tr "packages.title"}}
 | 
								<a class="{{if .PageIsAdminPackages}}active{{end}} item" href="{{AppSubUrl}}/admin/packages">
 | 
				
			||||||
		</a>
 | 
									{{.locale.Tr "packages.title"}}
 | 
				
			||||||
 | 
								</a>
 | 
				
			||||||
 | 
							{{end}}
 | 
				
			||||||
		{{if not DisableWebhooks}}
 | 
							{{if not DisableWebhooks}}
 | 
				
			||||||
			<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active{{end}} item" href="{{AppSubUrl}}/admin/hooks">
 | 
								<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active{{end}} item" href="{{AppSubUrl}}/admin/hooks">
 | 
				
			||||||
				{{.locale.Tr "admin.hooks"}}
 | 
									{{.locale.Tr "admin.hooks"}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue