FIX: Add topic entrance to mobile categories page when clicking count
This commit is contained in:
parent
cc976e3046
commit
8e87a727ef
|
@ -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
|
||||
});
|
|
@ -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');
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<td class='main-link'>
|
||||
<div class='topic-inset'>
|
||||
{{topic-status topic=topic}}
|
||||
{{topic-link topic}}
|
||||
{{#if topic.unseen}}
|
||||
<span class="badge-notification new-topic"></span>
|
||||
{{/if}}
|
||||
<span class="{{cold-age-class topic.last_posted_at}}" title='{{raw-date topic.last_posted_at}}'>{{{format-age topic.last_posted_at}}}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class='num posts'>{{raw "list/post-count-or-badges" topic=topic postBadgesEnabled="true"}}</td>
|
|
@ -16,21 +16,9 @@
|
|||
{{/if}}
|
||||
|
||||
{{#each c.topics as |t|}}
|
||||
<tr class="{{if t.archived 'archived'}} category-topic-link">
|
||||
<td class='main-link'>
|
||||
<div class='topic-inset'>
|
||||
{{topic-status topic=t}}
|
||||
{{topic-link t}}
|
||||
{{#if t.unseen}}
|
||||
<span class="badge-notification new-topic"></span>
|
||||
{{/if}}
|
||||
<span class="{{cold-age-class t.last_posted_at}}" title='{{raw-date t.last_posted_at}}'>{{{format-age t.last_posted_at}}}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class='num posts'>{{raw "list/post-count-or-badges" topic=t postBadgesEnabled="true"}}</td>
|
||||
</tr>
|
||||
|
||||
{{mobile-category-topic topic=t}}
|
||||
{{/each}}
|
||||
|
||||
{{#if c.subcategories}}
|
||||
<tr class="subcategories-list">
|
||||
<td>
|
||||
|
|
Loading…
Reference in New Issue