Skip to content

Follow-up items from updating table of contents component to glimmer #827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/components/table-of-contents.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ol class='toc-level-0'>
<li class='toc-level-0'>
<a {{action 'toggle' 'modules'}} href='#' data-test-toc-title='packages'>Packages</a>
<a {{on 'click' (fn this.toggle 'modules')}} href='#' data-test-toc-title='packages'>Packages</a>
<ol class='toc-level-1 modules selected'>
{{#each @moduleIDs as |moduleID|}}

Expand All @@ -16,7 +16,7 @@

{{#if @isShowingNamespaces}}
<li class='toc-level-0'>
<a {{action 'toggle' 'namespaces'}} href='#' data-test-toc-title='namespaces'>Namespaces</a>
<a {{on 'click' (fn this.toggle 'namespaces')}} href='#' data-test-toc-title='namespaces'>Namespaces</a>
<ol class='toc-level-1 namespaces selected'>
{{#each @namespaceIDs as |namespaceID|}}
<li class='toc-level-1' data-test-namespace={{namespaceID}}>
Expand All @@ -28,7 +28,7 @@
{{/if}}

<li class='toc-level-0'>
<a {{action 'toggle' 'classes'}} href='#' data-test-toc-title='classes'>Classes</a>
<a {{on 'click' (fn this.toggle 'classes')}} href='#' data-test-toc-title='classes'>Classes</a>
<ol class='toc-level-1 classes selected'>
{{#each @classesIDs as |classID|}}
<li class='toc-level-1' data-test-class={{classID}}>
Expand All @@ -39,6 +39,6 @@
</li>
</ol>
<label class='toc-private-toggle'>
<Input @type='checkbox' @checked={{@showPrivateClasses}} class='private-deprecated-toggle' />
<input type='checkbox' checked={{@showPrivateClasses}} onchange={{@togglePrivateClasses}} class='private-deprecated-toggle' />
Show Private / Deprecated
</label>
7 changes: 6 additions & 1 deletion app/controllers/project-version.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable ember/no-computed-properties-in-native-classes */
import { computed } from '@ember/object';
import { action, computed, set } from '@ember/object';
import { inject as service } from '@ember/service';
import { readOnly, alias } from '@ember/object/computed';
import Controller from '@ember/controller';
Expand Down Expand Up @@ -121,4 +121,9 @@ export default class ProjectVersionController extends Controller {

@readOnly('model.project.id')
activeProject;

@action
togglePrivateClasses() {
set(this, 'showPrivateClasses', !this.showPrivateClasses);
}
Comment on lines +125 to +128
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also follow up on this and get rid of the CP macro in favor of actually using tracked state on the service. I know that the service and the way these CPs work are a bit janky today, but I did a spike where I just swapped it all out for a simple set of tracked properties and not trying to do those janky things in the CPs and it actually “just worked” (though we should of course verify that).

}
1 change: 1 addition & 0 deletions app/templates/project-version.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@moduleIDs={{this.shownModuleIDs}}
@namespaceIDs={{this.shownNamespaceIDs}}
@showPrivateClasses={{this.showPrivateClasses}}
@togglePrivateClasses={{this.togglePrivateClasses}}
@isShowingNamespaces={{version-lt this.selectedProjectVersion.compactVersion "2.16"}}
/>
</aside>
Expand Down