diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2014-12-20 03:24:02 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2014-12-20 03:24:30 +0100 |
commit | a9e676eb8af8f9881c152dacbea450610e8002fa (patch) | |
tree | a83ca6a3d43399d186bc8633eb3a844c1ae96a26 /imdb-lookup/js/app.js | |
parent | 40b87932d30980b26eff81f9184441a119a13dd7 (diff) | |
download | scripts-a9e676eb8af8f9881c152dacbea450610e8002fa.tar.gz scripts-a9e676eb8af8f9881c152dacbea450610e8002fa.zip |
upgrade to ember.js
Diffstat (limited to 'imdb-lookup/js/app.js')
-rw-r--r-- | imdb-lookup/js/app.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/imdb-lookup/js/app.js b/imdb-lookup/js/app.js new file mode 100644 index 0000000..b49d1c9 --- /dev/null +++ b/imdb-lookup/js/app.js @@ -0,0 +1,60 @@ +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.find('movies') + } +}); + +App.Movies = DS.Model.extend({ + FIXTURES : [], + title: DS.attr('string'), + path: DS.attr('string'), + poster: DS.attr('string'), + tagline: DS.attr('string'), + plot: DS.attr('string'), + website: 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'), + + 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') +}) + +Ember.Handlebars.helper('filelink', function(value, options) { + var escaped = encodeURIComponent(value); + return new Ember.Handlebars.SafeString('<a href="' + escaped + '">' + value + '</span>'); +}); + +function dataCb(data) { + App.Movies.reopenClass({ + FIXTURES : data + }); +} +window['dataCb'] = dataCb; + |