-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added featured channels to the index route
- Loading branch information
1 parent
d547994
commit 0a17335
Showing
8 changed files
with
167 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
define( [ "ember" ], function( Ember ) { | ||
|
||
return Ember.ObjectController.extend({ | ||
stream: function() { | ||
return this.get( "model.featured.0.stream" ); | ||
}.property( "model.featured.0.stream" ), | ||
|
||
actions: { | ||
"switchFeatured": function( stream ) { | ||
this.set( "stream", stream ); | ||
} | ||
} | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
define( [ "utils/twitch" ], function( twitch ) { | ||
|
||
return function( limit, offset ) { | ||
return twitch( "streams/featured", { | ||
limit: limit, | ||
offset: offset | ||
}); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
define( [ "utils/twitch" ], function( twitch ) { | ||
|
||
return function() { | ||
return twitch( "streams/summary" ); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
define( [ "ember" ], function( Ember ) { | ||
define([ | ||
"ember", | ||
"utils/preload", | ||
"models/Summary", | ||
"models/Featured" | ||
], function( Ember, preload, ModelSummary, ModelFeatured ) { | ||
|
||
return Ember.Route.extend({ | ||
beforeModel: function() { | ||
//this.transitionTo( "games" ); | ||
model: function() { | ||
return Ember.RSVP.all([ | ||
ModelSummary(), | ||
ModelFeatured( 5, 0 ) | ||
]) | ||
.then(function( models ) { | ||
return { | ||
summary: models[0], | ||
featured: models[1].featured | ||
}; | ||
}) | ||
.then( preload([ | ||
"[email protected]", | ||
"[email protected][email protected]" | ||
]) ); | ||
} | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
<h2>Index</h2> | ||
<h2>Featured channels</h2> | ||
<section class="featured"> | ||
<h3 class="title">{{stream.channel.name}}</h3> | ||
<div class="preview" {{action "open_livestreamer" stream}}><img {{bind-attr src=stream.preview}}></div> | ||
<p class="game">{{#link-to "games.game" stream.game}}{{stream.game}}{{/link-to}}</p> | ||
<p class="stats"><i class="fa fa-clock-o"></i> {{hours-from-now stream.channel.updated_at}} <i class="fa fa-users"></i> {{format-viewers stream.viewers}}</p> | ||
<p class="status">{{stream.channel.status}}</p> | ||
<ul> | ||
{{#each featured in model.featured}} | ||
<li {{bind-attr title="featured.channel.name"}} {{action "switchFeatured" featured.stream}}> | ||
<img src="{{unbound featured.image}}" title="{{unbound featured.stream.channel.name}}"> | ||
</li> | ||
{{/each}} | ||
</ul> | ||
</section> | ||
<section class="globalstats">There are {{model.summary.viewers}} people watching {{model.summary.channels}} live streams right now!</section> |