parent
8176317a59
commit
7b32b2e516
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.catalog.categories.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') }}" data-vv-as=""{{ __('admin::app.catalog.categories.name') }}""/>
|
||||
<input type="text" v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') }}" data-vv-as=""{{ __('admin::app.catalog.categories.name') }}"" v-slugify-target="'slug'"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('{{$locale}}[name]') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.catalog.categories.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="name" name="{{$locale}}[name]" value="{{ old($locale)['name'] ?? $category->translate($locale)['name'] }}" data-vv-as=""{{ __('admin::app.catalog.categories.name') }}""/>
|
||||
<input type="text" v-validate="'required'" class="control" id="name" name="{{$locale}}[name]" value="{{ old($locale)['name'] ?? $category->translate($locale)['name'] }}" data-vv-as=""{{ __('admin::app.catalog.categories.name') }}"" v-slugify-target="'slug'"/>
|
||||
<span class="control-error" v-if="errors.has('{{$locale}}[name]')">@{{ errors.first('{!!$locale!!}[name]') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1,4 @@
|
|||
<input type="text" v-validate="'{{$validations}}'" class="control" id="{{ $attribute->code }}" name="{{ $attribute->code }}" value="{{ old($attribute->code) ?: $product[$attribute->code] }}" data-vv-as=""{{ $attribute->admin_name }}"" {{ in_array($attribute->code, ['sku', 'url_key']) ? 'v-slugify' : '' }}/>
|
||||
<input type="text" v-validate="'{{$validations}}'" class="control" id="{{ $attribute->code }}" name="{{ $attribute->code }}" value="{{ old($attribute->code) ?: $product[$attribute->code] }}" {{ in_array($attribute->code, ['sku', 'url_key']) ? 'v-slugify' : '' }} data-vv-as=""{{ $attribute->admin_name }}"" {{ $attribute->code == 'name' ? 'v-slugify-target=\'url_key\'' : '' }} />
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@
|
|||
"jquery": "^3.4.1",
|
||||
"laravel-mix": "^5.0.0",
|
||||
"laravel-mix-merge-manifest": "^0.1.2",
|
||||
"vue": "^2.6.10"
|
||||
"sass": "^1.24.4",
|
||||
"sass-loader": "^8.0.2",
|
||||
"vue": "^2.6.10",
|
||||
"vue-template-compiler": "^2.6.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.7.0",
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/ui.js": "/js/ui.js?id=ed9978ac7d054203f0bc",
|
||||
"/js/ui.js": "/js/ui.js?id=d6802d7d61cdbdfc21e5",
|
||||
"/css/ui.css": "/css/ui.css?id=0895b560bbc19259cee8"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import ImageUpload from './components/image/image-upload';
|
|||
import ImageWrapper from './components/image/image-wrapper';
|
||||
import ImageItem from './components/image/image-item';
|
||||
import Slugify from './directives/slugify';
|
||||
import SlugifyTarget from './directives/slugify-target';
|
||||
import Code from './directives/code';
|
||||
import Alert from './directives/alert';
|
||||
import DatetimeComponent from './components/datetime';
|
||||
|
|
@ -35,6 +36,7 @@ Vue.component('image-upload', ImageUpload);
|
|||
Vue.component('image-wrapper', ImageWrapper);
|
||||
Vue.component('image-item', ImageItem);
|
||||
Vue.directive('slugify', Slugify);
|
||||
Vue.directive('slugify-target', SlugifyTarget);
|
||||
Vue.directive('code', Code);
|
||||
Vue.directive('alert', Alert);
|
||||
Vue.component('datetime', DatetimeComponent);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<script>
|
||||
export default {
|
||||
bind(el, binding, vnode) {
|
||||
let handler = function (e) {
|
||||
setTimeout(function () {
|
||||
var target = document.getElementById(binding.value);
|
||||
|
||||
target.value = e.target.value.toString()
|
||||
.toLowerCase()
|
||||
.replace(/[^\w- ]+/g, '')
|
||||
|
||||
// replace whitespaces with dashes
|
||||
.replace(/ +/g, '-')
|
||||
|
||||
// avoid having multiple dashes (---- translates into -)
|
||||
.replace('![-\s]+!u', '-')
|
||||
.trim();
|
||||
}, 100);
|
||||
};
|
||||
|
||||
el.addEventListener('input', handler);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue