Skip to content

Commit

Permalink
Added copy url to clipboard button for events
Browse files Browse the repository at this point in the history
  • Loading branch information
dpoulson committed Nov 21, 2024
1 parent e575e6c commit b00c425
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions resources/views/event/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ function shareToFacebook(_this) {
}
</script>

<script>
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(() => {
// Optional: Add a success message
alert("Link copied to clipboard!");
}).catch(err => {
// Optional: Handle error
console.error("Failed to copy: ", err);
});
}
</script>


<script type="application/javascript" async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js"></script>
<script>
window.fbAsyncInit = function() {
Expand Down Expand Up @@ -171,6 +185,7 @@ function shareToFacebook(_this) {
<a class="btn btn-edit" style="width:auto;" href="{{ route('admin.events.edit',$event->id) }}">{{ __('Edit') }}</a>
<a class="btn btn-edit" style="width:auto;" href="{{ route('admin.events.addimage',[ 'event_id' => $event->id]) }}">{{ __('Add Image') }}</a>
<span id="export" class="btn btn-info" onclick="shareToFacebook(event.target);">Share to Facebook</span>
<button class="btn btn-info" onclick="copyToClipboard('{{ url()->current() }}')">Copy Link</button>
<button type="button" class="btn btn-primary m-2" data-toggle="modal" data-target="#addContactModal">{{ __('Add Contact') }}</button>

@endcan
Expand Down

0 comments on commit b00c425

Please sign in to comment.