Merge pull request #5492 from devansh-webkul/locale-image

Locale Image Added #5483#issuecomment-1002879333
This commit is contained in:
Devansh 2021-12-30 13:45:21 +05:30 committed by GitHub
commit e1167346ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 26 deletions

View File

@ -49,6 +49,12 @@ class Locale extends Model implements LocaleContract
public function image_url()
{
if (! $this->locale_image) {
$defaultLocaleImagePath = 'themes/velocity/assets/images/flags/' . $this->code . '.png';
if (file_exists(public_path($defaultLocaleImagePath))) {
return asset($defaultLocaleImagePath);
}
return '';
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
{
"/js/velocity-core.js": "/js/velocity-core.js?id=03a0210d750dd5a7a25a",
"/js/velocity.js": "/js/velocity.js?id=750e108634d1759d6c91",
"/js/velocity.js": "/js/velocity.js?id=c3c94d3b658b034a604c",
"/js/manifest.js": "/js/manifest.js?id=0632f4b734c0b094a611",
"/js/components.js": "/js/components.js?id=e65091541ad21a6c4b65",
"/js/components.js": "/js/components.js?id=2a81ca1a7d2b98468a12",
"/css/velocity.css": "/css/velocity.css?id=5c9e937a8ad9844d7158",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=301f732acd63a842dc52",
"/images/Camera.svg": "/images/Camera.svg?id=b2fd2f9e17e1ccee96e2",

View File

@ -80,15 +80,8 @@
<img
class="language-logo"
:src="locale.image_url"
:alt="locale.name"
v-if="locale.image_url"
/>
<img
class="language-logo"
:src="`${$root.baseUrl}/themes/velocity/assets/images/flags/en.png`"
alt=""
v-else-if="locale.code == 'en'"
v-if="locale.image_url"
/>
</div>
@ -223,22 +216,13 @@
<li v-for="(locale, index) in allLocales" :key="index">
<a class="unset" :href="`?locale=${locale.code}`">
<div class="category-logo">
<img
class="category-icon"
:src="`${$root.baseUrl}/themes/velocity/assets/images/flags/en.png`"
:alt="locale.name"
width="20"
height="20"
v-if="locale.code == 'en'"
/>
<img
class="category-icon"
:src="locale.image_url"
:alt="locale.name"
alt=""
width="20"
height="20"
v-else-if="locale.image_url"
v-if="locale.image_url"
/>
</div>

View File

@ -28,9 +28,7 @@
<div class="d-inline-block">
<div class="dropdown">
<div class="locale-icon">
@if ($currentLocaleImageSource = app(\Webkul\Velocity\Helpers\Helper::class)->getCurrentLocaleImageSource())
<img src="{{ $currentLocaleImageSource }}" alt="" width="20" height="20" />
@endif
<img src="{{ core()->getCurrentLocale()->image_url }}" alt="" width="20" height="20" />
</div>
<select