Skip to content

Instantly share code, notes, and snippets.

@iezer
Last active January 17, 2017 22:44
Show Gist options
  • Save iezer/c2f209ba0c9242b5c11220a0662bc333 to your computer and use it in GitHub Desktop.
Save iezer/c2f209ba0c9242b5c11220a0662bc333 to your computer and use it in GitHub Desktop.
Liquid Fire App - Ember Elsewhere Animated
import Ember from 'ember';
let duration = 400;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
animationRules: animationRules
});
function animationRules() {
this.transition(
this.toValue(true),
this.useAndReverse('fade', { duration })
);
}
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('item', { path: '/:id' });
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model() {
let result = [];
for (let i = 1; i<= 10; i++) {
result.push({
id: i,
name: `Product #${i}`
});
}
return result;
}
});
.header, .footer {
position: fixed;
height: 75px;
width: 100%;
background: orange;
left: 0px;
}
.header { top: 0px; }
.footer { bottom: 0px; }
.application__body {
position: fixed;
width: 100%;
top: 75px;
bottom: 75px;
}
.item {
border: 1px solid black;
margin: 5px;
}
.index__scroll-container {
height: 100%;
overflow-y: scroll;
/* Required for momentum scrolling in iOS Safari.
also overflow-y has to be 'scroll' and not 'auto'
*/
-webkit-overflow-scrolling: touch;
}
.item.focused {
border: 1px solid red;
margin: 5px;
}
<div class='header'>
{{#from-elsewhere name="header" as |header|}}
{{#liquid-bind header rules=animationRules as |opts|}}
{{opts.title}}
{{/liquid-bind}}
{{/from-elsewhere}}
</div>
<div class='application__body'>
{{outlet}}
</div>
<div class='footer'>
Footer
</div>
<div class='index__scroll-container'>
{{#each model as |item|}}
{{#link-to 'item' item}}
<div class='item'>
{{item.name}}
</div>
{{/link-to}}
{{/each}}
</div>
{{to-elsewhere named="header" send=(hash title="Product List")}}
<div class='item focused'>
{{model.name}} Detail
</div>
{{link-to 'Back' 'application'}}
{{to-elsewhere named="header" send=(hash title="Details")}}
{
"version": "0.10.7",
"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.4.5",
"ember-template-compiler": "2.4.5",
"ember-testing": "2.4.5"
},
"addons": {
"liquid-fire": "0.24.0",
"ember-elsewhere": "0.4.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment