Moving asgardcms related variables to the AsgardCMS namespace

parent fcb29ed6
...@@ -2,7 +2,7 @@ import PageTable from './components/PageTable.vue' ...@@ -2,7 +2,7 @@ import PageTable from './components/PageTable.vue'
import PageTableServerSide from './components/PageTableServerSide.vue' import PageTableServerSide from './components/PageTableServerSide.vue'
import PageForm from './components/PageForm.vue' import PageForm from './components/PageForm.vue'
const locales = window.locales; const locales = window.AsgardCMS.locales;
export default [ export default [
{ {
......
...@@ -75,11 +75,10 @@ ...@@ -75,11 +75,10 @@
@endforeach @endforeach
<script> <script>
window.AsgardCMS = { window.AsgardCMS = {
translations: {!! json_encode(['page' => array_dot(trans('page::pages')), 'core' => array_dot(trans('core::core'))]) !!} translations: {!! json_encode(['page' => array_dot(trans('page::pages')), 'core' => array_dot(trans('core::core'))]) !!},
locales: {!! json_encode(LaravelLocalization::getSupportedLocales()) !!},
currentLocale: '{{ locale() }}',
}; };
window.locales = {!! json_encode(LaravelLocalization::getSupportedLocales()) !!}
window.currentLocale = '{{ locale() }}';
</script> </script>
<script src="{{ mix('js/app.js') }}"></script> <script src="{{ mix('js/app.js') }}"></script>
......
This diff is collapsed.
...@@ -18,6 +18,8 @@ Vue.component('DeleteButton', require('../../../Modules/Core/Assets/js/component ...@@ -18,6 +18,8 @@ Vue.component('DeleteButton', require('../../../Modules/Core/Assets/js/component
Vue.component('TagsInput', require('../../../Modules/Tag/Assets/js/components/TagInput.vue')); Vue.component('TagsInput', require('../../../Modules/Tag/Assets/js/components/TagInput.vue'));
import PageRoutes from '../../../Modules/Page/Assets/js/PageRoutes'; import PageRoutes from '../../../Modules/Page/Assets/js/PageRoutes';
const currentLocale = window.AsgardCMS.currentLocale;
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',
base: `${currentLocale}/backend`, base: `${currentLocale}/backend`,
......
...@@ -48,7 +48,7 @@ if (userApiToken) { ...@@ -48,7 +48,7 @@ if (userApiToken) {
let currentLocale = document.head.querySelector('meta[name="current-locale"]'); let currentLocale = document.head.querySelector('meta[name="current-locale"]');
if (currentLocale) { if (currentLocale) {
window.currentLocale = currentLocale.content; window.AsgardCMS.currentLocale = currentLocale.content;
} else { } else {
console.error('Current locale token not found in a meta tag.'); console.error('Current locale token not found in a meta tag.');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment