This repository has been archived by the owner on Nov 11, 2017. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 200
/
app.js
executable file
·113 lines (97 loc) · 2.55 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
var App = Ember.Application.create();
App.Router.map(function() {
this.resource('stations', function() {
this.resource('stations.tracks', { path: ':station_id/tracks' }, function() {
this.route('playing', { path: ':tracks_id' } );
})
});
});
App.IndexRoute = Ember.Route.extend({
redirect: function() {
this.transitionTo('stations');
}
});
App.StationsRoute = Ember.Route.extend({
model: function() {
return App.Station.find();
//return Em.A([]);
}
});
App.TracksRoute = Ember.Route.extend({
model: function(params) {
return App.Tracks.find(params.listing_id);
}
});
App.StationsIndexView = Ember.View.extend({
isActive: true
});
App.StationsTracksPlayingView = Ember.View.extend({
scBaseUrl: 'https://w.soundcloud.com/player/',
scTrackSourceUrlBinding: 'controller.model.url',
scIframeSourceUrl: function() {
return this.scBaseUrl + '?url=' + this.scTrackSourceUrl;
}.property()
});
App.SearchController = Ember.Object.create({
search: function(query){
alert(query);
//console.log('search for %@'.fmt( this.get('searchText') ));
}
});
App.SearchView = Ember.TextField.extend({
valueBinding: 'App.SearchController.model',
didInsertElement: function() {
this.$().focus();
},
insertNewline: function() {
var value = this.get('value');
if (value) {
App.get('SearchController').search(value);
}
}
});
App.Store = DS.Store.extend({
revision: 11,
adapter: 'DS.FixtureAdapter'
});
App.Station = DS.Model.extend({
name: DS.attr('string'),
tracks: DS.hasMany('App.Tracks')
});
App.Tracks = DS.Model.extend({
title: DS.attr('string'),
url: DS.attr('string')
});
App.Station.FIXTURES = [
{
id: 1,
name: 'Carl Craig',
tracks: [100]
},
{
id: 2,
name: 'Stacey Pullen',
tracks: [200]
}
];
App.Tracks.FIXTURES = [
{
id: 100,
title: '20 Years Of Planet E Essential Mix',
url: 'https://api.soundcloud.com/r_co/carl-craig-20-years-of-planet'
},
{
id: 200,
title: 'Stacey Pullen Live',
url: 'https://api.soundcloud.com/staceypullen/stacey-pullen-live'
},
];
//window.setTimeout(function(){
//var baseUrl = 'https://w.soundcloud.com/player/';
//var pullenUrl = 'https://api.soundcloud.com/staceypullen/stacey-pullen-live';
//var craigUrl = 'https://api.soundcloud.com/r_co/carl-craig-20-years-of-planet';
//var widgetIframe = document.getElementById('sc-widget');
////widgetIframe.src = baseUrl + "?url=" + pullenUrl;
////App.SCWidget = SC.Widget(widgetIframe);
////App.SCWidget.load(craigUrl);
//}, 1000);