mode / alamode

A community-maintained library of visualizations for Mode reports
MIT License
70 stars 67 forks source link

Support opening table link in new tab #37

Closed sprine closed 5 years ago

sprine commented 5 years ago

Adds an open_in_new_tab parameter to enable table links to be opened in a new tab. Example use:

# query_name: q1
select 'g' id, 'https://google.com' url
union 
select 's' id, 'https://shopify.com' url
<script>
  alamode.addLinksToTables({
    table_id: "table_12345",
    query_name: "q1",
    link_columns: ["url"],
    link_urls: ["{{url}}"],
    open_in_new_tab: true
  });
</script>

Fixes https://github.com/mode/alamode/issues/13.

I've minified the JS using uglifyjs -o alamode.min.js --compress --mangle -- alamode.js as suggested by @leqilong some time ago.

Aside: docs on https://mode.com/example-gallery/table-links should also be updated.

@bstancil @pmmenzel

leqilong commented 5 years ago

Hi @sprine! Thanks - I've deployed your changes.