Skip to content
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

All in one without serializers #13

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c2ed116
#3 Write a section about migrating from Adapters
Baltazore Oct 2, 2023
8f7f97c
Update translations/adapters/path-for-type/en-us.yaml
Baltazore Oct 4, 2023
aef6e57
Update translations/adapters/host-and-namespace/en-us.yaml
Baltazore Oct 4, 2023
3f9bdbc
Update translations/adapters/general/en-us.yaml
Baltazore Oct 4, 2023
ae763df
Update translations/adapters/path-for-type/en-us.yaml
Baltazore Oct 4, 2023
f31e5e4
Refactor adapter example for cache to map old one
Baltazore Oct 16, 2023
56ea471
Add findRecord section
Baltazore Oct 9, 2023
7245f10
Add section about query/queryRecord
Baltazore Oct 9, 2023
6c17ce0
Fix review comments from Chris
Baltazore Oct 16, 2023
298111f
Change wording for find-all
Baltazore Oct 20, 2023
22fbf24
Add update section
Baltazore Oct 9, 2023
6a27c81
Add small section about delete
Baltazore Oct 9, 2023
5b73ace
Unify this.store
Baltazore Oct 9, 2023
0761911
Add handler example for create/update
Baltazore Oct 16, 2023
9fffb13
Add destroy record examples
Baltazore Oct 16, 2023
bf28d8f
Fix mutation_ops set
Baltazore Oct 20, 2023
e325d5c
Move `setBuildURLConfig` according to guides (app.ts)
Baltazore Apr 4, 2024
215ca9e
Use `ember-data/store` instead of `@ember-data/store` in the code exa…
Baltazore Apr 4, 2024
b5dadbd
Convert `this.store` to just `store` in the code examples
Baltazore Apr 4, 2024
4c04c48
Clean up sections with text only
Baltazore Apr 4, 2024
83afdad
Don't mention cache in requestManager
Baltazore Apr 4, 2024
4524c1e
Better example for making own builders
Baltazore Apr 4, 2024
aa605bb
Serializers section
Baltazore May 2, 2024
51f219d
Update findRecord with type declarations and own builders
Baltazore May 10, 2024
0fcead7
LifetimesService => CachePolicy
Baltazore May 26, 2024
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
126 changes: 60 additions & 66 deletions app/components/guide-section/subsection.hbs
Original file line number Diff line number Diff line change
@@ -1,101 +1,95 @@
{{#let
@subsection.id
(t (concat @sectionId "." @subsection.id ".title"))
(t (concat @sectionId "." @subsection.id ".description") htmlSafe=true)
(t (concat @sectionId '.' @subsection.id '.title'))
(t (concat @sectionId '.' @subsection.id '.description') htmlSafe=true)
as |subsectionId subsectionTitle subsectionDescription|
}}
<section
aria-labelledby="{{@sectionId}}__{{subsectionId}}"
aria-labelledby='{{@sectionId}}__{{subsectionId}}'
data-test-subsection={{subsectionTitle}}
>
<div local-class="title-container">
<div local-class='title-container'>
<h3
data-test-field="Subsection Title"
id="{{@sectionId}}__{{subsectionId}}"
local-class="title"
data-test-field='Subsection Title'
id='{{@sectionId}}__{{subsectionId}}'
local-class='title'
>
{{subsectionTitle}}
</h3>

<a
href="#{{@sectionId}}__{{subsectionId}}"
local-class="permalink"
href='#{{@sectionId}}__{{subsectionId}}'
local-class='permalink'
title={{subsectionTitle}}
>
{{t "component.guide-section.section"}}
{{t 'component.guide-section.section'}}
</a>
</div>

<p
data-test-field="Subsection Description"
local-class="description"
>
<p data-test-field='Subsection Description' local-class='description'>
{{subsectionDescription}}
</p>

<ContainerQuery
@features={{hash
wide=(width min=900)
}}
local-class="code-examples-container"
@features={{hash wide=(width min=900)}}
local-class='code-examples-container'
>
<div
data-test-ember-classic
local-class="ember-classic"
>
<h4 local-class="subtitle">
{{t "component.guide-section.subsection.classic"}}
</h4>
{{#if @subsection.classicFiles.length}}
<div data-test-ember-classic local-class='ember-classic'>
<h4 local-class='subtitle'>
{{t 'component.guide-section.subsection.classic'}}
</h4>

{{#each @subsection.classicFiles as |file|}}
<div local-class="code-snippet">
<CodeSnippet
@fileName="{{@sectionId}}/{{subsectionId}}/{{file}}"
/>
</div>
{{/each}}
{{#each @subsection.classicFiles as |file|}}
<div local-class='code-snippet'>
<CodeSnippet
@fileName='{{@sectionId}}/{{subsectionId}}/{{file}}'
/>
</div>
{{/each}}

{{#if @subsection.classicDescriptionKey}}
<p data-test-general-text>
{{t @subsection.classicDescriptionKey htmlSafe=true}}
</p>
{{/if}}
</div>
{{#if @subsection.classicDescriptionKey}}
<p data-test-general-text>
{{t @subsection.classicDescriptionKey htmlSafe=true}}
</p>
{{/if}}
</div>

<div
data-test-ember-octane
local-class="ember-octane"
>
<h4 local-class="subtitle">
{{t "component.guide-section.subsection.octane"}}
</h4>
{{/if}}

{{#if @subsection.octaneFiles.length}}
<div data-test-ember-octane local-class='ember-octane'>
<h4 local-class='subtitle'>
{{t 'component.guide-section.subsection.octane'}}
</h4>

{{#each @subsection.octaneFiles as |file|}}
<div local-class="code-snippet">
<CodeSnippet
@fileName="{{@sectionId}}/{{subsectionId}}/{{file}}"
/>
</div>
{{/each}}
{{#each @subsection.octaneFiles as |file|}}
<div local-class='code-snippet'>
<CodeSnippet
@fileName='{{@sectionId}}/{{subsectionId}}/{{file}}'
/>
</div>
{{/each}}

{{#if @subsection.octaneDescriptionKey}}
<p data-test-general-text>
{{t @subsection.octaneDescriptionKey htmlSafe=true}}
</p>
{{/if}}
</div>
{{#if @subsection.octaneDescriptionKey}}
<p data-test-general-text>
{{t @subsection.octaneDescriptionKey htmlSafe=true}}
</p>
{{/if}}
</div>
{{/if}}
</ContainerQuery>

<div local-class="edit-link-container">
<div local-class='edit-link-container'>
<a
data-test-link="Edit Translation"
href="https://github.com/ember-learn/ember-data-request-service-cheat-sheet/edit/main/translations/{{@sectionId}}/{{subsectionId}}/{{this.intl.locale}}.yaml"
local-class="edit-link"
rel="noopener noreferrer"
target="_blank"
data-test-link='Edit Translation'
href='https://github.com/ember-learn/ember-data-request-service-cheat-sheet/edit/main/translations/{{@sectionId}}/{{subsectionId}}/{{this.intl.locale}}.yaml'
local-class='edit-link'
rel='noopener noreferrer'
target='_blank'
>
{{t "component.guide-section.edit-translation-text"}}
{{t 'component.guide-section.edit-translation-text'}}
</a>
</div>
</section>
{{/let}}
{{/let}}
165 changes: 39 additions & 126 deletions app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,172 +4,85 @@ export default class ApplicationRoute extends Route {
model() {
return [
{
id: 'generating-files',
id: 'fetching-data',
subsections: [
{
id: 'generating-component',
classicFiles: ['classic.shell'],
octaneFiles: ['octane.shell'],
id: 'find-record',
classicFiles: ['old.js', 'old.ts'],
octaneFiles: ['new.js', 'new.ts', 'own-builder.ts'],
},
{
id: 'file-structure',
classicFiles: ['classic.text'],
octaneFiles: ['octane.text'],
},
],
},
{
id: 'component-templates',
subsections: [
{
id: 'angle-brackets',
classicFiles: ['classic.hbs'],
octaneFiles: ['octane.hbs'],
},
{
id: 'inline-vs-block',
classicFiles: ['classic.hbs'],
octaneFiles: ['octane.hbs'],
},
{
id: 'angle-brackets-nested',
classicFiles: ['classic.hbs'],
octaneFiles: ['octane.hbs'],
},
{
id: 'template-named',
classicFiles: ['classic.hbs'],
octaneFiles: ['octane.hbs'],
},
{
id: 'template-this',
classicFiles: ['classic.hbs'],
octaneFiles: ['octane.hbs'],
},
{
id: 'template-arguments-named',
classicFiles: ['classic.hbs'],
octaneFiles: ['octane.hbs'],
id: 'find-all',
classicFiles: ['old.js'],
octaneFiles: ['new.js'],
},
{
id: 'template-arguments-this',
classicFiles: ['classic.hbs'],
octaneFiles: ['octane.hbs'],
id: 'query',
classicFiles: ['old.js'],
octaneFiles: ['new.js'],
},
{
id: 'tag-name',
classicFiles: ['classic.hbs', 'classic.html'],
octaneFiles: ['octane.hbs', 'octane.html'],
},
{
id: 'element-id',
classicFiles: ['classic.js', 'classic.hbs'],
octaneFiles: ['octane.js', 'octane.hbs'],
id: 'query-record',
classicFiles: ['old.js'],
octaneFiles: ['new.js'],
},
],
},
{
id: 'component-properties',
id: 'updating-data',
subsections: [
{
id: 'js-boilerplate',
classicFiles: ['classic.js'],
octaneFiles: ['octane.js'],
},
{
id: 'js-properties',
classicFiles: ['classic.js'],
octaneFiles: ['octane.js'],
},
{
id: 'ddau',
classicFiles: [
'classic-parent.js',
'classic-parent.hbs',
'classic-child.js',
'classic-child.hbs',
],
octaneFiles: [
'octane-parent.js',
'octane-parent.hbs',
'octane-child.hbs',
],
},
{
id: 'args',
classicFiles: ['classic.js'],
octaneFiles: ['octane.js'],
id: 'create-record',
classicFiles: ['old.js'],
octaneFiles: ['in-place-body.js', 'handler.js'],
},
{
id: 'get-and-set',
classicFiles: ['classic.js'],
octaneFiles: ['octane.js'],
},
{
id: 'tracked-vs-cp',
classicFiles: ['classic.js'],
octaneFiles: ['octane.js'],
},
{
id: 'computed-decorator',
classicFiles: ['classic.js'],
octaneFiles: ['octane.js'],
id: 'save-record',
classicFiles: ['old.js'],
octaneFiles: ['new.js', 'handler.js'],
},
],
},
{
id: 'actions',
id: 'deleting-data',
subsections: [
{
id: 'actions',
classicFiles: ['classic.js', 'classic.hbs'],
octaneFiles: ['octane.js', 'octane.hbs'],
},
{
id: 'template-arguments-default',
classicFiles: ['classic.hbs', 'classic.js'],
octaneFiles: ['octane.hbs', 'octane.js'],
},
{
id: 'mixins',
classicFiles: ['classic.js'],
octaneDescriptionKey: 'actions.mixins.octaneDescription',
id: 'delete-record',
classicFiles: ['old.js', 'destroy.js'],
octaneFiles: ['new.js'],
},
],
},
{
id: 'component-lifecycle',
id: 'adapters',
subsections: [
{
id: 'constructors',
classicFiles: ['classic.js'],
octaneFiles: ['octane.js'],
id: 'general',
},
{
id: 'will-destroy',
classicFiles: ['classic.js'],
octaneFiles: ['octane.js'],
id: 'host-and-namespace',
classicFiles: ['old.js'],
octaneFiles: ['new.js'],
},
{
id: 'render-modifiers',
classicDescriptionKey:
'component-lifecycle.render-modifiers.classicDescription',
octaneFiles: ['octane.shell'],
id: 'path-for-type',
classicFiles: ['old.js'],
octaneFiles: ['new.js', 'utils.js'],
},
{
id: 'did-insert',
classicFiles: ['classic.hbs', 'classic.js'],
octaneFiles: ['octane.hbs', 'octane.js'],
id: 'cache-lifetime',
classicFiles: ['old.js'],
octaneFiles: ['new.js'],
},
],
},
{
id: 'routes',
id: 'serializers',
subsections: [
{
id: 'model-access',
classicFiles: ['classic.hbs'],
octaneFiles: ['octane.hbs'],
id: 'general',
classicFiles: ['old.js'],
octaneFiles: ['utils.js', 'app-code.js', 'handler.js'],
},
],
},
Expand Down
Loading