Checked For The Requested Locale In Channel
This commit is contained in:
parent
68ab2d8779
commit
f4ef06af6e
|
|
@ -14,7 +14,7 @@
|
|||
<select class="control" name="channels[]" v-validate="'required'" data-vv-as=""{{ __('admin::app.catalog.products.channel') }}"" multiple>
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->code, $productChannels) ? 'selected' : ''}}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate('en')->name }}
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,16 @@
|
|||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<?php $locale = request()->get('locale') ?: app()->getLocale(); ?>
|
||||
<?php $channel = request()->get('channel') ?: core()->getDefaultChannelCode(); ?>
|
||||
@php
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$channel = request()->get('channel') ?: core()->getDefaultChannelCode();
|
||||
|
||||
$channelLocales = app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales;
|
||||
|
||||
if (! $channelLocales->contains('code', $locale)) {
|
||||
$locale = config('app.fallback_locale');
|
||||
}
|
||||
@endphp
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit.before', ['product' => $product]) !!}
|
||||
|
||||
|
|
@ -29,7 +37,7 @@
|
|||
|
||||
<option
|
||||
value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name }}
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
|
@ -38,7 +46,7 @@
|
|||
|
||||
<div class="control-group">
|
||||
<select class="control" id="locale-switcher" name="locale">
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales as $localeModel)
|
||||
@foreach ($channelLocales as $localeModel)
|
||||
|
||||
<option
|
||||
value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
<select type="text" class="control" name="channels[]" v-validate="'required'" value="{{ old('channel[]') }}" data-vv-as=""{{ __('admin::app.cms.pages.channel') }}"" multiple="multiple">
|
||||
@foreach($channels->all() as $channel)
|
||||
<option value="{{ $channel->id }}">{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate('en')->name }}</option>
|
||||
<option value="{{ $channel->id }}">{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
<select type="text" class="control" name="channels[]" v-validate="'required'" value="{{ old('channel[]') }}" data-vv-as=""{{ __('admin::app.cms.pages.channel') }}"" multiple="multiple">
|
||||
@foreach(app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->id, $selectedOptionIds) ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate('en')->name }}
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
@foreach (core()->getAllChannels() as $channelModel)
|
||||
|
||||
<option value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate('en')->name }}
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
<select v-validate="'required'" class="control" id="channel_id" name="channel_id" data-vv-as=""{{ __('admin::app.marketing.campaigns.channel') }}"">
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ old('channel_id') == $channel->id ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate('en')->name }}
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@
|
|||
<select v-validate="'required'" class="control" id="channel_id" name="channel_id" data-vv-as=""{{ __('admin::app.marketing.campaigns.channel') }}"">
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ $selectedOption == $channel->id ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate('en')->name }}
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ old('channels') && in_array($channel->id, old('channels')) ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate('en')->name }}
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->id, $selectedOptionIds) ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate('en')->name }}
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ old('channels') && in_array($channel->id, old('channels')) ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate('en')->name }}
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->id, $selectedOptionIds) ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate('en')->name }}
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<option
|
||||
value="{{ $channelModel->code }}"
|
||||
{{ (isset($channel) && ($channelModel->code) == $channel) ? 'selected' : '' }}>
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate('en')->name }}
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,13 @@
|
|||
|
||||
@php
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$channel = request()->get('channel') ?: core()->getCurrentChannelCode();
|
||||
$channel = request()->get('channel') ?: core()->getDefaultChannelCode();
|
||||
|
||||
$channelLocales = app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales;
|
||||
|
||||
if (! $channelLocales->contains('code', $locale)) {
|
||||
$locale = config('app.fallback_locale');
|
||||
}
|
||||
@endphp
|
||||
|
||||
@section('content')
|
||||
|
|
@ -38,7 +44,7 @@
|
|||
|
||||
<option
|
||||
value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate('en')->name }}
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate(config('app.fallback_locale'))->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
|
@ -47,7 +53,7 @@
|
|||
|
||||
<div class="control-group">
|
||||
<select class="control" id="locale-switcher" name="locale">
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales as $localeModel)
|
||||
@foreach ($channelLocales as $localeModel)
|
||||
|
||||
<option
|
||||
value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
|
||||
|
|
@ -113,7 +119,7 @@
|
|||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.home-page-content') }}
|
||||
<span class="locale">[{{ $metaData ? $metaData->channel : $channel }} - {{ $metaData ? $metaData->locale : $locale }}]</span>
|
||||
<span class="locale">[{{ $channel }} - {{ $locale }}]</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
|
|
@ -127,7 +133,7 @@
|
|||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.product-policy') }}
|
||||
<span class="locale">[{{ $metaData ? $metaData->channel : $channel }} - {{ $metaData ? $metaData->locale : $locale }}]</span>
|
||||
<span class="locale">[{{ $channel }} - {{ $locale }}]</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
|
|
@ -295,7 +301,7 @@
|
|||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.subscription-content') }}
|
||||
<span class="locale">[{{ $metaData ? $metaData->channel : $channel }} - {{ $metaData ? $metaData->locale : $locale }}]</span>
|
||||
<span class="locale">[{{ $channel }} - {{ $locale }}]</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
|
|
@ -309,7 +315,7 @@
|
|||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.footer-left-content') }}
|
||||
<span class="locale">[{{ $metaData ? $metaData->channel : $channel }} - {{ $metaData ? $metaData->locale : $locale }}]</span>
|
||||
<span class="locale">[{{ $channel }} - {{ $locale }}]</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
|
|
@ -323,7 +329,7 @@
|
|||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.footer-middle-content') }}
|
||||
<span class="locale">[{{ $metaData ? $metaData->channel : $channel }} - {{ $metaData ? $metaData->locale : $locale }}]</span>
|
||||
<span class="locale">[{{ $channel }} - {{ $locale }}]</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
|
|
@ -358,7 +364,7 @@
|
|||
$('#channel-switcher').val()
|
||||
|
||||
if (event.target.id == 'channel-switcher') {
|
||||
let locale = "{{ app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales->first()->code }}";
|
||||
let locale = "{{ $channelLocales->first()->code }}";
|
||||
|
||||
$('#locale-switcher').val(locale);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue