-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9ece41
commit b3e16ea
Showing
22 changed files
with
222 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Launch a Bootstrap modal after the content is loaded via htmx and the request | ||
* has been settled. This solves issues with multiple modals and needing a | ||
* skeleton modal. | ||
* | ||
* For this to work, links should look like this: | ||
* | ||
* <a hx-get="..." | ||
* hx-target="#modal-container" | ||
* hx-swap="beforeend" | ||
* data-modal="true">...</a> | ||
*/ | ||
|
||
import { Modal } from 'bootstrap'; | ||
|
||
document.body.addEventListener('htmx:beforeRequest', (event) => { | ||
if (event.detail.elt.hasAttribute('data-modal')) { | ||
event.detail.requestConfig.modalRequest = true; | ||
} | ||
}); | ||
|
||
document.body.addEventListener('htmx:afterSettle', (event) => { | ||
if (event.detail.requestConfig.modalRequest) { | ||
new Modal(event.detail.target.querySelector('.modal:last-child')).show({ | ||
focus: true, | ||
keyboard: true, | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
sourcecode/hub/resources/views/components/content/action-buttons/share.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<a | ||
href="{{ $url }}" | ||
class="btn btn-secondary btn-sm me-1 content-share-button" | ||
data-share-success-message="{{ trans('messages.share-copied-url-success') }}" | ||
data-share-failure-message="{{ trans('messages.share-copied-url-failed') }}" | ||
role="button" | ||
href="{{ $content->shareUrl }}" | ||
class="btn btn-secondary btn-sm me-1" | ||
target="_blank" | ||
hx-get="{{ $content->shareDialogUrl }}" | ||
hx-target="#modal-container" | ||
hx-swap="beforeend" | ||
data-modal="true" | ||
> | ||
{{ trans('messages.share') }} | ||
</a> |
2 changes: 1 addition & 1 deletion
2
sourcecode/hub/resources/views/components/content/action-buttons/use.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<x-form action="{{ $url }}" method="POST"> | ||
<button class="btn btn-primary btn-sm me-1 content-use-button"> | ||
<button class="btn btn-primary btn-sm me-1 use-button"> | ||
{{ trans('messages.use-content') }} | ||
</button> | ||
</x-form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<div {{ $attributes->except([ | ||
'sm', | ||
'md', | ||
'lg', | ||
'xl', | ||
'xxl', | ||
'fullscreen-sm-down', | ||
'fullscreen-md-down', | ||
'fullscreen-lg-down', | ||
'fullscreen-xl-down', | ||
'fullscreen-xxl-down', | ||
])->class('modal') }}> | ||
<div @class([ | ||
'modal-dialog', | ||
'modal-sm' => $sm ?? false, | ||
'modal-md' => $md ?? false, | ||
'modal-lg' => $lg ?? false, | ||
'modal-xl' => $xl ?? false, | ||
'modal-xxl' => $xxl ?? false, | ||
'modal-fullscreen-sm-down' => $fullscreenSm_down ?? false, | ||
'modal-fullscreen-md-down' => $fullscreenMdDown ?? false, | ||
'modal-fullscreen-lg-down' => $fullscreenLgDown ?? false, | ||
'modal-fullscreen-xl-down' => $fullscreenXlDown ?? false, | ||
'modal-fullscreen-xxl-down' => $fullscreenXxlDown ?? false, | ||
])> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h4 class="modal-title">{{ $title }}</h4> | ||
|
||
<button | ||
type="button" | ||
class="btn-close" | ||
data-bs-dismiss="modal" | ||
aria-label="{{ trans('messages.close') }}" | ||
></button> | ||
</div> | ||
|
||
<div class="modal-body"> | ||
{{ $slot }} | ||
</div> | ||
|
||
@isset($footer) | ||
<div class="modal-footer"> | ||
{{ $footer }} | ||
</div> | ||
@endif | ||
</div> | ||
</div> | ||
</div> |
98 changes: 50 additions & 48 deletions
98
sourcecode/hub/resources/views/content/hx-preview.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,59 @@ | ||
<div class="modal-dialog modal-dialog-centered modal-fullscreen-lg-down modal-lg"> | ||
<div class="modal-content"> | ||
<div class="modal-header border-0"> | ||
<h4 class="modal-title">{{ $version->getTitle() }}</h4> | ||
<button | ||
type="button" | ||
class="btn-close" | ||
data-bs-dismiss="modal" | ||
aria-label="{{trans('messages.close')}}" | ||
></button> | ||
</div> | ||
<div class="modal preview-modal"> | ||
<div class="modal-dialog modal-dialog-centered modal-fullscreen-lg-down modal-lg"> | ||
<div class="modal-content"> | ||
<div class="modal-header border-0"> | ||
<h4 class="modal-title">{{ $version->getTitle() }}</h4> | ||
<button | ||
type="button" | ||
class="btn-close" | ||
data-bs-dismiss="modal" | ||
aria-label="{{trans('messages.close')}}" | ||
></button> | ||
</div> | ||
|
||
<div class="modal-body"> | ||
<x-lti-launch :launch="$launch" class="w-100 border" /> | ||
</div> | ||
<div class="modal-body"> | ||
<x-lti-launch :launch="$launch" class="w-100 border" /> | ||
</div> | ||
|
||
<div class="modal-footer border-0"> | ||
<div class="flex-fill"> | ||
<div> | ||
<strong>{{ trans('messages.edited') }}:</strong> | ||
<time | ||
datetime="{{ $version->created_at->toIso8601String() }}" | ||
data-dh-relative="true" | ||
></time> | ||
<div class="modal-footer border-0"> | ||
<div class="flex-fill"> | ||
<div> | ||
<strong>{{ trans('messages.edited') }}:</strong> | ||
<time | ||
datetime="{{ $version->created_at->toIso8601String() }}" | ||
data-dh-relative="true" | ||
></time> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
@if ($version->published) | ||
<a | ||
href="{{ route('content.share', [$content]) }}" | ||
class="btn btn-secondary d-flex gap-2 share-button" | ||
role="button" | ||
data-share-success-message="{{ trans('messages.share-copied-url-success') }}" | ||
data-share-failure-message="{{ trans('messages.share-copied-url-failed') }}" | ||
target="_blank" | ||
> | ||
<x-icon name="share" /> | ||
{{ trans('messages.share') }} | ||
</a> | ||
@endif | ||
@if ($version->published) | ||
<a | ||
href="{{ route('content.share', [$content]) }}" | ||
class="btn btn-secondary d-flex gap-2" | ||
hx-get="{{ route('content.share-dialog', [$content]) }}" | ||
hx-target="#modal-container" | ||
hx-swap="beforeend" | ||
data-modal="true" | ||
> | ||
<x-icon name="share" /> | ||
{{ trans('messages.share') }} | ||
</a> | ||
@endif | ||
|
||
@can('edit', [$content]) | ||
<a href="{{ route('content.edit', [$content, $version]) }}" class="btn btn-secondary" role="button"> | ||
{{ trans('messages.edit-content') }} | ||
</a> | ||
@endcan | ||
@can('edit', [$content]) | ||
<a href="{{ route('content.edit', [$content, $version]) }}" class="btn btn-secondary" role="button"> | ||
{{ trans('messages.edit-content') }} | ||
</a> | ||
@endcan | ||
|
||
@can('use', [$content, $version]) | ||
<x-form action="{{ $version->getUseUrl() }}" method="POST"> | ||
<button class="btn btn-primary use-button" role="button"> | ||
{{ trans('messages.use-content') }} | ||
</button> | ||
</x-form> | ||
@endcan | ||
@can('use', [$content, $version]) | ||
<x-form action="{{ $version->getUseUrl() }}" method="POST"> | ||
<button class="btn btn-primary use-button" role="button"> | ||
{{ trans('messages.use-content') }} | ||
</button> | ||
</x-form> | ||
@endcan | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.