Skip to content

Instantly share code, notes, and snippets.

@davidpett
Last active April 6, 2017 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidpett/b56e962e2109fa02671f17e238f1006b to your computer and use it in GitHub Desktop.
Save davidpett/b56e962e2109fa02671f17e238f1006b to your computer and use it in GitHub Desktop.
import Module from './module';
export default Module.extend({
});
import Ember from 'ember';
import Contentful from 'ember-data-contentful/models/contentful';
import attr from 'ember-data/attr';
import { hasMany } from 'ember-data/relationships';
const {
computed,
get
} = Ember;
export default Contentful.extend({
title: attr('string')
images: hasMany('contentful-asset'),
moduleType: computed('contentType', function() {
return get(this, 'contentType') ? `${get(this, 'contentType').dasherize()}` : null;
})
});
<h1>{{model.title}}</h1>
{{#each model.modules as |module|}}
{{component module.moduleType model=module}}
{{/each}}
import Contentful from 'ember-data-contentful/models/contentful';
import attr from 'ember-data/attr';
export default Contentful.extend({
title: attr('string')
modules: hasMany('module')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment