Skip to content

Commit

Permalink
Merge pull request #4436 from magfest/add-link-attractions
Browse files Browse the repository at this point in the history
Add ability to copy link to attraction features
  • Loading branch information
kitsuta authored Dec 4, 2024
2 parents fd11968 + a718b7d commit 8236bb6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
13 changes: 12 additions & 1 deletion uber/templates/attractions_admin/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,13 @@
$('a[href="' + anchor + '"]').tab('show');
});
});
var copyLink = function(e, href) {
navigator.clipboard.writeText(href);
console.log($(e.target));
setTimeout(function () {
$(e.target).tooltip('hide');
}, 1000);
}
</script>

{%- set can_admin_attraction = admin_account.attendee.can_admin_attraction(attraction) -%}
Expand Down Expand Up @@ -790,10 +797,14 @@ <h3 class="feature-title">
<a class="btn btn-sm btn-primary"
title="Schedule a new {{ feature.name }} event"
href="event?feature_id={{ feature.id }}">
<i class="fa fa-time"></i>
<i class="fa fa-clock-o"></i>&nbsp;
Schedule Event
</a>
{%- endif %}
<button type="button" class="btn btn-sm btn-outline-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="Copied!"
data-bs-trigger="click" onClick="copyLink(event, '{{ c.URL_BASE }}/attractions/{{ attraction.slug }}?feature={{ feature.slug }}')">
Copy Link
</button>
</h3>
</div>
<div class="feature-body">
Expand Down
9 changes: 8 additions & 1 deletion uber/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@

<script type="text/javascript">
$(window).on("runJavaScript", function () {
$('[data-bs-toggle="tooltip"]').tooltip();
{% if bootstrap5 %}
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
{% else %}
$('[data-bs-toggle="tooltip"]').tooltip();
{% endif %}
})

{% if not c.DEV_BOX %}jQuery.migrateMute = true;{% endif %}
Expand Down

0 comments on commit 8236bb6

Please sign in to comment.