discourse/app/assets/javascripts/admin/addon/templates/admin.hbs
David Taylor 5a99243629
DEV: Introduce declarative hide-application-footer helper (#23088)
Previously, we had a `showFooter` boolean on the application controller which would be set true/false in various routes by different routes/controllers. A global `routeWillChange` hook would set it `false` before every route transition, and the destination route/controller would have to set it `true` for the footer to show correctly.

This commit replaces that with a new 'declarative' system. Instead of having to set the value true/false manually, UIs which need the footer to be hidden can simply include the `{{hide-application-footer}}` helper in their template when needed. The helper/service will automatically keep track of all the current invocations of that helper, and only show the footer when there are 0 invocations.

This significantly simplifies things, and removes the need for many observers and controller injections, both of which are considered 'code smells' in modern Ember applications.
2023-08-17 12:47:08 +01:00

44 lines
1.6 KiB
Handlebars

{{hide-application-footer}}
<AdminWrapper @class="container">
<div class="row">
<div class="full-width">
<div class="admin-main-nav">
<ul class="nav nav-pills">
<NavItem @route="admin.dashboard" @label="admin.dashboard.title" />
{{#if this.currentUser.admin}}
<NavItem
@route="adminSiteSettings"
@label="admin.site_settings.title"
/>
{{/if}}
<NavItem @route="adminUsers" @label="admin.users.title" />
{{#if this.showGroups}}
<NavItem @route="groups" @label="admin.groups.title" />
{{/if}}
{{#if this.showBadges}}
<NavItem @route="adminBadges" @label="admin.badges.title" />
{{/if}}
{{#if this.currentUser.admin}}
<NavItem @route="adminEmail" @label="admin.email.title" />
{{/if}}
<NavItem @route="adminLogs" @label="admin.logs.title" />
<NavItem @route="adminCustomize" @label="admin.customize.title" />
{{#if this.currentUser.admin}}
<NavItem @route="adminApi" @label="admin.api.title" />
{{#if this.siteSettings.enable_backups}}
<NavItem @route="admin.backups" @label="admin.backups.title" />
{{/if}}
<NavItem @route="adminPlugins" @label="admin.plugins.title" />
{{/if}}
<PluginOutlet @name="admin-menu" />
</ul>
</div>
<div class="boxed white admin-content">
<div class="admin-contents {{this.adminContentsClassName}}">
{{outlet}}
</div>
</div>
</div>
</div>
</AdminWrapper>