Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
normalButtonPressed() {
this.set('lastButtonPressed', 'normal');
},
submitButtonPressed() {
this.set('lastButtonPressed', 'submit');
@mszoernyi
mszoernyi / application.controller.js
Last active February 27, 2016 22:53
Query Param test
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
queryParams: ['category'],
category: 1
});
import PageObject from 'ui/tests/page-object';
let {
visitable,
fillable,
clickable,
text,
selectable
} = PageObject;
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@mszoernyi
mszoernyi / app.pods.uploader.component.coffee
Created September 14, 2015 13:39
Getting `had no action handler for: doIt` even if action handler is defined in component
class CreativeUploader extends Ember.Component
actions:
doIt: ->
debugger
x = 1
`export default CreativeUploader`
{
"name": "ui",
"version": "0.0.0",
"options": {
"syntaxtype": "coffescript",
"extension": ".em",
"paths": [
"app",
"app/pods"
],
@mszoernyi
mszoernyi / app.sessions.custom.em
Created June 21, 2015 23:34
User object/currentUser as custom session
`import Session from 'simple-auth/session'`
class CustomSession extends Session
#_store: Ember.inject.service("store")
# inject.service(store) lands in ember data 1.13
_store: ~> @container.lookup('store:main')
# TODO with simple-auth 0.8+ the returned api data is stored under secure! so secure.user_id will be the new path
currentUser: Ember.computed 'user_id', 'isAuthenticated', ->
userId = @user_id
@mszoernyi
mszoernyi / snippet
Last active August 29, 2015 14:22
simulate store.find for non ember models
_findCountries: ->
isoCodes = Ember.Object.createWithMixins(IsoCodes)
countries = (Ember.Object.create({ id: code, name: name }) for code, name of isoCodes.isoCountries)
promise = Ember.RSVP.Promise.resolve(countries)
promiseArray = Ember.ArrayProxy.extend(Ember.PromiseProxyMixin)
promiseArray.create({ promise: promise })