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

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

View File

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

View File

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

View File

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

View File

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

View File

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