Browse Source

Refactor lang-switcher view partial

pull/7/head
Nafies Luthfi 8 years ago
parent
commit
c675f65b8f
  1. 47
      resources/views/layouts/partials/lang-switcher.blade.php

47
resources/views/layouts/partials/lang-switcher.blade.php

@ -1,36 +1,17 @@
<div class="text-center" style="border-bottom: 1px solid #e7e7e7; padding-bottom: 10px">
{{ trans('lang.lang') }} :
{!! FormField::formButton(
[
'route' => 'users.profile.switch-lang',
'method' => 'patch',
'title' => auth()->user()->lang != 'en' ? trans('lang.switch_tooltip', ['lang' => trans('lang.en')]) : ''
],
'EN',
['class' => 'btn btn-default btn-xs', 'id' => 'switch_lang_en']
+ (auth()->user()->lang == 'en' ? ['disabled' => 'disabled'] : []),
['lang' => 'en']
) !!}
{!! FormField::formButton(
[
'route' => 'users.profile.switch-lang',
'method' => 'patch',
'title' => auth()->user()->lang != 'id' ? trans('lang.switch_tooltip', ['lang' => trans('lang.id')]) : ''
],
'ID',
['class' => 'btn btn-default btn-xs', 'id' => 'switch_lang_id']
+ (auth()->user()->lang == 'id' ? ['disabled' => 'disabled'] : []),
['lang' => 'id']
) !!}
{!! FormField::formButton(
[
'route' => 'users.profile.switch-lang',
'method' => 'patch',
'title' => auth()->user()->lang != 'de' ? trans('lang.switch_tooltip', ['lang' => trans('lang.de')]) : ''
],
'DE',
['class' => 'btn btn-default btn-xs', 'de' => 'switch_lang_de']
+ (auth()->user()->lang == 'de' ? ['disabled' => 'disabled'] : []),
['lang' => 'de']
) !!}
@foreach (['en', 'id', 'de'] as $langKey)
{!! FormField::formButton(
[
'route' => 'users.profile.switch-lang',
'method' => 'patch',
'title' => auth()->user()->lang != $langKey ? trans('lang.switch_tooltip', ['lang' => trans('lang.'.$langKey)]) : ''
],
strtoupper($langKey),
['class' => 'btn btn-default btn-xs', 'id' => 'switch_lang_'.$langKey]
+ (auth()->user()->lang == $langKey ? ['disabled' => 'disabled'] : []),
['lang' => $langKey]
) !!}
@endforeach
</div>
Loading…
Cancel
Save