Last active
December 21, 2015 00:19
-
-
Save kokeroulis/6219804 to your computer and use it in GitHub Desktop.
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
diff --git a/public/javascripts/config/routes.js b/public/javascripts/config/routes.js | |
index 5164d7f..db499da 100644 | |
--- a/public/javascripts/config/routes.js | |
+++ b/public/javascripts/config/routes.js | |
@@ -2,7 +2,7 @@ var App = require('./app'); | |
App.Router.map(function() { | |
this.resource("channels", function() { | |
- this.resource("channel", {path: "/channel/:channelId"}); | |
+ this.resource("channel", {path: "/channel/:channel_id"}); | |
}); | |
}); | |
diff --git a/public/javascripts/models/channel.js b/public/javascripts/models/channel.js | |
index e0d2f38..30a44d9 100644 | |
--- a/public/javascripts/models/channel.js | |
+++ b/public/javascripts/models/channel.js | |
@@ -4,8 +4,8 @@ var ChannelModel = Ember.Object.extend({}); | |
ChannelModel.reopenClass({ | |
find: function(channelId) { | |
console.log("channnnnnnnid") | |
- console.log(channelId) | |
- var assets = Ember.A(); | |
+ | |
+ var assets = Ember.A(); | |
utils.get('channel/' + channelId, function(response) { | |
response.assets.forEach(function(c) { | |
assets.pushObject(ChannelModel.create(c)); | |
diff --git a/public/javascripts/routes/channel_route.js b/public/javascripts/routes/channel_route.js | |
index 828abcf..fbd43f0 100644 | |
--- a/public/javascripts/routes/channel_route.js | |
+++ b/public/javascripts/routes/channel_route.js | |
@@ -3,15 +3,16 @@ var ChannelModel = require('../models/channel.js'); | |
var ChannelRoute = Ember.Route.extend({ | |
model: function(params) { | |
- return ChannelModel.find(params.channelId); | |
+ return ChannelModel.find(params.channel_id); | |
}, | |
serialize: function(model) { | |
- return { channelId: model.id }; | |
+ return { channel_id: model.id }; | |
}, | |
setupController: function(controller, model) { | |
- controller.set("model", ChannelModel.find(model.id)); | |
+ this.controllerFor('channel').set("assets", ChannelModel.find(model.id)); | |
+ this.controllerFor("channels").set('currentChannel', ChannelModel.find(model.id)) | |
} | |
}); | |
diff --git a/public/javascripts/routes/channels_route.js b/public/javascripts/routes/channels_route.js | |
index c947e1c..c93b224 100644 | |
--- a/public/javascripts/routes/channels_route.js | |
+++ b/public/javascripts/routes/channels_route.js | |
@@ -2,7 +2,11 @@ var utils = require('../utils.js'); | |
var ChannelsModel = require('../models/channels.js'); | |
var ChannelsRoute = Ember.Route.extend({ | |
- model: ChannelsModel.findAll | |
+ model: ChannelsModel.findAll, | |
+ | |
+ setupController: function(controller, model) { | |
+ controller.set("channels", model); | |
+ } | |
}); | |
module.exports = ChannelsRoute; | |
diff --git a/public/javascripts/templates/channel.hbs b/public/javascripts/templates/channel.hbs | |
index 6dce080..0c1e303 100644 | |
--- a/public/javascripts/templates/channel.hbs | |
+++ b/public/javascripts/templates/channel.hbs | |
@@ -1,6 +1,6 @@ | |
<div class="row-fluid show-grid"> | |
<ul class="thumbnails"> | |
- {{#each item in model}} | |
+ {{#each item in assets}} | |
<li class="span4"> | |
<div class="thumbnail" data-toggle="modal" align="center"> | |
<a href="#modalId_{{unbound item.id}}" data-toggle="modal"> | |
diff --git a/public/javascripts/templates/channels.hbs b/public/javascripts/templates/channels.hbs | |
index 53b0599..3708fd3 100644 | |
--- a/public/javascripts/templates/channels.hbs | |
+++ b/public/javascripts/templates/channels.hbs | |
@@ -2,7 +2,14 @@ | |
<div class="row-fluid"> | |
<div class="span2"> | |
<ul class="nav nav-tabs nav-stacked affix"> | |
- {{#each item in model}} | |
+ {{#each item in channels}} | |
+ <li> | |
+ {{#linkTo "channel" item}} | |
+ <img src="{{unbound item.image}}">{{item.name}}</img> | |
+ {{/linkTo}} | |
+ </li> | |
+ {{/each}} | |
+ {{#each item in currentChannel}} | |
<li> | |
{{#linkTo "channel" item}} | |
<img src="{{unbound item.image}}">{{item.name}}</img> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
48-49: something is wrong with the names