'simple-auth': {
authorizer: 'authorizer:couchdb'
}
ember generate authenticator couchdb
ember generate authorizer couchdb
ember generate initializer authentication
import Authenticator from 'authenticators/couchdb';
import Authorizer from 'authorizers/couchdb';
export function initialize(container, application) {
application.register('authenticator:couchdb', Authenticator);
application.register('authorizer:couchdb', Authorizer);
}
export default {
name: 'authentication',
initialize: initialize
};
import Base from 'simple-auth/authorizers/base';
export default Base.extend({
authorize: function(jqXHR, requestOptions) {
}
});
import Base from 'simple-auth/authorizers/base';
export default Base.extend({
authorize: function(jqXHR, requestOptions) {
}
});
export default Ember.Route.extend({
model: function () {
return this.store.filter('task', {state: 'done', assigned: true}, function(task){
return task.get('state') === 'done';
});
}
});
/api/v1/tasks?state=done&assigned=true
App = Ember.Application.create();
App.Item = DS.Model.extend({
score: DS.attr('number')
});
App.IndexRoute = Ember.Route.extend({
model: function() {
//Ожидайте GET /items
return this.store.find('item');
}
});
App.IndexController = Ember.ArrayController.extend({
headerName: 'FreitagFutter',
appVersion: 2.1,
actions: {
like: function(item) {
item.incrementProperty('score');
//Надо же наверное сохранить?
item.save().catch(function(){
item.rollback();
});
}
}
});