Last active
August 22, 2017 12:36
-
-
Save sacarino/4ce41fd16d94a84c70951e228abef9b7 to your computer and use it in GitHub Desktop.
Notifications Signup Wizard v3
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'; | |
export default Ember.Component.extend({ | |
tagName: 'ul', | |
classNames: ['steps'], | |
currentPath: null, //passed in value, is current route | |
steps: null, | |
activeIndex: function(){ | |
var currentPath = this.get('currentPath'); | |
var steps = this.get('steps'); | |
for(var i = 0; i < steps.length; i++){ | |
if(steps[i].route === currentPath){ | |
return i; | |
} | |
} | |
}.property('currentPath') | |
}); |
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'; | |
export default Ember.Component.extend({ | |
tagName: 'li', | |
attributeBindings: ['displayIndex:data-step'], | |
classNameBindings: ['isActive:active'], | |
index: null, | |
displayIndex: function(){ | |
return this.get('index') + 1; | |
}.property('index'), | |
isActive: function(){ | |
return this.get('activeIndex') === this.get('index'); | |
}.property('activeIndex', 'index') | |
}); |
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'; | |
export default Ember.Controller.extend({ | |
appName: 'Activity Streams Demo' | |
}); |
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'; | |
export default Ember.Controller.extend({ | |
selectedType: null, | |
selectedSubject: null, | |
selectedTarget: null, | |
selectedId: null, | |
sortedTypes: Ember.computed(function() { | |
var myType = this.store.createRecord('notification-type'); | |
myType.set('id',1); | |
myType.set('label', 'wtf'); | |
myType.set('order',1); | |
return myType; //this.store.peekAll('notification-type'); //[{"order": 1,"label":"test","id":1 }] | |
}), | |
sortedSubjects: Ember.computed(function() { | |
var _subjects = this.store.find('notification-subjects').sortBy('order'); | |
return _subjects; | |
}), | |
actions: { | |
chooseType() { | |
console.log('selected'); | |
} | |
} | |
}); |
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'; | |
import CurrentRouteAware from '../mixins/current-route-aware'; | |
var RouteVal = Ember.Object.extend({ | |
route: null, | |
val: null | |
}); | |
export default Ember.Controller.extend(CurrentRouteAware, { | |
routeValues: [ | |
RouteVal.create({ | |
route: 'wizard.index', | |
step: 'Activity streams', | |
next: 'Get started', | |
nextTransition: 'wizard.create', | |
prevTransition: '/', | |
showNext: true, | |
showPrev: false | |
}), | |
RouteVal.create({ | |
route: 'wizard.create', | |
step: 'Tell me about...', | |
next: 'Next', | |
prev: 'Back', | |
nextTransition: 'wizard.when', | |
prevTransition: 'wizard.index', | |
showNext: true, | |
showPrev: true | |
}), | |
RouteVal.create({ | |
route: 'wizard.when', | |
step: 'But only when...', | |
next: 'Next', | |
prev: 'Back', | |
nextTransition: 'wizard.review', | |
prevTransition: 'wizard.create', | |
showNext: true, | |
showPrev: true | |
}), | |
RouteVal.create({ | |
route: 'wizard.review', | |
step: 'Review', | |
prev: 'Back', | |
prevTransition: 'wizard.when', | |
showNext: false, | |
showPrev: true | |
}) | |
], | |
nextButton: routeVal('routeValues', 'next'), | |
prevButton: routeVal('routeValues', 'prev'), | |
nextTransition: routeVal('routeValues', 'nextTransition'), | |
showButtons: routeVal('routeValues', 'showButtons'), | |
prevTransition: routeVal('routeValues', 'prevTransition'), | |
showNext: routeVal('routeValues', 'showNext'), | |
showPrev: routeVal('routeValues', 'showPrev'), | |
actions: { | |
next: function(){ | |
this.transitionToRoute(this.get('nextTransition')); | |
}, | |
prev: function(){ | |
this.transitionToRoute(this.get('prevTransition')); | |
} | |
} | |
}); | |
function routeVal(routeVals, prop){ | |
return Ember.computed('currentPath', function(){ | |
var currentRoute = Ember.get(this, 'currentPath'); | |
var routeValues = Ember.get(this, routeVals); | |
for (var i = 0; i < routeValues.length; i++) { | |
if (routeValues[i].route === currentRoute) { | |
return routeValues[i][prop]; | |
} | |
} | |
}); | |
} | |
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'; | |
export default Ember.Mixin.create({ | |
application: Ember.inject.controller(), | |
currentPath: Ember.computed.alias("application.currentPath") | |
}); |
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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
let string = attr('string'); | |
export default Model.extend({ | |
order: string, | |
label: string | |
}); |
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'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('wizard', function(){ | |
this.route('index'); | |
this.route('create'); | |
this.route('when'); | |
this.route('review'); | |
}); | |
}); | |
export default Router; |
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'; | |
export default Ember.Route.extend({ | |
model: function() { | |
this.transitionTo('wizard'); | |
} | |
}); |
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 url('https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css'); | |
@import url('https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css'); | |
@import url('https://www.fuelcdn.com/fuelux/3.13.0/css/fuelux.css'); | |
@import url('https://fonts.googleapis.com/css?family=Exo:200|Oswald|Work+Sans'); | |
html, body { | |
margin: 20px; | |
} | |
h4 { | |
margin: 20px; | |
} | |
.readable { | |
font-family: 'Work Sans', sans-serif; | |
line-height: 1.8; | |
font-size: larger; | |
margin-left: 50px; | |
} |
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.2.7", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"bootstrap-css": "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css", | |
"bootstrap-js": "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js", | |
"ember": "1.13.13", | |
"normalize-css": "https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css", | |
"fuelux-css": "https://www.fuelcdn.com/fuelux/3.13.0/css/fuelux.css", | |
"fuel-js": "https://www.fuelcdn.com/fuelux/3.13.0/js/fuelux.js", | |
"ember-data": "1.13.15" | |
}, | |
"addons": { | |
"ember-ted-select": "2.2.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment