Skip to content

Commit

Permalink
Issue bagisto#8228 fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
suraj-webkul committed Sep 13, 2023
1 parent e446744 commit bcf05fc
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ export default {
// avoid having multiple dashes (---- translates into -)
.replace('![-\s]+!u', '-')
.trim();

if (binding.value) {
binding.value({
[binding.arg]: target.value
});
}
}, 100);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class="primary-button"
:class="[errors['{{ 'name' }}'] ? 'border border-red-600 hover:border-red-600' : '']"
class="flex w-full min-h-[39px] py-2 px-3 border rounded-[6px] text-[14px] text-gray-600 transition-all hover:border-gray-400 focus:border-gray-400"
placeholder="{{ trans('admin::app.catalog.categories.create.company-name') }}"
v-slugify-target:slug
v-slugify-target:slug="setValues"
>
</v-field>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,28 @@ class="flex gap-[10px] px-5 py-2 text-[16px] cursor-pointer hover:bg-gray-100 {{
@lang('admin::app.catalog.categories.edit.company-name')
</x-admin::form.control-group.label>

<x-admin::form.control-group.control
<v-field
type="text"
name="{{$currentLocale->code}}[name]"
value="{{ old($currentLocale->code)['name'] ?? ($category->translate($currentLocale->code)['name'] ?? '') }}"
class="w-full"
rules="required"
:label="trans('admin::app.catalog.categories.edit.company-name')"
:placeholder="trans('admin::app.catalog.categories.edit.company-name')"
label="{{ trans('admin::app.catalog.categories.edit.company-name') }}"
value="{{ old($currentLocale->code)['name'] ?? ($category->translate($currentLocale->code)['name'] ?? '') }}"
v-slot="{ field }"
>
</x-admin::form.control-group.control>
<input
type="text"
name="{{$currentLocale->code}}[name]"
id="{{$currentLocale->code}}[name]"
v-bind="field"
:class="[errors['{{ $currentLocale->code }}[name]'] ? 'border border-red-600 hover:border-red-600' : '']"
class="flex w-full min-h-[39px] py-2 px-3 border rounded-[6px] text-[14px] text-gray-600 transition-all hover:border-gray-400 focus:border-gray-400"
placeholder="{{ trans('admin::app.catalog.categories.edit.company-name') }}"
v-slugify-target:{{$currentLocale->code . '[slug]'}}="setValues"
>
</v-field>

<x-admin::form.control-group.error
control-name="name"
control-name="{{ $currentLocale->code}}[name]"
>
</x-admin::form.control-group.error>
</x-admin::form.control-group>
Expand Down Expand Up @@ -240,21 +249,31 @@ class="description"
{{-- Slug --}}
<x-admin::form.control-group class="mb-[10px]">
<x-admin::form.control-group.label class="required">
@lang('admin::app.catalog.categories.create.slug')
@lang('admin::app.catalog.categories.edit.slug')
</x-admin::form.control-group.label>

<x-admin::form.control-group.control
<v-field
type="text"
name="{{$currentLocale->code}}[slug]"
:value="old($currentLocale->code)['slug'] ?? ($category->translate($currentLocale->code)['slug'] ?? '')"
rules="required"
:label="trans('admin::app.catalog.categories.create.slug')"
:placeholder="trans('admin::app.catalog.categories.create.slug')"
label="{{ trans('admin::app.catalog.categories.edit.slug') }}"
value="{{ old($currentLocale->code)['slug'] ?? ($category->translate($currentLocale->code)['slug'] ?? '') }}"
v-slot="{ field }"
>
</x-admin::form.control-group.control>
<input
type="text"
name="{{$currentLocale->code}}[slug]"
id="{{$currentLocale->code}}[slug]"
v-bind="field"
:class="[errors['{{$currentLocale->code}}[slug]'] ? 'border border-red-600 hover:border-red-600' : '']"
class="flex w-full min-h-[39px] py-2 px-3 border rounded-[6px] text-[14px] text-gray-600 transition-all hover:border-gray-400 focus:border-gray-400"
placeholder="{{ trans('admin::app.catalog.categories.edit.slug') }}"
v-slugify-target:slug
>
</v-field>

<x-admin::form.control-group.error
control-name="slug"
control-name="{{$currentLocale->code}}[slug]"
>
</x-admin::form.control-group.error>
</x-admin::form.control-group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:class="[errors['{{ $attribute->code }}'] ? 'border border-red-600 hover:border-red-600' : '']"
class="flex w-full min-h-[39px] py-2 px-3 border rounded-[6px] text-[14px] text-gray-600 transition-all hover:border-gray-400 focus:border-gray-400"
@if ($attribute->code == 'url_key') v-slugify @endif
@if ($attribute->code == 'name') v-slugify-target:url_key @endif
@if ($attribute->code == 'name') v-slugify-target:url_key="setValues" @endif
>
</v-field>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<v-form
method="{{ $method === 'GET' ? 'GET' : 'POST' }}"
:initial-errors="{{ json_encode($errors->getMessages()) }}"
v-slot="{ meta, errors }"
v-slot="{ meta, errors, setValues }"
{{ $attributes }}
>
@unless(in_array($method, ['HEAD', 'GET', 'OPTIONS']))
Expand Down

0 comments on commit bcf05fc

Please sign in to comment.