diff --git a/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 b/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 index 2e0907449e4..02956c61ed1 100644 --- a/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 +++ b/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 @@ -15,22 +15,45 @@ export default Ember.Component.extend({ this._initFromTopicList(this.get('topicList')); }.observes('topicList.@each'), - _initFromTopicList: function(topicList) { + _initFromTopicList(topicList) { if (topicList !== null) { this.set('topics', topicList.get('topics')); this.rerender(); } }, - init: function() { + init() { this._super(); - var topicList = this.get('topicList'); + const topicList = this.get('topicList'); if (topicList) { this._initFromTopicList(topicList); } else { // Without a topic list, we assume it's loaded always. this.set('loaded', true); } + }, + + click(e) { + // Mobile basic-topic-list doesn't use the `topic-list-item` view so + // the event for the topic entrance is never wired up. + if (!this.site.mobileView) { return; } + + let target = $(e.target); + + if (target.hasClass('posts-map')) { + const topicId = target.closest('tr').attr('data-topic-id'); + if (topicId) { + if (target.prop('tagName') !== 'A') { + target = target.find('a'); + } + + const topic = this.get('topics').findProperty('id', parseInt(topicId)); + this.sendAction('postsAction', {topic, position: target.offset()}); + // this.container.lookup('controller:application').send("showTopicEntrance", {topic, position: target.offset()}); + } + return false; + } + } }); diff --git a/app/assets/javascripts/discourse/components/topic-list.js.es6 b/app/assets/javascripts/discourse/components/topic-list.js.es6 index 03a6a4a0a73..cf0f7eb34f3 100644 --- a/app/assets/javascripts/discourse/components/topic-list.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-list.js.es6 @@ -30,7 +30,7 @@ export default Ember.Component.extend({ return this.get('order') === "op_likes"; }.property('order'), - click: function(e){ + click(e) { var self = this; var on = function(sel, callback){ var target = $(e.target).closest(sel); diff --git a/app/assets/javascripts/discourse/templates/components/basic-topic-list.hbs b/app/assets/javascripts/discourse/templates/components/basic-topic-list.hbs index d6d327375ff..895708915d1 100644 --- a/app/assets/javascripts/discourse/templates/components/basic-topic-list.hbs +++ b/app/assets/javascripts/discourse/templates/components/basic-topic-list.hbs @@ -1,15 +1,13 @@ {{#conditional-loading-spinner condition=loading}} {{#if topics}} - {{topic-list - showParticipants=showParticipants - showPosters=showPosters - hideCategory=hideCategory - topics=topics - expandExcerpts=expandExcerpts - bulkSelectEnabled=bulkSelectEnabled - canBulkSelect=canBulkSelect - selected=selected - }} + {{topic-list showParticipants=showParticipants + showPosters=showPosters + hideCategory=hideCategory + topics=topics + expandExcerpts=expandExcerpts + bulkSelectEnabled=bulkSelectEnabled + canBulkSelect=canBulkSelect + selected=selected}} {{else}} {{#unless loadingMore}}
diff --git a/app/assets/javascripts/discourse/templates/components/topic-list.hbs b/app/assets/javascripts/discourse/templates/components/topic-list.hbs index 410d531de70..6f9aa643708 100644 --- a/app/assets/javascripts/discourse/templates/components/topic-list.hbs +++ b/app/assets/javascripts/discourse/templates/components/topic-list.hbs @@ -1,19 +1,18 @@ {{#unless skipHeader}} - - {{raw "topic-list-header" - currentUser=currentUser - canBulkSelect=canBulkSelect - toggleInTitle=toggleInTitle - hideCategory=hideCategory - showPosters=showPosters - showLikes=showLikes - showOpLikes=showOpLikes - showParticipants=showParticipants - order=order - ascending=ascending - sortable=sortable - bulkSelectEnabled=bulkSelectEnabled}} - + + {{raw "topic-list-header" currentUser=currentUser + canBulkSelect=canBulkSelect + toggleInTitle=toggleInTitle + hideCategory=hideCategory + showPosters=showPosters + showLikes=showLikes + showOpLikes=showOpLikes + showParticipants=showParticipants + order=order + ascending=ascending + sortable=sortable + bulkSelectEnabled=bulkSelectEnabled}} + {{/unless}} {{each topic in topics itemView="topic-list-item"}} diff --git a/app/assets/javascripts/discourse/templates/list/topic-list-item.raw.hbs b/app/assets/javascripts/discourse/templates/list/topic-list-item.raw.hbs index 26c958c4ec9..ed2eb44fbbd 100644 --- a/app/assets/javascripts/discourse/templates/list/topic-list-item.raw.hbs +++ b/app/assets/javascripts/discourse/templates/list/topic-list-item.raw.hbs @@ -1,7 +1,7 @@ {{#if controller.bulkSelectEnabled}} - - - + + + {{/if}} @@ -36,18 +36,18 @@ {{#if controller.showLikes}} {{#if hasLikes}} - - {{number topic.like_count}} - + + {{number topic.like_count}} + {{/if}} {{/if}} {{#if controller.showOpLikes}} {{#if hasOpLikes}} - - {{number topic.op_like_count}} - + + {{number topic.op_like_count}} + {{/if}} {{/if}} diff --git a/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs b/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs index 92a502662e2..20c52094ae5 100644 --- a/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs +++ b/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs @@ -3,7 +3,7 @@ {{#each t in topics}} - +