description multi language

This commit is contained in:
vedatakd 2019-09-12 17:42:34 +03:00
parent e063c9c63c
commit 9b9d8e1319
5 changed files with 105 additions and 11 deletions

View File

@ -32,7 +32,9 @@ class VisiosoftModuleAdvsCreateAdvsStream extends Migration
'slug' => [
'required' => true,
],
'advs_desc',
'advs_desc' => [
'translatable' => true,
],
'cat1',
'cat2',
'cat3',

View File

@ -62,4 +62,94 @@ $('input[name="price"]').on('click', function () {
{
$(this).val("");
}
})
})
$(document).on('ajaxComplete ready shown.bs.tab', function () {
// Initialize WYSIWYG editors.
$('textarea[data-field="advs_desc"]:not(.hasEditor)').each(function () {
/**
* Gather available buttons / plugins.
*/
let textarea = $(this);
let buttons = textarea.data('available_buttons');
let plugins = textarea.data('available_plugins');
textarea.addClass('hasEditor');
textarea.redactor({
element: $(this),
/**
* Initialize the editor icons.
*/
callbacks: {
init: function () {
let icons = {};
$.each(buttons, function (k, v) {
if (v.icon) {
icons[v.button ? v.button : k] = '<i class="' + v.icon + '"></i>';
}
});
$.each(plugins, function (k, v) {
if (v.icon) {
icons[v.button ? v.button : k] = '<i class="' + v.icon + '"></i>';
}
});
$.each(this.button.all(), $.proxy(function (i, s) {
let key = $(s).attr('rel');
if (typeof icons[key] !== 'undefined') {
let icon = icons[key];
let button = this.button.get(key);
this.button.setIcon(button, icon);
}
}, this));
}
},
/**
* Settings
*/
script: false,
structure: true,
linkTooltip: true,
cleanOnPaste: true,
toolbarFixed: false,
imagePosition: true,
imageResizable: true,
breakline: Boolean(textarea.data('breakline')),
removeNewLines: Boolean(textarea.data('remove_new_lines')),
imageFloatMargin: '20px',
removeEmpty: ['strong', 'em', 'p'],
/**
* Features
*/
minHeight: textarea.data('height'),
placeholder: textarea.attr('placeholder'),
folders: textarea.data('folders').toString().split(','),
buttons: textarea.data('buttons').toString().split(','),
plugins: textarea.data('plugins').toString().split(',')
});
textarea.closest('form').on('submit', function () {
textarea.val(textarea.redactor('code.get'));
});
if (textarea.is('[readonly]') || textarea.is('[disabled]')) {
textarea.redactor('button.disableAll');
textarea.redactor('core.editor')
.attr('contenteditable', false);
}
});
});

View File

@ -105,7 +105,7 @@
</div>
</div>
<div class="row form-group brand-name">
{{ form.fields.advs_desc.input|raw }}
{{ descField|raw }}
</div>
<div class="row form-group images">
{{ form.fields.files.input |raw }}

View File

@ -557,13 +557,20 @@ class AdvsController extends PublicController
AdvModel $advModel
)
{
$nameField = HTMLDomParser::str_get_html($advFormBuilder->render($id)->getContent());
$nameField = $nameField->find('.name', 0);
$Field = HTMLDomParser::str_get_html($advFormBuilder->render($id)->getContent());
$nameField = $Field->find('.name', 0);
if ($nameField !== null) {
$nameField = $nameField->innertext();
} else {
$nameField = "";
}
$descField = $Field->find('.advs_desc', 0);
if ($descField !== null) {
$descField = $descField->innertext();
} else {
$nameField = "";
}
if (!Auth::user()) {
redirect('/login?redirect=' . url()->current())->send();
}
@ -607,7 +614,7 @@ class AdvsController extends PublicController
$custom_fields = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->edit($adv, $categories, $cats);
}
return $this->view->make('visiosoft.module.advs::advs/new-create', compact('id', 'cats_d', 'request', 'Cloudinary', 'cities', 'adv', 'custom_fields', 'nameField'));
return $this->view->make('visiosoft.module.advs::advs/new-create', compact('id', 'cats_d', 'request', 'Cloudinary', 'cities', 'adv', 'custom_fields', 'nameField','descField'));
}
public function destroy($id)

View File

@ -1,10 +1,5 @@
<?php
use Anomaly\Streams\Platform\Model\Location\LocationCitiesEntryModel;
use Anomaly\Streams\Platform\Model\Location\LocationDistrictsEntryModel;
use Visiosoft\LocationModule\Country\CountryModel;
return [
'home_page_location' => [
'type' => 'anomaly.field_type.boolean',