Last active
April 30, 2017 23:54
-
-
Save jwlawrence/0334972688d8ccf699b820d783f1b624 to your computer and use it in GitHub Desktop.
ember-tri-state
This file contains hidden or 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'; | |
const { computed, Controller } = Ember; | |
export default Controller.extend({ | |
showLastSuccessful: true, | |
actions: { | |
resetShowLastSuccessful() { | |
this.set('showLastSuccessful', true); | |
}, | |
flushAndRefreshModel() { | |
this.set('showLastSuccessful', false); | |
return true; | |
}, | |
}, | |
}); |
This file contains hidden or 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'; | |
const { Route, run } = Ember; | |
export default Route.extend({ | |
model() { | |
return { | |
lastUpdated: new Date(), | |
postRequest: this.getPost(), | |
commentsRequest: this.getComments(), | |
adsRequest: this.getAds(), | |
} | |
}, | |
getPost() { | |
return new Promise((resolve, reject) => { | |
run.later(this, () => { | |
resolve({ | |
id: 1, | |
title: "This is the Post Title", | |
body: "Quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto" | |
}); | |
}, 1500); | |
}); | |
}, | |
getComments() { | |
return new Promise((resolve, reject) => { | |
run.later(this, () => { | |
resolve([ | |
{ | |
id: 1, | |
name: "Elise", | |
email: "[email protected]", | |
body: "Laudantium enim quasi est quidem magnam voluptate!" | |
}, | |
{ | |
id: 2, | |
name: "Jayne", | |
email: "[email protected]", | |
body: "Est natus enim nihil est dolore." | |
} | |
]); | |
}, 3000); | |
}); | |
}, | |
getAds() { | |
return new Promise((resolve, reject) => { | |
run.later(this, () => { | |
reject({ message: 'There was an error fetching ads' }); | |
}, 5000) | |
}); | |
}, | |
actions: { | |
flushAndRefreshModel() { | |
this.refresh(); | |
}, | |
refreshModel() { | |
this.refresh(); | |
} | |
}, | |
}); |
This file contains hidden or 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
html { | |
box-sizing: border-box; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} | |
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.controls { | |
padding: 0 2% 20px; | |
} | |
.content { | |
display: flex; | |
flex-flow: row wrap; | |
} | |
.card { | |
background: rgb(245,245,245); | |
border-radius: 20px; | |
flex: 1 1 46%; | |
margin: 0 2% 20px; | |
padding: 0 20px; | |
position: relative; | |
overflow: hidden; | |
} | |
.card--full { | |
flex: 1 1 100%; | |
} | |
.post, | |
.comments { | |
position: relative; | |
} | |
.loader { | |
background: lightskyblue; | |
border-radius: 10px; | |
color: white; | |
padding: 6px 12px; | |
position: absolute; | |
top: 10px; | |
right: 10px; | |
} | |
.spinner { | |
font-style: italic; | |
margin: 20px auto; | |
} | |
.spinner:before { | |
content: ''; | |
box-sizing: border-box; | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
width: 20px; | |
height: 20px; | |
margin-top: -10px; | |
margin-left: -10px; | |
border-radius: 50%; | |
border-top: 2px solid #07d; | |
border-right: 2px solid transparent; | |
animation: spinner .6s linear infinite; | |
} | |
@keyframes spinner { | |
to {transform: rotate(360deg);} | |
} |
This file contains hidden or 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
{ | |
"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.11.2", | |
"ember-data": "2.12.1", | |
"ember-template-compiler": "2.11.2", | |
"ember-testing": "2.11.2" | |
}, | |
"addons": { | |
"ember-concurrency": "0.8.1", | |
"ember-tri-state": "1.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment