Skip to content

Instantly share code, notes, and snippets.

View maybe-test.html
<!DOCTYPE html>
<!-- GistID: 9abdf469d6c4d0268973ea3e674bd50f -->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>Mini Maybe Tests</title>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.9.2.css">
</head>
<body>
View controllers.application.js
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default Controller.extend({
warningModal: service(),
actions: {
warningModalResolve() {
this.warningModal.resolve(...arguments);
}
View controllers.application.js
import Controller from '@ember/controller';
import { reads } from '@ember/object/computed';
export default Controller.extend({
children: reads('model'),
actions: {
clickChild(child) {
child.parent.then(parent => {
console.log(parent.name);
});
@sukima
sukima / controllers.application.js
Last active Mar 16, 2019
ember-data 3.7 relationships
View controllers.application.js
import Controller from '@ember/controller';
import { reads } from '@ember/object/computed';
export default Controller.extend({
bars: reads('model')
});
@sukima
sukima / components.aria-check-box.js
Last active Mar 13, 2019
Provider Component: Options Selector
View components.aria-check-box.js
import Component from '@ember/component';
import { computed } from '@ember/object';
import { STATES } from './options-selector';
// FYI: doing ARIA role="checkbox" by hand is a PITA! Go native!
export default Component.extend({
tagName: '',
isChecked: computed('checked', function() {
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@sukima
sukima / data.app-page-people.js
Last active Feb 24, 2019
Removing rouge links.related
View data.app-page-people.js
export default {
data: [
{
id: '1',
type: 'app-page-people',
attributes: {
'sort-order': 34
},
relationships: {
page: {
View controllers.application.js
import Controller from '@ember/controller';
import { reads } from '@ember/object/computed';
export default Controller.extend({
queryParams: ['theObject'],
actions: {
updateTheObject() {
this.set('theObject', { appName: this.appName });
}
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@sukima
sukima / adapters.application.js
Created Feb 11, 2019
Custom adapter endpoints
View adapters.application.js
import JSONAPIAdapter from 'ember-data/adapters/json-api';
export default JSONAPIAdapter.extend({
namespace: '/api'
});
You can’t perform that action at this time.