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}}
{{topic-status topic=t}}
diff --git a/app/assets/javascripts/discourse/templates/topic.hbs b/app/assets/javascripts/discourse/templates/topic.hbs
index e74b36dad02..b772d14a09b 100644
--- a/app/assets/javascripts/discourse/templates/topic.hbs
+++ b/app/assets/javascripts/discourse/templates/topic.hbs
@@ -137,13 +137,12 @@
{{{view.suggestedTitle}}}
{{#if model.isPrivateMessage}}
- {{basic-topic-list
- hideCategory="true"
- showPosters="true"
- topics=model.details.suggested_topics
- postsAction="showTopicEntrance"}}
+ {{basic-topic-list hideCategory="true"
+ showPosters="true"
+ topics=model.details.suggested_topics
+ postsAction="showTopicEntrance"}}
{{else}}
- {{basic-topic-list topics=model.details.suggested_topics postsAction="showTopicEntrance"}}
+ {{basic-topic-list topics=model.details.suggested_topics postsAction="showTopicEntrance"}}
{{/if}}
{{{view.browseMoreMessage}}} |