1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 $.rails.href = function(element) {
7 // data-remote=true links must put their remote targets in
8 // data-remote-href="..." instead of href="...". This helps
9 // us avoid accidentally using the same href="..." in both the
10 // remote (Rails UJS) and non-remote (native browser) handlers
11 // -- which differ greatly in how they use that value -- and
12 // forgetting to test any non-remote cases like "open in new
13 // tab". If you really want copy-link-address/open-in-new-tab
14 // to work on a data-remote=true link, supply the
15 // copy-and-pastable URI in href in addition to the AJAX URI
16 // in data-remote-href.
18 // (Currently, the only places we make any remote links are
19 // link_to() in ApplicationHelper, which renames href="..." to
20 // data-remote-href="...", and select_modal, which builds a
21 // data-remote=true link on the client side.)
22 return element.data('remote-href');
24 // Normal rails-ujs behavior.
25 return element.attr('href');