View components.create-segment-modal.js
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'; | |
export default Ember.Component.extend({ | |
hasName: Ember.computed.notEmpty('name'), | |
actions: { | |
log(message) { | |
console.log(message); | |
} | |
} | |
}); |
View components.x-modal-body.js
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'; | |
export default Ember.Component.extend({ | |
}); |
View creating_routes
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
ember g route frontpage | |
ember g route new | |
ember g route jobs | |
ember g route ask | |
ember g route active | |
ember g route show |
View updating_model_hooks
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
For routes active, ask, jobs, new, show | |
model () { | |
return this.get('store').query('item', | |
{ | |
page: 1, | |
filter: 'NAME_OF_ROUTE' | |
}); | |
} |
View updating_templates
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
{{#each model as |item|}} | |
<p> | |
<strong>id:</strong> {{item.id}}<br> | |
<strong>title:</strong> {{item.title}}<br> | |
<strong>points:</strong> {{item.points}}<br> | |
<strong>time:</strong> {{item.time}}<br> | |
<strong>time ago:</strong> {{item.timeAgo}}<br> | |
<strong>comments count</strong> {{story.commentsCount}}<br> | |
<strong>url</strong> <a href="{{item.url}}">{{item.url}}</a><br> | |
<strong>domain</strong> <a href="http://{{item.domain}}">{{item.domain}}</a><br> |
View item.js
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 DS from 'ember-data'; | |
import { computed } from '@ember/object'; | |
export default DS.Model.extend({ | |
title: DS.attr('string'), | |
points: DS.attr('number'), | |
time: DS.attr('unix-date'), | |
timeAgo: DS.attr('string'), | |
url: DS.attr('string'), | |
domain: DS.attr('string'), |
View comment.js
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 DS from 'ember-data'; | |
export default DS.Model.extend({ | |
content: DS.attr('string'), | |
user: DS.attr('string'), | |
timeAgo: DS.attr('string'), | |
comments: DS.hasMany('comments', { inverse: null }) | |
}); |
View item.js
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 Route from '@ember/routing/route'; | |
export default Route.extend({ | |
model(params) { | |
return this.get('store').findRecord('item', params.id); | |
} | |
}); |