Skip to content

Add parent relationship to deprecations to allow grouping in the UI, especially in the index #1383

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,27 @@

This is the app that serves https://deprecations.emberjs.com/

## Linking to deprecations

You can link to a specific deprecation by using the ID of the deprecation. For example, to link to the deprecation with the ID `my-old-api`, you can use the following URL:
`https://deprecations.emberjs.com/id/my-old-api`. These URLs can be generated in advance of adding the deprecation guide, when the deprecation lands in the code.
When adding a deprecation the filename should match the ID of the deprecation, or the `displayId` should be specified in the frontmatter.

## Adding new deprecations

The [content](https://github.com/ember-learn/deprecation-app/tree/main/content/) folder contains all the deprecations that are listed by the website. To add a new deprecation, add it to the appropriate folder by creating a new file. The content of the file needs to follow a specific format for the app to work. You can see [this sample](https://raw.githubusercontent.com/ember-learn/deprecation-app/main/content/ember/v3/getting-the-each-property.md) for reference.

### Frontmatter

#### Grouping deprecations

```markdown
parent: deprecation-id
```

Can be used to nest deprecations under a parent grouping for the purpose of the UI. The deprecations will still be available via the direct ID URLs.


## Prerequisites

You will need the following things properly installed on your computer.
Expand Down
9 changes: 9 additions & 0 deletions app/components/deprecation-article.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class DeprecationArticle extends Component {
@tracked showChildDeprecations = false;

get idForTitle() {
return `toc_${this.args.model.title}`;
}

get idForUntil() {
return `toc_until-${this.args.model.until}`;
}

@action
toggleChildDeprecations() {
this.showChildDeprecations = !this.showChildDeprecations;
}
}
4 changes: 3 additions & 1 deletion app/models/content.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Model, { attr } from '@ember-data/model';
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

export default class ContentModel extends Model {
@attr content;
Expand All @@ -7,6 +7,8 @@ export default class ContentModel extends Model {
@attr since;
@attr anchor;
@attr displayId;
@belongsTo('content', { inverse: 'children', async: false }) parent;
@hasMany('content', { inverse: 'parent', async: false }) children;

// v1 has different meta, so conditionally render it
get renderUntil() {
Expand Down
35 changes: 33 additions & 2 deletions app/templates/components/deprecation-article.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,41 @@
<div class="my-2">
{{#if @model.renderUntil}}
<div><span class="bold">until: </span>{{@model.until}}</div>
<div><span class="bold">id: </span>{{or @model.displayId @model.id}}</div>
<div><span class="bold">since: </span>{{@model.since}}</div>
<div><span class="bold">id: </span><LinkTo @route="id" @model={{@model.id}}>{{or @model.displayId @model.id}}</LinkTo></div>
{{/if}}
{{#if @model.parent}}
<div>
<span class="bold">included in: </span>
<LinkTo @route="id" @model={{@model.parent.id}}>
{{or @model.parent.displayId @model.parent.id}}
</LinkTo>
</div>
{{/if}}
{{#if @model.children.length}}
<div>
<span class="bold">includes: </span> {{@model.children.length}} deprecations
<button type="button" {{on "click" this.toggleChildDeprecations}}>
{{(if this.showChildDeprecations 'Collapse all' 'Expand all')}}
</button>
</div>
{{/if}}
</div>
<section>
{{markdown-to-html @model.content}}
{{#if this.showChildDeprecations}}
{{#each @model.children as |child|}}
<DeprecationArticle @model={{child}}>
<hr>
<h3>
{{markdown-to-html
child.title
extensions="no-wrapper"
tagName=""
}}
</h3>
</DeprecationArticle>
{{/each}}
{{/if}}
</section>
</div>
</div>
3 changes: 3 additions & 0 deletions app/utils/process-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const GLIMMER = 'Glimmer Internals';

export default function processResults(query) {
let results = query.toArray().reduce((results, item) => {
if (item.parent) {
return results;
}
let since = results.find((result) => result.since === item.since);
if (!since) {
since = { since: item.since, contents: [] };
Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import---loader-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember.__loader
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import--action-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._action
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import--array-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._array
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._assertDestroyablesDestroyed
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._associateDestroyableChild
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._Backburner
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import--cache-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._Cache
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._cacheGetValue
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._cacheIsConst
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._captureRenderTree
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._componentManagerCapabilities
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import--concat-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._concat
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._ContainerProxyMixin
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._createCache
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._dependentKeyCompat
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._descriptor
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._enableDestroyableTracking
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import--fn-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._fn
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._getComponentTemplate
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import--get-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._get
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import--get-path-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._getPath
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import--hash-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._hash
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._helperManagerCapabilities
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import--input-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._Input
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._invokeHelper
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._isDestroyed
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._isDestroying
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._modifierManagerCapabilities
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
1 change: 1 addition & 0 deletions content/ember/v6/deprecate-import--on-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._on
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._ProxyMixin
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._registerDestructor
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._RegistryProxyMixin
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._setClassicDecorator
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._setComponentManager
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Ember._setComponentTemplate
until: 7.0.0
since: 6.5.0
parent: deprecate-import-ember-from-ember
---


Expand Down
Loading