wikipathways / wikipathways.github.io

GitHub pages for GPML-Repo
https://www.wikipathways.org/
5 stars 18 forks source link

Feature suggestion: When clicking on pathways from Table and Filters , open the pathway in a new tab by default #120

Closed khanspers closed 1 month ago

khanspers commented 2 months ago

Clicking on a pathway from the Filters or Table pages opens the pathway in the same tab. Using the browser navigation to go back, the previous selection (at least for Filters) is lost. It would be great if the pathways opened in a new tab by default, for Filters and Table. Search results already work that way.

AlexanderPico commented 2 months ago

In the javascript section at the end of https://github.com/wikipathways/wikipathways.github.io/blob/main/_browse/filters.md, there's a function to add cards. I think you'd want to add target="_blank" to the hrefs for gallery and list views.

Similarly for table.md, you'd find the href that produces the pathway links and add the target parameter.

khanspers commented 1 month ago

Looking at this again, custom Table selections are actually retained while navigating to a pathway and back. Same for Filters. I'm not sure if something changed in the code that affects this, or if it has to do with specific combinations of selections (still testing). But either way, the pathway links opening in the same tab is not as big of an issue as originally thought. I will close this and we can see if others also complain before making a change.

For reference, the changes needed to open pathways in a new tab from Table and Filters are:

table.md line 53 <a href="{{ pw.url }}" target="_blank">{{ pw.title }}</a> (this works but I'm not sure its the most proper way to do this)

filters.md lines 429-434

'<div class="card" style="width: 10rem;">' +
      '<a class="card-link" href="'+c["url"]+'"'+'target="_blank"'+'>' +
        '<img class="card-img-top" src="/assets/img/'+c["wpid"]+'/'+c["wpid"]+'-thumb.png" alt="'+c["title"]+'>' +
        '<div class="card-body">' +
          '<p class="card-text">'+c["title"]+' <em>('+c["org"]+')</em></p>' +
  '</div></a></div></div>';