Created
October 21, 2015 12:23
-
-
Save PhillippOhlandt/6fc02ddad40e18ca48e3 to your computer and use it in GitHub Desktop.
For my Bolt.cm + Pusher tutorial
This file contains hidden or 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
{{ 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