rm-components
Version:
The default blueprint for ember-cli addons.
43 lines (35 loc) • 1.12 kB
JavaScript
/* globals Snap */
import Ember from 'ember';
export default Ember.Mixin.create({
defaults: {
'appName': 'Your App',
'organizationName': 'Your App',
'primaryColor': '#66BC47',
'currentDashboardPage': '#All_Events',
'stageArrangement': 'store__stage--iphoneZoomed',
'iPhonePage': '#Feed'
},
// Snap svg generating garbage svg elements
// at body level
_removeKruft() {
Ember.$('body > svg').remove();
},
_updateColors(svgObject, cssClass, color) {
new Snap(svgObject).selectAll(cssClass).attr({ fill: color });
},
hideAllPages(svgId, pageClass, translation = -430, duration = 300) {
this.$(svgId).find(pageClass).velocity({ translateX: translation }, { duration });
},
evacuateAllPages(svgId, pageClass, translation = -430) {
this.hideAllPages(svgId, pageClass, translation, 0);
},
showPage(id, currentPage, svgId, duration = 300) {
if (currentPage === id) {
return;
}
this.$(svgId).find(id).velocity({ translateX: 0 }, { duration });
},
slamPage(id, currentPage, svgId) {
this.showPage(id, currentPage, svgId, 0);
}
});