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:
Isaac Janzen 2022-05-05 11:22:16 -05:00 committed by GitHub
parent 0cef82aec0
commit 679fee9def
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 18 deletions

View File

@ -15,15 +15,6 @@ export default Component.extend({
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
sortListActivity() {
this.sortBy("activity");

View File

@ -263,13 +263,6 @@ export default Controller.extend({
});
},
@action
setSelectedTopic(topicId) {
this.set("selectedTopic", topicId);
window.scrollTo(0, 0);
},
@action
onChangeFilterSolved(solvedFilter) {
this.set("filterSolved", solvedFilter);

View File

@ -117,7 +117,6 @@
ascending=ascending
order=orderColumn
sortBy=(action "sortBy")
selectTopic=(action "setSelectedTopic")
loadMore=(action "loadMore")
loading=isLoadingMore
}}

View File

@ -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>