DEV: update routing to allow for open_in_new_tab (#93)
We can rip out the `click` handler completely and just lean on the _logic_ we have in `docs-index`.
0cef82aec0/assets/javascripts/discourse/routes/docs-index.js (L12)
It will always refresh the `selectedTopic` so there will be no need to update it within the click handler. Which then nullifies the need for `setSelectedTopic`.
This commit is contained in:
parent
0cef82aec0
commit
679fee9def
|
@ -15,15 +15,6 @@ export default Component.extend({
|
||||||
return order === "activity";
|
return order === "activity";
|
||||||
},
|
},
|
||||||
|
|
||||||
// need to handle clicks here since links are in a raw view
|
|
||||||
click(e) {
|
|
||||||
if (e.target.classList.contains("docs-topic-link")) {
|
|
||||||
const topicId = e.target.dataset.topicId;
|
|
||||||
this.selectTopic(topicId);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
sortListActivity() {
|
sortListActivity() {
|
||||||
this.sortBy("activity");
|
this.sortBy("activity");
|
||||||
|
|
|
@ -263,13 +263,6 @@ export default Controller.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@action
|
|
||||||
setSelectedTopic(topicId) {
|
|
||||||
this.set("selectedTopic", topicId);
|
|
||||||
|
|
||||||
window.scrollTo(0, 0);
|
|
||||||
},
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
onChangeFilterSolved(solvedFilter) {
|
onChangeFilterSolved(solvedFilter) {
|
||||||
this.set("filterSolved", solvedFilter);
|
this.set("filterSolved", solvedFilter);
|
||||||
|
|
|
@ -117,7 +117,6 @@
|
||||||
ascending=ascending
|
ascending=ascending
|
||||||
order=orderColumn
|
order=orderColumn
|
||||||
sortBy=(action "sortBy")
|
sortBy=(action "sortBy")
|
||||||
selectTopic=(action "setSelectedTopic")
|
|
||||||
loadMore=(action "loadMore")
|
loadMore=(action "loadMore")
|
||||||
loading=isLoadingMore
|
loading=isLoadingMore
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<a data-topic-id="{{topic.id}}" class="docs-topic-link">{{{topic.fancyTitle}}}</a>
|
<a href="/docs?topic={{topic.id}}" class="docs-topic-link">{{{topic.fancyTitle}}}</a>
|
||||||
|
|
Loading…
Reference in New Issue