0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Updated profile page for Authors & Contributors

No ref

- Removed breadcrumbs when profile page is loading
- Redirected Authors and Contributors to profile page when accessing /staff
This commit is contained in:
Sanne de Vries 2022-01-21 11:35:02 +00:00
parent 941d4de4af
commit c5940ab57b
3 changed files with 32 additions and 7 deletions

View file

@ -0,0 +1,10 @@
import Controller from '@ember/controller';
import {alias} from '@ember/object/computed';
import {inject as service} from '@ember/service';
export default Controller.extend({
session: service(),
user: alias('model'),
currentUser: alias('session.user')
});

View file

@ -6,6 +6,16 @@ export default class IndexRoute extends AuthenticatedRoute {
@service infinity;
@service session;
beforeModel() {
super.beforeModel(...arguments);
const user = this.session.user;
if (!user.isAdmin) {
return this.transitionTo('settings.staff.user', user);
}
}
model() {
return this.session.user;
}

View file

@ -1,12 +1,17 @@
<section class="gh-canvas">
<GhCanvasHeader class="gh-canvas-header">
<h2 class="gh-canvas-title" data-test-screen-title>
<LinkTo @route="settings">Settings</LinkTo>
<span>{{svg-jar "arrow-right"}}</span>
<LinkTo @route="settings.staff" data-test-staff-link={{true}}>Staff</LinkTo>
<span>{{svg-jar "arrow-right"}}</span>
{{this.user.name}}
</h2>
{{!-- Remove breadcrumbs for Authors and Contributors --}}
{{#if this.currentUser.isAuthorOrContributor}}
<h2 class="gh-canvas-title" data-test-screen-title>Your profile</h2>
{{else}}
<h2 class="gh-canvas-title" data-test-screen-title>
<LinkTo @route="settings">Settings</LinkTo>
<span>{{svg-jar "arrow-right"}}</span>
<LinkTo @route="settings.staff" data-test-staff-link={{true}}>Staff</LinkTo>
<span>{{svg-jar "arrow-right"}}</span>
{{this.user.name}}
</h2>
{{/if}}
<section class="view-actions">
<div class="gh-btn gh-btn-primary"><span>Save</span></div>