Skip to content

Instantly share code, notes, and snippets.

@ErikCH
Created August 16, 2017 05:18
Show Gist options
  • Save ErikCH/9953c6cc23c672f8559bfcb1f160e326 to your computer and use it in GitHub Desktop.
Save ErikCH/9953c6cc23c672f8559bfcb1f160e326 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
update() {
this.get('model').pushObject({
name: 'Joe Bloe',
text: this.get('text'),
photo: 'https://static.pexels.com/photos/413444/pexels-photo-413444.jpeg'
});
}
}
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return [
{name: 'Erik Hanchett',
text: 'This is a comment',
photo: 'https://static.pexels.com/photos/413444/pexels-photo-413444.jpeg'
},
{name: 'Jane Doe',
text: 'This is a comment 2',
photo: 'https://static.pexels.com/photos/37533/studio-portrait-woman-face-37533.jpeg'
}
]
}
});
body {
width: 500px;
margin: 20px auto;
font: 16px/1.4 Arial, sans-serif;
background: #f3eee9;
}
p {
margin: 0 0 1em;
}
.comment {
overflow: hidden;
padding: 0 0 1em;
border-bottom: 1px solid #ddd;
margin: 0 0 1em;
*zoom: 1;
}
.comment-img {
float: left;
margin-right: 33px;
border-radius: 5px;
overflow: hidden;
}
.comment-img img {
display: block;
}
.comment-body {
overflow: hidden;
}
.comment .text {
padding: 10px;
border: 1px solid #e5e5e5;
border-radius: 5px;
background: #fff;
}
.comment .text p:last-child {
margin: 0;
}
.comment .attribution {
margin: 0.5em 0 0;
font-size: 14px;
color: #666;
}
/* Decoration */
.comments,
.comment {
position: relative;
}
.comments:before,
.comment:before,
.comment .text:before {
content: "";
position: absolute;
top: 0;
left: 65px;
}
.comments:before {
width: 3px;
top: -20px;
bottom: -20px;
background: rgba(0,0,0,0.1);
}
.comment:before {
width: 9px;
height: 9px;
border: 3px solid #fff;
border-radius: 100px;
margin: 16px 0 0 -6px;
box-shadow: 0 1px 1px rgba(0,0,0,0.2), inset 0 1px 1px rgba(0,0,0,0.1);
background: #ccc;
}
.comment:hover:before {
background: orange;
}
.comment .text:before {
top: 18px;
left: 78px;
width: 9px;
height: 9px;
border-width: 0 0 1px 1px;
border-style: solid;
border-color: #e5e5e5;
background: #fff;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
}​
<section class="comments">
{{#each model as |comment|}}
{{comment-component name=comment.name
photo=comment.photo text=comment.text}}
{{/each}}
</section>​
{{input value=text enter="update" placeholder='Enter Comment'}}
<article class="comment">
<a class="comment-img" href="#non">
<img src="{{photo}}" alt="" width="50" height="50">
</a>
<div class="comment-body">
<div class="text">
<p>{{text}}</p>
</div>
<p class="attribution">by <a href="#non">{{name}}</a> at 14:23pm, 4th Dec 2010</p>
</div>
</article>
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment