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
import { Promise, defer } from 'rsvp'; | |
import { get } from '@ember/object'; | |
// a mock API response used below | |
const MOCK_PAYLOAD = { | |
person: { | |
id: '1', | |
name: 'Chris', | |
age: 33, | |
father: { |
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
import Component from '@glimmer/component'; | |
import { tracked } from '@glimmer/tracking'; | |
export default class extends Component { | |
@tracked container; | |
constructor(owner, args) { | |
super(owner, args); | |
this.container = this.createContainerElement(); | |
} |
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
import Controller from '@ember/controller'; | |
import { action, set } from '@ember/object'; | |
import { tracked } from 'tracked-built-ins'; | |
export default class ApplicationController extends Controller { | |
@tracked items = [ | |
{ id: 1, value: 1 }, | |
{ id: 2, value: 2 }, | |
{ id: 3, value: 3 }, | |
]; |
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
import { action } from '@ember/object'; | |
import Component from '@glimmer/component'; | |
import { tracked } from '@glimmer/tracking'; | |
export default class extends Component { | |
@tracked tags = ['programming', 'rails']; | |
@tracked tag = ''; | |
@action addTag(event) { |
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
import Component from '@ember/component'; | |
import { computed } from '@ember/object'; | |
export default class extends Component { | |
query = ''; | |
@computed('query') get _options() { | |
if (this.query) { | |
return this.options.filter((option) => { | |
return option.value.toLowerCase().lastIndexOf(this.query, 0) === 0; |
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
import Ember from 'ember'; | |
const { Component, computed } = Ember; | |
const BlogPostCardComponent = Component.extend({ | |
classNames: ['blog-post-card', 'card'], | |
classNameBindings: ['disabled::clickable'], | |
click() { | |
if (!this.get('disabled')) { | |
this.get('viewPost')(this.get('post')); |
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
import Controller from '@ember/controller'; | |
import { tracked } from '@glimmer/tracking'; | |
export default class ApplicationController extends Controller { | |
queryParams = [ | |
'page' | |
]; | |
@tracked page; |
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
import { action } from '@ember/object'; | |
import Component from '@glimmer/component'; | |
import { tracked } from '@glimmer/tracking'; | |
const MESSAGES = { | |
staled: 'The old password and new password are the same. The password was not changed.', | |
invalid: 'The new password and confirm password must be the same value. The password was not changed.' | |
}; | |
export default class extends Component { |
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
import Component from '@glimmer/component'; | |
import { tracked } from '@glimmer/tracking'; | |
import { action } from '@ember/object'; | |
export default class ChangePasswordForm extends Component { | |
@tracked oldPassword; | |
@tracked newPassword; | |
@tracked confirmPassword; |
NewerOlder