Created
August 30, 2012 14:12
-
-
Save fbatista/3529349 to your computer and use it in GitHub Desktop.
Partial live updates issue
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
| posts_frag = Meteor.ui.render -> | |
| Meteor.ui.listChunk Posts.find({}, {sort: {created_at: -1}}), | |
| (post)-> | |
| comment_frag = Meteor.ui.listChunk Comments.find({post_id: post._id}, {sort: {created_at: -1}}), | |
| (comment)-> | |
| Template.comment comment | |
| post.comments = new Handlebars.SafeString comment_frag | |
| Template.post post | |
| $('#post_list').append(posts_frag) |
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
| <body> | |
| <div class="container"> | |
| <div class="row"> | |
| <div id="main" class="span8 offset2"> | |
| {{> posts}} | |
| </div> | |
| </div> | |
| </div> | |
| {{> navigation}} | |
| </body> | |
| <template name="posts"> | |
| <section id="post_list"> | |
| </section> | |
| {{#if currentUser}} | |
| {{#if currentUser.admin}} | |
| <section id="create_post"> | |
| {{> create_post}} | |
| </section> | |
| {{/if}} | |
| {{/if}} | |
| </template> | |
| <template name="post"> | |
| <article> | |
| <div class="header_wrap"> | |
| <!-- navigation, header, action buttons, etc. basically stuff i dont want to be updated when new comment gets added --> | |
| </div> | |
| <div class="article_body"> | |
| {{#markdown}}{{body}}{{/markdown}} | |
| </div> | |
| <div class="comments well"> | |
| {{comments}} | |
| </div> | |
| </article> | |
| </template> | |
| <template name="comment"> | |
| <div class="comment"> | |
| {{#markdown}}{{body}}{{/markdown}} | |
| <!-- footer --> | |
| </div> | |
| </template> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment