Skip to content

Instantly share code, notes, and snippets.

@PhillippOhlandt
Created October 21, 2015 12:23
Show Gist options
  • Save PhillippOhlandt/6fc02ddad40e18ca48e3 to your computer and use it in GitHub Desktop.
Save PhillippOhlandt/6fc02ddad40e18ca48e3 to your computer and use it in GitHub Desktop.
For my Bolt.cm + Pusher tutorial
{{ enablePusher() }}
<script>
(function() {
var records = pusher.subscribe('records');
records.bind('created', function(data) {
if(data.contenttype == 'entries'){
$('.entries').prepend(
'<div class="post-preview">' +
'<a href="/' + data.record.contenttype.singular_slug + '/' + data.record.values.slug + '">' +
'<h2 class="post-title">' +
data.record.values.title +
'</h2>' +
'<h3 class="post-subtitle">' +
data.record.values.body +
'</h3>' +
'</a>' +
'</div>' +
'<hr>'
);
}
});
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment