var App = Ember.Application.create(); App.ApplicationAdapter = DS.FixtureAdapter.extend(); App.Router.map(function() { // put your routes here }); App.IndexRoute = Ember.Route.extend({ model: function() { return this.store.findAll('movie'); } }); App.Movie = DS.Model.extend({ title: DS.attr('string'), path: DS.attr('string'), poster: DS.attr('string'), tagline: DS.attr('string'), plot: DS.attr('string'), website: DS.attr('string'), release: DS.attr('string'), movieFiles: DS.attr(), imdbRating: DS.attr('int'), imdbVotes: DS.attr('int'), omdbTomatoConsensus: DS.attr('string'), omdbTomato: DS.attr('int'), omdbUserTomato: DS.attr('int'), omdbTomatoRating: DS.attr(), omdbTomatoUserRating: DS.attr(), omdbTomatoFresh: DS.attr('int'), tmdbId: DS.attr('int') }) App.MovieController = Ember.ObjectController.extend({ linkTmdb: function() { return "http://www.themoviedb.org/movie/" + this.get('tmdbId'); }.property('tmdbId'), linkImdb: function() { return "http://www.imdb.com/title/" + this.get('id'); }.property('id'), linkLetterboxd: function() { return "http://letterboxd.com/tmdb/" + this.get('tmdbId'); }.property('tmdbId'), linkOfdb: function() { return "http://www.ofdb.de/view.php?page=suchergebnis&Kat=IMDb&SText=" + this.get('id'); }.property('id') }); App.IndexController = Ember.ArrayController.extend({ itemController: 'movie', filter: '', filteredContent: function(){ var filter = this.get('filter'); var content = this.get('arrangedContent'); if (filter.length > 2) { var rx = new RegExp(filter, 'gi'); return content.filter(function(movie) { return movie && movie.get('title').match(rx); }); } else { return content; } }.property('arrangedContent', 'filter'), actions: { sortBy: function(property) { this.set('sortProperties', [property]); this.set('sortAscending', !this.get('sortAscending')); } } }); Ember.Handlebars.helper('filelink', function(value, options) { var escaped = encodeURIComponent(value); return new Ember.Handlebars.SafeString('' + value + ''); }); function dataCb(data) { App.Movie.FIXTURES = data; } window['dataCb'] = dataCb;