Add Intel copyright header.
[profile/ivi/cowhide.git] / examples / hoofbeats / javascripts / app / router.js
1 /* vi: set et sw=4 ts=4 si: */
2 /*
3  * Copyright (c) 2012, Intel Corporation.
4  *
5  * This program is licensed under the terms and conditions of the
6  * Apache License, version 2.0.  The full text of the Apache License is at
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  */
10
11 (function(win, app, Ember) {
12     app.Router.map(function() {
13         this.resource('all', {path: '/'});
14     });
15
16     app.AllRoute = Ember.Route.extend({
17         setupController: function(controller) {
18             var self = this;
19
20             if (app.library !== null) {
21                 return;
22             }
23
24             if (win.HoofbeatsLibrary) {
25                 app.library = new win.HoofbeatsLibrary();
26             } else {
27                 setTimeout(function() {
28                     self.initLibrary();
29                 }, 100);
30             }
31         },
32         model: function() {
33             return app.MediaItem.findAll();
34         },
35     });
36 }(window, window.Hoofbeats, window.Ember));