This is a scaffold for setting up: an API with Rails and the ember-rails gem, persistence with Ember.Data, and a browser app using Ember.js
See source code on GitHub: pixelhandler/journal.
| source 'https://rubygems.org' | |
| gem 'rails', '4.0.0' | |
| gem 'pg' | |
| gem 'sass-rails', '~> 4.0.0' | |
| gem 'uglifier', '>= 1.3.0' | |
| gem 'coffee-rails', '~> 4.0.0' | |
| gem 'jquery-rails' | |
| gem 'jbuilder', '~> 1.2' | |
| group :doc do |
This is a scaffold for setting up: an API with Rails and the ember-rails gem, persistence with Ember.Data, and a browser app using Ember.js
See source code on GitHub: pixelhandler/journal.
| <script type="text/x-handlebars">{{ outlet }}</script> |
| Ember.DefaultResolver.reopen | |
| resolveComponent: (parsedName) -> | |
| get = Ember.get | |
| classify = Ember.String.classify | |
| className = classify(parsedName.name) + classify(parsedName.type) | |
| factory = get(parsedName.root, className) || get(Core, className) | |
| return factory || @resolveOther parsedName |
| /* Put your CSS here */ | |
| html, body { margin: 20px; } | |
| h1 { font-size: 1.6em; padding-bottom: 10px; } | |
| h2 { font-size: 1.4em; } | |
| dl { padding: 15px; font-size: 1.4em; color: blue; } |
| App = Ember.Application.create(); | |
| App.Router.reopen({ | |
| location: 'history', | |
| rootURL: '/blog/' | |
| }); | |
| App.Router.map(function() { | |
| this.resource('posts', function () { | |
| this.route('archive'); |
| App.ApplicationAdapter = DS.RESTAdapter.extend({ | |
| ajaxError: function(jqXHR) { | |
| var error = this._super(jqXHR), | |
| errors = {}; | |
| if (jqXHR && jqXHR.status === 422) { | |
| var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)["errors"]; | |
| forEach(Ember.keys(jsonErrors), function (key) { | |
| errors[Ember.String.camelize(key)] = jsonErrors[key]; |
| /* Put your CSS here */ | |
| html, body { margin: 20px; } | |
| h1 { font-size: 1.6em; padding-bottom: 10px; } | |
| h2 { font-size: 1.4em; } | |
| dl { padding: 15px; font-size: 1.4em; color: blue; } |