This file contains 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
// ember-model-based adapter | |
Ember.WAMAdapter = Ember.Object.extend({ | |
table: null, | |
init: function() { | |
this.table = this.get('table'); | |
}, | |
find: function(record, id) { | |
var query = this.table.where({ id: id }); | |
return query.read().then(function(data) { |
This file contains 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
var attr = Ember.attr; | |
//define model | |
App.Post = Ember.Model.extend({ | |
id: attr('number'), | |
title: attr('string'), | |
author: attr('string'), | |
body: attr('string'), | |
posted: attr('date') | |
}); |
This file contains 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
// Newpost controller | |
App.NewpostController = Ember.ObjectController.extend({ | |
title: '', | |
author: '', | |
body: '', | |
save: function() { | |
//create the post | |
var now = new Date(); | |
var post=App.Post.create({ |
This file contains 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
//login statemachine | |
App.LoginStateManager = Ember.StateManager.create({ | |
initialState: "isNotAuthenticated", | |
isAuthenticated: Ember.State.create({ | |
enter: function () { | |
console.log("enter " + this.name); | |
}, | |
logout: function (manager, context) { | |
manager.transitionTo('isNotAuthenticated'); | |
} |
This file contains 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
//Application controller, since we want login to be an application wide thing | |
//login/logout events are bubbled up to here regardless of the page you are on | |
App.ApplicationController = Em.Controller.extend({ | |
authStateBinding: Ember.Binding.oneWay('App.LoginStateManager.currentState.name'), | |
authState: null, | |
isAuthenticated: function () { | |
return (this.get('authState') == 'isAuthenticated'); | |
}.property('authState'), |
This file contains 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
function insert(item, user, request) { | |
item.author = "Unknown"; | |
var identities = user.getIdentities(); | |
var url; | |
if (identities.google) { | |
var googleAccessToken = identities.google.accessToken; | |
url = 'https://www.googleapis.com/oauth2/v1/userinfo?access_token=' + googleAccessToken; | |
} else if (identities.facebook) { |
This file contains 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
'ftp-deploy': { | |
build: { | |
auth: { | |
host: "waws-prod-blah-001.ftp.azurewebsites.windows.net", | |
port: 21, | |
authKey: 'key1' | |
}, | |
src: 'dist', | |
dest: '/site/wwwroot' | |
} |
This file contains 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
{ | |
"key1": { | |
"username": "website\\username", | |
"password": "website password" | |
} | |
} |