Skip to content

Commit

Permalink
Updated computed property to return proper values.
Browse files Browse the repository at this point in the history
  • Loading branch information
chth0n1x committed Sep 28, 2023
1 parent 3910a2a commit d63cb61
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
15 changes: 12 additions & 3 deletions lib/registries/addon/overview/index/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@ export default class Overview extends Controller {
registration?: Registration;

@computed('registration.{root,isRoot}')
get root() {
if (!this.registration || !this.registration.isRoot) {
get rootTitle() {
if (!this.registration || this.registration.isRoot) {
return undefined;
}
const rootTitle = this.registration.root.get('title');
return rootTitle;
}

return this.registration.belongsTo('root').value() as Registration;
@computed('registration.{root,isRoot}')
get rootId() {
if (!this.registration || this.registration.isRoot) {
return undefined;
}
const rootId = this.registration.root.get('id');
return rootId;
}
}
8 changes: 4 additions & 4 deletions lib/registries/addon/overview/index/template.hbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{{#if this.registration.isRoot}}
{{#unless this.registration.isRoot}}
<div data-test-root-link local-class='AboutComponent'>
{{t 'registries.overview.component_of'}}
<OsfLink
@route='resolve-guid'
@models={{array this.root.id}}
@models={{array this.rootId}}
>
{{this.root.title}}
{{this.rootTitle}}
</OsfLink>
</div>
{{/if}}
{{/unless}}

{{#if this.registration}}
<Overview::-Components::DiffManager
Expand Down

0 comments on commit d63cb61

Please sign in to comment.