Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Nov 20, 2024
1 parent e17e64a commit 5d5f5dc
Show file tree
Hide file tree
Showing 20 changed files with 44 additions and 19 deletions.
1 change: 1 addition & 0 deletions public/build/assets/app-1a7ada06.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/build/assets/app-7a55a469.js

This file was deleted.

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/build/assets/chart-30d13dca.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/chart-73bb5282.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/build/assets/dropdown-30d13dca.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/dropdown-73bb5282.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/build/assets/editor-30d13dca.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/editor-73bb5282.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/build/assets/media-manager-30d13dca.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/media-manager-73bb5282.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/build/assets/repeater-30d13dca.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/repeater-73bb5282.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/build/assets/table-30d13dca.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/table-73bb5282.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions public/build/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,60 +7,60 @@
"css": [
"assets/app-99097d46.css"
],
"file": "assets/app-81727b20.js",
"file": "assets/app-ab6ed77c.js",
"isEntry": true,
"src": "resources/js/app.js"
},
"resources/js/chart.js": {
"file": "assets/chart-30d13dca.js",
"file": "assets/chart-73bb5282.js",
"imports": [
"resources/js/app.js"
],
"isEntry": true,
"src": "resources/js/chart.js"
},
"resources/js/dropdown.js": {
"file": "assets/dropdown-30d13dca.js",
"file": "assets/dropdown-73bb5282.js",
"imports": [
"resources/js/app.js"
],
"isEntry": true,
"src": "resources/js/dropdown.js"
},
"resources/js/editor.js": {
"file": "assets/editor-30d13dca.js",
"file": "assets/editor-73bb5282.js",
"imports": [
"resources/js/app.js"
],
"isEntry": true,
"src": "resources/js/editor.js"
},
"resources/js/media-manager.js": {
"file": "assets/media-manager-30d13dca.js",
"file": "assets/media-manager-73bb5282.js",
"imports": [
"resources/js/app.js"
],
"isEntry": true,
"src": "resources/js/media-manager.js"
},
"resources/js/repeater.js": {
"file": "assets/repeater-30d13dca.js",
"file": "assets/repeater-73bb5282.js",
"imports": [
"resources/js/app.js"
],
"isEntry": true,
"src": "resources/js/repeater.js"
},
"resources/js/table.js": {
"file": "assets/table-30d13dca.js",
"file": "assets/table-73bb5282.js",
"imports": [
"resources/js/app.js"
],
"isEntry": true,
"src": "resources/js/table.js"
},
"resources/sass/app.scss": {
"file": "assets/app-7a55a469.js",
"file": "assets/app-1a7ada06.js",
"imports": [
"resources/js/app.js"
],
Expand Down
6 changes: 6 additions & 0 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ window.$http = Axios.create({

// Cookie
window.$cookie = new Cookie('__root_');

document.addEventListener('relation-frame-loaded', (event) => {
if (window.location.href !== event.detail.url) {
window.history.replaceState(window.history.state, document.title, event.detail.url);
}
});
3 changes: 3 additions & 0 deletions resources/views/resources/relation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
</div>

{{-- Script --}}
<script>
document.dispatchEvent(new CustomEvent('relation-frame-loaded', { detail: { url: '{!! $parentUrl !!}' } }));
</script>
@pushOnce('scripts')
{{
Vite::withEntryPoints('resources/js/table.js')
Expand Down
4 changes: 2 additions & 2 deletions resources/views/table/pagination.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@if ($paginator->hasPages())
@if($paginator->hasPages())
<nav class="pagination" aria-label="">
<ul class="pagination__links">
@if(! $paginator->onFirstPage())
Expand All @@ -18,7 +18,7 @@
@elseif(is_array($element))
@foreach ($element as $page => $url)
<li>
@if ($page === $paginator->currentPage())
@if($page === $paginator->currentPage())
<span class="btn btn--sm btn--outline-primary" aria-disabled="true" aria-current="page">
{{ $page }}
</span>
Expand Down
18 changes: 17 additions & 1 deletion src/Fields/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\MessageBag;
use Illuminate\Support\Str;
use Throwable;
Expand Down Expand Up @@ -880,6 +881,20 @@ public function registerRouteConstraints(Request $request, Router $router): void
});
}

/**
* Parse the given query string.
*/
protected function parseQueryString(string $url): array
{
$query = parse_url($url, PHP_URL_QUERY);

parse_str($query, $result);

return array_filter($result, function (string $key): bool {
return str_starts_with($key, $this->getRequestKey());
}, ARRAY_FILTER_USE_KEY);
}

/**
* Get the option representation of the model and the related model.
*/
Expand Down Expand Up @@ -948,7 +963,8 @@ public function toIndex(Request $request, Model $model): array
})
->all(),
'activeFilters' => $this->resolveFilters($request)->active($request)->count(),
'url' => $this->modelUrl($model),
'url' => URL::query($this->modelUrl($model), $this->parseQueryString($request->server('HTTP_REFERER', $request->url()))),
'parentUrl' => URL::query($request->server('HTTP_REFERER'), $request->query()),
]);
}

Expand Down

0 comments on commit 5d5f5dc

Please sign in to comment.