Arrows to navigate to embedded posts.

This commit is contained in:
Robin Ward 2013-02-15 15:17:57 -05:00
parent 674c861eaf
commit fc1c120014
6 changed files with 18 additions and 3 deletions

View File

@ -164,8 +164,10 @@ window.Discourse.Post = Ember.Object.extend Discourse.Presence,
@set('loadingReplies', true)
@set('replies', [])
jQuery.getJSON "/posts/#{@get('id')}/replies", (loaded) =>
loaded.each (reply) =>
@get('replies').pushObject Discourse.Post.create(reply)
loaded.each (reply) =>
post = Discourse.Post.create(reply)
post.set('topic', @get('topic'))
@get('replies').pushObject post
@set('loadingReplies', false)
promise.resolve()
promise

View File

@ -11,7 +11,9 @@
</div>
<div class='span11 topic-body'>
{{#if view.previousPost}}<a href='{{unbound url}}' class="arrow"><i class='icon icon-arrow-up'></i></a>{{/if}}
{{{unbound cooked}}}
{{#unless view.previousPost}}<a href='{{unbound url}}' class="arrow"><i class='icon icon-arrow-down'></i></a>{{/unless}}
</div>
</div>
{{/with}}

View File

@ -1,7 +1,6 @@
window.Discourse.EmbeddedPostView = Ember.View.extend
templateName: 'embedded_post'
classNames: ['reply']
screenTrackBinding: 'postView.screenTrack'
didInsertElement: ->
postView = @get('postView') || @get('parentView.postView')

View File

@ -1,5 +1,7 @@
window.Discourse.ParentView = Discourse.EmbeddedPostView.extend
previousPost: true
# Nice animation for when the replies appear
didInsertElement: ->
@_super()

View File

@ -100,6 +100,10 @@ window.Discourse.PostView = Ember.View.extend
$('nav', $parent).addClass('toggled')
Discourse.Post.loadByPostNumber post.get('topic_id'), post.get('reply_to_post_number'), (result) =>
@set('loadingParent', false)
# Give the post a reference back to the topic
result.topic = @get('post.topic')
@set('parentPost', result)
false

View File

@ -427,6 +427,12 @@
&:after {
left: -9px;
}
a.arrow {
float: right;
margin: 3px 0 3px 0;
}
}
.about {
.contents {