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 gulp = require('gulp'); | |
var concat = require('gulp-concat'); | |
var stylus = require('gulp-stylus'); | |
gulp.task('styles', function() { | |
gulp.src('./bower_components/bootstrap/dist/css/bootstrap.css') | |
.pipe(concat('vendor.css')) | |
.pipe(gulp.dest('./public')) | |
gulp.src('./assets/**/*.styl') |
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
class SessionsController < ApplicationController | |
def create | |
user = User.find_by_email params[:username] | |
if user && user.authenticate(params[:password]) | |
render json: { access_token: user.access_token } | |
else | |
render json: {}, status: 401 | |
end | |
end | |
end |
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
App.LoginController = Ember.Controller.extend(Ember.SimpleAuth.LoginControllerMixin); |
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
App.Router.map(function() { | |
this.route('login'); | |
}); |
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
App.ApplicationRoute = Ember.Route.extend(Ember.SimpleAuth.ApplicationRouteMixin); | |
App.Router.map(function() { | |
this.resource('todos', { path: '/' }, function() { | |
this.route('active'); | |
this.route('completed'); | |
}); | |
}); |
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.Application.initializer({ | |
name: 'authentication', | |
initialize: function(container, application) { | |
Ember.SimpleAuth.setup(container, application); | |
} | |
}); |
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
DS.RESTAdapter.reopen({ | |
host: 'https://api.example.com' | |
// OR | |
url: 'https://api.example.com' | |
}); |
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
App.TodosRoute = Ember.Route.extend({ | |
model: function () { | |
return this.store.find('todo'); | |
} | |
}); | |
App.TodosIndexRoute = Ember.Route.extend({ | |
model: function () { | |
return this.modelFor('todos'); | |
} |
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
App.TodosController = Ember.ArrayController.extend({ | |
actions: { | |
createTodo: function () { | |
// Get the todo title set by the "New Todo" text field | |
var title = this.get('newTitle'); | |
if (!title.trim()) { return; } | |
// Create the new Todo model | |
var todo = this.store.createRecord( App.Todo, { | |
title: title, |