mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 19:06:20 +08:00
ES6: Refactor embedded post views
This commit is contained in:
parent
61fb0f736b
commit
d919a405cb
|
@ -1,7 +1,7 @@
|
|||
{{post-gap post=this postStream=controller.postStream before="true"}}
|
||||
|
||||
<div class='row'>
|
||||
{{view Discourse.ReplyHistory contentBinding="replyHistory"}}
|
||||
{{view 'reply-history' content=replyHistory}}
|
||||
</div>
|
||||
|
||||
<article class='boxed' {{bind-attr id="postElementId"}} {{bind-attr data-post-id="id"}} data-user-id="{{unbound user_id}}">
|
||||
|
@ -71,9 +71,9 @@
|
|||
<button {{action expandFirstPost this}} class='btn expand-post'>{{i18n post.show_full}}</button>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{view 'post-menu' post=this postView=view}}
|
||||
{{view 'post-menu' post=this adminMenu=view.adminMenu}}
|
||||
</div>
|
||||
{{view Discourse.RepliesView content=replies postView=view}}
|
||||
{{view 'replies' content=replies}}
|
||||
{{discourse-action-history post=this}}
|
||||
{{view 'topic-map-container' post=this topic=controller.model}}
|
||||
</div>
|
||||
|
|
|
@ -6,19 +6,17 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.EmbeddedPostView = Discourse.GroupedView.extend({
|
||||
export default Discourse.GroupedView.extend({
|
||||
templateName: 'embedded_post',
|
||||
classNames: ['reply'],
|
||||
|
||||
didInsertElement: function() {
|
||||
_startTracking: function() {
|
||||
var post = this.get('content');
|
||||
Discourse.ScreenTrack.current().track(this.get('elementId'), post.get('post_number'));
|
||||
},
|
||||
}.on('didInsertElement'),
|
||||
|
||||
willDestroyElement: function() {
|
||||
_stopTracking: function() {
|
||||
Discourse.ScreenTrack.current().stopTracking(this.get('elementId'));
|
||||
}
|
||||
}.on('willDestroyElement')
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ export default Discourse.View.extend({
|
|||
var options = {className: 'create'};
|
||||
|
||||
if(!Discourse.Mobile.mobileView) {
|
||||
options.textLabel = 'topic.reply.title'
|
||||
options.textLabel = 'topic.reply.title';
|
||||
}
|
||||
|
||||
return new Button('reply', 'post.controls.reply', 'reply', options);
|
||||
|
@ -273,7 +273,7 @@ export default Discourse.View.extend({
|
|||
|
||||
clickAdmin: function() {
|
||||
var $adminMenu = this.$('.post-admin-menu');
|
||||
this.set('postView.adminMenu', $adminMenu);
|
||||
this.set('adminMenu', $adminMenu);
|
||||
$adminMenu.show();
|
||||
},
|
||||
|
||||
|
|
|
@ -6,11 +6,9 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.RepliesView = Ember.CollectionView.extend({
|
||||
export default Ember.CollectionView.extend({
|
||||
tagName: 'section',
|
||||
classNameBindings: [':embedded-posts', ':bottom', 'hidden'],
|
||||
itemViewClass: Discourse.EmbeddedPostView,
|
||||
itemViewClass: 'embedded-post',
|
||||
hidden: Em.computed.equal('content.length', 0)
|
||||
});
|
||||
|
||||
|
|
@ -2,14 +2,13 @@
|
|||
Lists previous posts in the history of a post.
|
||||
|
||||
@class ReplyHistory
|
||||
@extends Discourse.EmbeddedPostView
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.ReplyHistory = Em.CollectionView.extend({
|
||||
export default Em.CollectionView.extend({
|
||||
tagName: 'section',
|
||||
classNameBindings: [':embedded-posts', ':top', ':topic-body', ':offset2', 'hidden'],
|
||||
itemViewClass: Discourse.EmbeddedPostView,
|
||||
itemViewClass: 'embedded-post',
|
||||
hidden: Em.computed.equal('content.length', 0),
|
||||
previousPost: true
|
||||
});
|
Loading…
Reference in New Issue
Block a user