Skip to content

Instantly share code, notes, and snippets.

Avatar
😅
Always learning

serena serenaf

😅
Always learning
View GitHub Profile
View serena.js
alert("You have been pawned!")
@serenaf
serenaf / overview.md
Last active Nov 7, 2017
Ember Beginner Workshop
View overview.md
View creating_item_model
ember g model item title:string points:number time:unix-date timeAgo:string url:string domain:string
View getting_started.txt
npm install -g ember-cli@2.16
git clone https://github.com/intercom/ember-hacker-news.git
npm install
@serenaf
serenaf / item-component.hbs
Created Nov 7, 2017
Use the new markAsRead action
View item-component.hbs
<div>
<a href="{{item.externalUrl}}">{{item.title}}</a>
<div>
<span>{{item.points}} points by {{item.user}} {{item.timeAgo}} </span>
<span {{action markAsRead}} class='hide-button test__item-delete-button'>
{{fa-icon "eye-slash"}}
</span>
</div>
{{#link-to 'item' item.id}} {{item.commentsCount}} Comments{{/link-to}}
</div>
View install font-awesome
ember install ember-font-awesome
@serenaf
serenaf / frontpage.hbs
Created Nov 7, 2017
Pass actions to components
View frontpage.hbs
{{item-list-component
items=model
markAsRead=(action "markAsRead")
}}
View gist:913972366dca2d4d3f6598968de53ee9
import Controller from '@ember/controller';
export default Controller.extend({
actions: {
markAsRead(item) {
this.get('store').unloadRecord(item);
}
}
});
@serenaf
serenaf / active.js
Created Nov 7, 2017
Adding Base Controller and route controllers
View active.js
import BaseController from 'ember-hacker-news/controllers/base-controller';
export default BaseController.extend({
});
View comment-component.hbs
<div class="comment">
<em>{{comment.user}} {{comment.timeAgo}}</em>
<p>{{{comment.content}}}</p>
{{#each comment.comments as |childComment|}}
{{comment-component comment=childComment}}
{{/each}}
</div>