-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Templates comply with Octane ember-template-lint rules (#181)
* Update first patch of templates to comply with Octane rules * Fix route templates and boolean/text fields * Third patch of template fixes
- Loading branch information
Showing
14 changed files
with
166 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
extends: 'recommended' // TODO migrate to "octane" | ||
extends: 'octane' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{{#if value}}true{{else}}false{{/if}} | ||
{{#if @value}}true{{else}}false{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
import { A } from '@ember/array'; | ||
import Component from '@ember/component'; | ||
import { computed, set } from '@ember/object'; | ||
import Component from '@glimmer/component'; | ||
import { computed, set, action } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default Component.extend({ | ||
tagName: '', | ||
export default class PageTitlePaneComponent extends Component { | ||
@service | ||
titleList; | ||
|
||
titleList: service(), | ||
@computed('titleList.{tokens.length}') | ||
get lastIndex() { | ||
return this.titleList.tokens.length - 1; | ||
} | ||
|
||
lastIndex: computed('titleList.{tokens.length}', { | ||
get() { | ||
return this.titleList.tokens.length - 1; | ||
}, | ||
}), | ||
|
||
actions: { | ||
highlight(token) { | ||
let tokens = A(this.titleList.tokens); | ||
let wasActive = token.active; | ||
tokens.setEach('active', false); | ||
set(token, 'active', !wasActive); | ||
}, | ||
}, | ||
}); | ||
@action | ||
highlight(token) { | ||
let tokens = A(this.titleList.tokens); | ||
let wasActive = token.active; | ||
tokens.setEach('active', false); | ||
set(token, 'active', !wasActive); | ||
} | ||
} |
23 changes: 17 additions & 6 deletions
23
tests/dummy/app/components/page-title-pane/matryoshka/template.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
{{#page-title-pane/nested-template title=item.value replace=item.replace prepend=item.prepend separator=item.separator onactivate=onactivate titleList=titleList}} | ||
{{yield item}} | ||
{{#if nextItems.length}} | ||
{{#page-title-pane/matryoshka componentName items=nextItems onactivate=onactivate titleList=titleList as |value|}} | ||
<PageTitlePane::NestedTemplate | ||
@title={{this.item.value}} | ||
@replace={{this.item.replace}} | ||
@prepend={{this.item.prepend}} | ||
@separator={{this.item.separator}} | ||
@onactivate={{@onactivate}} | ||
@titleList={{@titleList}} | ||
> | ||
{{yield this.item}} | ||
{{#if this.nextItems.length}} | ||
<PageTitlePane::Matryoshka | ||
@items={{this.nextItems}} | ||
@onactivate={{@onactivate}} | ||
@titleList={{@titleList}} as |value| | ||
> | ||
{{yield value}} | ||
{{/page-title-pane/matryoshka}} | ||
</PageTitlePane::Matryoshka> | ||
{{/if}} | ||
{{/page-title-pane/nested-template}} | ||
</PageTitlePane::NestedTemplate> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
{{!template-lint-disable no-action}} | ||
{{!TODO fix actions when migrating to Glimmer component}} | ||
<input type="text" | ||
id={{inputId}} | ||
name={{name}} | ||
placeholder={{placeholder}} | ||
autocomplete="off" | ||
onclick={{action "blackHole"}} | ||
onpaste={{action "reformat"}} | ||
onchange={{action "reformat"}} | ||
oninput={{action "reformat"}} | ||
disabled={{disabled}}> | ||
id={{this.inputId}} | ||
name={{this.name}} | ||
placeholder={{this.placeholder}} | ||
autocomplete="off" | ||
{{on "click" (action "blackHole")}} | ||
{{on "paste" (action "reformat")}} | ||
{{on "change" (action "reformat")}} | ||
{{on "input" (action "reformat")}} | ||
disabled={{this.disabled}} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import Controller from '@ember/controller'; | ||
import { set } from '@ember/object'; | ||
import { set, action } from '@ember/object'; | ||
|
||
export default Controller.extend({ | ||
actions: { | ||
add(tokens) { | ||
let lastToken = tokens.slice(-1)[0]; | ||
set(this, 'model.tokens', tokens.concat({ | ||
separator: lastToken.separator, | ||
prepend: lastToken.prepend | ||
})); | ||
} | ||
export default class IndexController extends Controller { | ||
@action | ||
add(tokens) { | ||
let lastToken = tokens.slice(-1)[0]; | ||
set(this, 'model.tokens', tokens.concat({ | ||
separator: lastToken.separator, | ||
prepend: lastToken.prepend | ||
})); | ||
} | ||
}); | ||
} |
Oops, something went wrong.