Skip to content

Commit

Permalink
Merge pull request #6 from benstr/this-rabbit-is-so-rubbery
Browse files Browse the repository at this point in the history
This rabbit is so rubbery!
  • Loading branch information
queso committed Oct 1, 2015
2 parents da69653 + 12413d3 commit b9c474d
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 64 deletions.
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ markdown
percolate:synced-cron
xolvio:cucumber
ongoworks:speakingurl
reactive-var
10 changes: 5 additions & 5 deletions client/layout/footer.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template name="footer">
<div class="container-fluid">
<div class="center-block">
<p>&copy; Crater Podcast 2015. Brought to you by <a href="http://meteorjs.club" target="_blank">Meteor Club</a>.</p>
</div>
</div>
<div class="container-fluid">
<div class="center-block">
<p>&copy; Crater Podcast 2015. Brought to you by the awesome users of <a href="https://crater.io" target="_blank">Crater.io</a>.</p>
</div>
</div>
</template>
42 changes: 0 additions & 42 deletions client/views/home.coffee

This file was deleted.

8 changes: 4 additions & 4 deletions client/views/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ <h3 class="section-header">Recent Episodes</h3>

<div class="center-block load-more">
<!-- TODO: this button -->
<a href="#" class="btn btn-primary">Load More Episodes</a>
<a href="#" class="btn btn-primary" data-action="load-more">Load More Episodes</a>
</div>
</div>

<div class="col-xs-12 col-sm-12 col-md-4 sidebar">
<h3 class="section-header">About the Podcast</h3>
<p>Crater Podcast is a weekly news podcast about all latest javascript news posted on <a href="https://crater.io" target="_blank">Crater</a>. Join hosts Josh Owens and Ben Strahan they discuss the latest javascript topics each week. <a href="http://meteorjs.club">Click here</a> to learn more about and to join Meteor Club.</p>
<p>Crater Podcast is a weekly news podcast about all latest javascript news posted on <a href="https://crater.io" target="_blank">Crater</a>. Join hosts Josh Owens and Ben Strahan as they discuss the most interesting Crater.io posts of the week.</p>

<div class="row">
<div class="col-xs-12 col-sm-6 col-md-12 col-lg-12 host">
<div class="row">
<div class="col-xs-3 col-sm-4 col-md-4 col-lg-4">
<img src="/images/josh.png" alt="">
<img src="/images/real-josh.png" alt="">
</div>
<div class="col-xs-9 col-sm-8 col-md-8 col-lg-8">
<span class="name">Josh Owens</span>
Expand All @@ -76,7 +76,7 @@ <h3 class="section-header">About the Podcast</h3>
<div class="col-xs-9 col-sm-8 col-md-8 col-lg-8">
<span class="name">Ben Strahan</span>
<p>
<a href="http://github.com/queso" target="_blank"><i class="fa fa-github"></i>&nbsp; Find Ben on Github</a><br>
<a href="http://github.com/benstr" target="_blank"><i class="fa fa-github"></i>&nbsp; Find Ben on Github</a><br>
<a href="https://twitter.com/_benstr" target="_blank"><i class="fa fa-twitter"></i>&nbsp; Follow on Twitter</a>
</p>
</div>
Expand Down
67 changes: 67 additions & 0 deletions client/views/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
var episodesLoaded = 5;

Template.home.onCreated( function () {
var self = this;
self.limit = new ReactiveVar(episodesLoaded);
self.autorun(function () {
var limit = self.limit.get();
self.subscribe('episodes', limit);
});
});

Template.home.helpers({
featured: function () {
return Episodes.findOne(Session.get('spotlightID'));
},
episodes: function () {
return Episodes.find();
},

});

Template.home.onRendered(function() {
Session.set("spotlightID", Episodes.findOne({}, {
sort: {
date: -1
}
})._id);
Session.set("dragging", false);
$(".podcast-play").affix({
offset: {
top: function() {
return $('.holder').offset().top;
}
}
});
return Tracker.autorun(function() {
Session.get('spotlightID');
return Tracker.afterFlush(function() {
var audio, currentSpeedIdx, speed, speeds;
speeds = [1, 1.5, 2, 2.5, 3];
speed = $('.pcast-speed')[0];
currentSpeedIdx = 0;
audio = $('#audio-player')[0];
return speed.addEventListener('click', (function() {
currentSpeedIdx = currentSpeedIdx + 1 < speeds.length ? currentSpeedIdx + 1 : 0;
audio.playbackRate = speeds[currentSpeedIdx];
this.textContent = speeds[currentSpeedIdx] + 'x';
return true;
}), false);
});
});
});

Template.home.events({
"touchmove body": function(e) {
return Session.set("dragging", true);
},
"touchstart body": function(e) {
return Session.set("dragging", false);
},
"click [data-action=load-more]": function(e, t) {
e.preventDefault();
var limit = t.limit.get();
limit += episodesLoaded;
t.limit.set(limit);
}
});
12 changes: 1 addition & 11 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,7 @@ Router.configure({

Router.map(function() {
this.route('home', {
path: '/',
waitOn: function() {
return Meteor.subscribe('episodes');
},
data: function() {
return {
// TODO: Add skip support for pagination
episodes: Episodes.find({}, {limit: 5, sort: {date: -1}})
};

}
path: '/'
});
this.route('single', {
path: '/:slug',
Expand Down
Binary file modified public/images/benstr.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/real-josh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions server/publications.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Meteor.publish('episodes', function() {
return Episodes.find({}, {sort: {date: -1}});
Meteor.publish('episodes', function(limit) {
check(limit, Match.Integer);
return Episodes.find({}, {sort: {date: -1}, limit: limit});
});

Meteor.publish('episode', function(slug) {
Expand Down
8 changes: 8 additions & 0 deletions server/redirects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Redirect old MeteorPodcast urls
_.each(Episodes.find().fetch(), function (episode) {
var slug = "/e/" + episode.slug;
WebApp.connectHandlers.use(slug, function (req, res, next) {
res.writeHead(301, {'Location': process.env.ROOT_URL + "/podcast/" + episode.slug});
res.end();
});
});

0 comments on commit b9c474d

Please sign in to comment.