diff --git a/app/assets/javascripts/discourse/components/mobile-category-topic.js.es6 b/app/assets/javascripts/discourse/components/mobile-category-topic.js.es6 new file mode 100644 index 00000000000..833c4a1dfb5 --- /dev/null +++ b/app/assets/javascripts/discourse/components/mobile-category-topic.js.es6 @@ -0,0 +1,7 @@ +import { showEntrance } from 'discourse/components/topic-list-item'; + +export default Ember.Component.extend({ + tagName: 'tr', + classNameBindings: [':category-topic-link', 'topic.archived'], + click: showEntrance +}); diff --git a/app/assets/javascripts/discourse/components/topic-list-item.js.es6 b/app/assets/javascripts/discourse/components/topic-list-item.js.es6 index 2f5026e1080..28c00c4345b 100644 --- a/app/assets/javascripts/discourse/components/topic-list-item.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-list-item.js.es6 @@ -1,5 +1,20 @@ import StringBuffer from 'discourse/mixins/string-buffer'; +export function showEntrance(e) { + let target = $(e.target); + + if (target.hasClass('posts-map') || target.parents('.posts-map').length > 0) { + if (target.prop('tagName') !== 'A') { + target = target.find('a'); + if (target.length===0) { + target = target.end(); + } + } + this.container.lookup('controller:application').send("showTopicEntrance", {topic: this.get('topic'), position: target.offset()}); + return false; + } +} + export default Ember.Component.extend(StringBuffer, { rerenderTriggers: ['bulkSelectEnabled', 'topic.pinned'], tagName: 'tr', @@ -77,19 +92,10 @@ export default Ember.Component.extend(StringBuffer, { }.property(), click(e) { - let target = $(e.target); - - if (target.hasClass('posts-map') || target.parents('.posts-map').length > 0) { - if (target.prop('tagName') !== 'A') { - target = target.find('a'); - if (target.length===0) { - target = target.end(); - } - } - this.container.lookup('controller:application').send("showTopicEntrance", {topic: this.get('topic'), position: target.offset()}); - return false; - } + const result = showEntrance.call(this, e); + if (result === false) { return result; } + const target = $(e.target); if (target.hasClass('bulk-select')) { const selected = this.get('selected'); const topic = this.get('topic'); diff --git a/app/assets/javascripts/discourse/templates/components/mobile-category-topic.hbs b/app/assets/javascripts/discourse/templates/components/mobile-category-topic.hbs new file mode 100644 index 00000000000..c3827841dc1 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/components/mobile-category-topic.hbs @@ -0,0 +1,11 @@ +