Skip to content

Commit

Permalink
v0.2.2.1-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
FlamesONE committed Jun 25, 2024
1 parent 7002df8 commit 7cae910
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 19 deletions.
7 changes: 5 additions & 2 deletions app/Core/Admin/Http/Views/assets/js/pages/footer/list.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
$(function () {
const createSortableInstances = () => {
const nestedSortables = document.querySelectorAll('.footer-nested-sortable');
const nestedSortables = document.querySelectorAll(
'.footer-nested-sortable',
);
return Array.from(nestedSortables).map(
(nestedSortable) =>
new Sortable(nestedSortable, {
Expand All @@ -27,7 +29,8 @@ $(function () {
document
.querySelector('.chrome-tabs')
.addEventListener('contentRender', () => {
sortablesFooter = createSortableInstances();
if ($('#saveFooter').length)
sortablesFooter = createSortableInstances();
});

$(document).on('click', '#saveFooter', () => {
Expand Down
7 changes: 5 additions & 2 deletions app/Core/Admin/Http/Views/assets/js/pages/navigation/list.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
$(function () {
const createNavSortableInstances = () => {
const nestedSortables = document.querySelectorAll('.nav-nested-sortable');
const nestedSortables = document.querySelectorAll(
'.nav-nested-sortable',
);
return Array.from(nestedSortables).map(
(nestedSortable) =>
new Sortable(nestedSortable, {
Expand All @@ -27,7 +29,8 @@ $(function () {
document
.querySelector('.chrome-tabs')
.addEventListener('contentRender', () => {
sortablesNav = createNavSortableInstances();
if ($('#saveNavigation').length)
sortablesNav = createNavSortableInstances();
});

$(document).on('click', '#saveNavigation', () => {
Expand Down
10 changes: 6 additions & 4 deletions app/Core/Admin/Http/Views/assets/js/pages/roles/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ $(function () {

let sortableRoles = createRolesSortable();

document.querySelector('.chrome-tabs').addEventListener('contentRender', () => {
sortableRoles = createRolesSortable();
});
document
.querySelector('.chrome-tabs')
.addEventListener('contentRender', () => {
if ($('#roles').length) sortableRoles = createRolesSortable();
});

$(document).on('click', '#saveRoles', (e) => {
let orderedIds = sortableRoles.toArray();
Expand Down Expand Up @@ -60,6 +62,6 @@ $(function () {
$(document).on('click', '.roles-group .delete', async function () {
let roleId = $(this).data('deleterole');
if (await asyncConfirm(translate('admin.roles.confirm_delete')))
sendRequest({},u('admin/api/roles/' + roleId), 'DELETE');
sendRequest({}, u('admin/api/roles/' + roleId), 'DELETE');
});
});
2 changes: 1 addition & 1 deletion app/Core/Admin/Http/Views/pages/main/items/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class="form-control" value="{{ config('app.timezone') }}">
<small class="form-text text-muted">@t('admin.app.maintenance_message_description')</small>
</div>
<div class="col-sm-9">
<input required name="maintenance_message" id="maintenance_message" placeholder="@t('admin.app.maintenance_message')"
<input name="maintenance_message" id="maintenance_message" placeholder="@t('admin.app.maintenance_message')"
type="text" class="form-control" value="{{ config('app.maintenance_message') }}">
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/Core/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class App
*
* @var string
*/
public const VERSION = '0.2.2-alpha';
public const VERSION = '0.2.2.1-alpha';

/**
* Set the base path of the application
Expand Down
13 changes: 8 additions & 5 deletions app/Core/Helpers/Translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ function __(?string $key, array $replacements = [], string $locale = null): stri
{
$translator = translation();

// Если локаль не указана, используйте локаль по умолчанию
if ($locale === null) {
$locale = $translator->getLocale();
}

// Если у нас нет точки, т.е. массива, то мы не разделяем
if( strpos( $key, '.' ) !== false ) {
// Разделяем ключ на домен и ключ перевода
if (strpos($key, '.') !== false) {
list($domain, $translationKey) = explode('.', $key, 2);

return $translator->trans($translationKey, $replacements, $domain, $locale);
$result = $translator->trans($translationKey, $replacements, $domain, $locale);

if ($result === $translationKey) {
return $key;
}

return $result;
}

return $translator->trans($key, $replacements, null, $locale);
Expand Down
8 changes: 4 additions & 4 deletions app/Core/Template/TemplateAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private function processScssAsset(string $expression, string $scssPath): void
}

// Даже если сработало исключение, мы должны вернуть CSS
echo sprintf('<link href="%s" rel="stylesheet">', url($cssPath));
echo sprintf('<link href="%s?%s" rel="stylesheet">', url($cssPath), filemtime($cssBasePath));
}

private function processCssAsset(string $expression, string $cssPathBase): void
Expand Down Expand Up @@ -140,7 +140,7 @@ private function processCssAsset(string $expression, string $cssPathBase): void
$this->saveAsset($cssBasePath, $cssPathBase);
}

echo sprintf('<link href="%s" rel="stylesheet">', url($cssPath));
echo sprintf('<link href="%s?%s" rel="stylesheet">', url($cssPath), filemtime($cssBasePath));
}

private function processJsAsset(string $expression, string $jsPathBase): void
Expand Down Expand Up @@ -170,7 +170,7 @@ private function processJsAsset(string $expression, string $jsPathBase): void
$this->saveAsset($jsBasePath, $jsPathBase);
}

echo sprintf('<script src="%s" defer></script>', url($jsPath));
echo sprintf('<script src="%s?%s" defer></script>', url($jsPath), filemtime($jsBasePath));
}

/**
Expand Down Expand Up @@ -205,7 +205,7 @@ protected function processCdnAsset(string $url, string $type = "js"): string
}
}

return url($localPath);
return url($localPath) . "?" . filemtime($localPath);
}

private function processImageAsset(string $expression, string $imgPathBase, string $extension): void
Expand Down

0 comments on commit 7cae910

Please sign in to comment.