Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ajv from 6.10.0 to 6.12.6 #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
248 changes: 124 additions & 124 deletions Modules/Blog/Admin/Sections/BlogCategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,36 @@ public function onDisplay()
->setDisplaySearch(true);

$columns = [
AdminColumn::text('id', '#')
->setWidth('50px')
->setHtmlAttribute('class', 'text-center'),
AdminColumn::link('name', __('adm.title'), 'slug'),
AdminColumn::text('categories.name', __('adm.edit.category'))
->setOrderable(true)
->setOrderable(function ($query, $direction) {
$query->orderBy('category_id', $direction);
})
->setSearchCallback(function ($column, $query, $search) {
return $query->orWhereHas('categories', function ($q) use ($search) {
$q->where('name', 'like', '%'.$search.'%');
});
})
->append(AdminColumn::filter('category_id')),
AdminColumn::custom(__('adm.lang'), function ($model) {
if (isset(config('app.locales')[$model->lang])) {
$lang = config('app.locales')[$model->lang];
} else {
$lang = '-';
}

return $lang;
})
->setWidth('50px')
->setHtmlAttribute('class', 'text-center'),
AdminColumn::text('updated_at', __('adm.edited'), 'editors.name')
->setWidth('160px')
->setSearchable(false),
];
AdminColumn::text('id', '#')
->setWidth('50px')
->setHtmlAttribute('class', 'text-center'),
AdminColumn::link('name', __('adm.title'), 'slug'),
AdminColumn::text('categories.name', __('adm.edit.category'))
->setOrderable(true)
->setOrderable(function ($query, $direction) {
$query->orderBy('category_id', $direction);
})
->setSearchCallback(function ($column, $query, $search) {
return $query->orWhereHas('categories', function ($q) use ($search) {
$q->where('name', 'like', '%'.$search.'%');
});
})
->append(AdminColumn::filter('category_id')),
AdminColumn::custom(__('adm.lang'), function ($model) {
if (isset(config('app.locales')[$model->lang])) {
$lang = config('app.locales')[$model->lang];
} else {
$lang = '-';
}

return $lang;
})
->setWidth('50px')
->setHtmlAttribute('class', 'text-center'),
AdminColumn::text('updated_at', __('adm.edited'), 'editors.name')
->setWidth('160px')
->setSearchable(false),
];

$tableActive = AdminDisplay::datatablesAsync()
->setName('active')
Expand All @@ -95,8 +95,8 @@ public function onDisplay()
->setHtmlAttribute('class', 'table-primary table-hover th-center');

$tableActive->setFilters(
AdminDisplayFilter::related('category_id', __('adm.edit.category'))->setModel(BlogCategory::class)
);
AdminDisplayFilter::related('category_id', __('adm.edit.category'))->setModel(BlogCategory::class)
);

$tableInactive = AdminDisplay::datatablesAsync()
->setName('draft')
Expand All @@ -117,26 +117,26 @@ public function onDisplay()
$tabs = AdminDisplay::tabbed();

$tabs->setElements([
AdminDisplay::tab($tableActive)
->setLabel(__('adm.all'))
->seticon('<i class="fas fa-eye"></i>')
->setBadge(function () {
return BlogCategory::Active()->count();
}),

AdminDisplay::tab($tableInactive)
->setLabel(__('adm.drafted'))
->seticon('<i class="fas fa-eye-slash"></i>')
->setHtmlAttribute('class', 'text-black-50')
->setBadge(function () {
return BlogCategory::Draft()->count();
}),

AdminDisplay::tab($tableDeleted)
->setLabel(__('adm.deleted'))
->setIcon('<i class="fas fa-trash"></i>')
->setHtmlAttribute('class', 'last text-danger'),
]);
AdminDisplay::tab($tableActive)
->setLabel(__('adm.all'))
->seticon('<i class="fas fa-eye"></i>')
->setBadge(function () {
return BlogCategory::Active()->count();
}),

AdminDisplay::tab($tableInactive)
->setLabel(__('adm.drafted'))
->seticon('<i class="fas fa-eye-slash"></i>')
->setHtmlAttribute('class', 'text-black-50')
->setBadge(function () {
return BlogCategory::Draft()->count();
}),

AdminDisplay::tab($tableDeleted)
->setLabel(__('adm.deleted'))
->setIcon('<i class="fas fa-trash"></i>')
->setHtmlAttribute('class', 'last text-danger'),
]);

return $tabs;
}
Expand All @@ -156,83 +156,83 @@ public function onEdit($id)
$cat = $data->getBlogCategory($def_lang, $id);

$tabs = AdminDisplay::tabbed([
__('Blog::admin_blog.main_tab') => new FormElements([
AdminFormElement::select('lang', __('adm.edit.lang_site'), config('app.locales'))
->required()
->setSortable(false)
->setDefaultValue($def_lang),
AdminFormElement::text('id', '#')
->setReadonly(1),

// AdminFormElement::dependentselect('category_id', __('adm.edit.category'))
// // ->setOptions($cat)
// ->setModelForOptions(BlogCategory::class, 'name')
// ->setDataDepends(['lang'])
// ->exclude($id)
// ->setDisplay('name')
// ->setSortable(false)
// ->setLoadOptionsQueryPreparer(function($item, $query) use ($cat) {
//
// return ($query->where('lang', $item->getDependValue('lang'))
// ->where('active', true)
// );
// })
// ,

AdminFormElement::html('<hr>'),
AdminFormElement::text('creators.name', __('adm.edit.creators'))
->setReadonly(1),
AdminFormElement::text('created_at', __('adm.edit.created_at'))
->setReadonly(1),
AdminFormElement::html('<hr>'),
AdminFormElement::text('editors.name', __('adm.edit.editors'))
->setReadonly(1),
AdminFormElement::text('updated_at', __('adm.edit.updated_at'))
->setReadonly(1),
]),

__('Blog::admin_blog.meta_tab') => new FormElements([
AdminFormElement::text('meta_title', __('adm.edit.meta_title'))
->addValidationRule('max:190', __('adm.valid.max190')),
AdminFormElement::textarea('meta_description', __('adm.edit.meta_description'))
->setRows(5)
->addValidationRule('max:190', __('adm.valid.max190')),
AdminFormElement::textarea('ldjson', 'LD-Json Script')
->setRows(10),
]),
]);
__('Blog::admin_blog.main_tab') => new FormElements([
AdminFormElement::select('lang', __('adm.edit.lang_site'), config('app.locales'))
->required()
->setSortable(false)
->setDefaultValue($def_lang),
AdminFormElement::text('id', '#')
->setReadonly(1),

// AdminFormElement::dependentselect('category_id', __('adm.edit.category'))
// // ->setOptions($cat)
// ->setModelForOptions(BlogCategory::class, 'name')
// ->setDataDepends(['lang'])
// ->exclude($id)
// ->setDisplay('name')
// ->setSortable(false)
// ->setLoadOptionsQueryPreparer(function($item, $query) use ($cat) {
//
// return ($query->where('lang', $item->getDependValue('lang'))
// ->where('active', true)
// );
// })
// ,

AdminFormElement::html('<hr>'),
AdminFormElement::text('creators.name', __('adm.edit.creators'))
->setReadonly(1),
AdminFormElement::text('created_at', __('adm.edit.created_at'))
->setReadonly(1),
AdminFormElement::html('<hr>'),
AdminFormElement::text('editors.name', __('adm.edit.editors'))
->setReadonly(1),
AdminFormElement::text('updated_at', __('adm.edit.updated_at'))
->setReadonly(1),
]),

__('Blog::admin_blog.meta_tab') => new FormElements([
AdminFormElement::text('meta_title', __('adm.edit.meta_title'))
->addValidationRule('max:190', __('adm.valid.max190')),
AdminFormElement::textarea('meta_description', __('adm.edit.meta_description'))
->setRows(5)
->addValidationRule('max:190', __('adm.valid.max190')),
AdminFormElement::textarea('ldjson', 'LD-Json Script')
->setRows(10),
]),
]);

//== main form
$form = AdminForm::panel()->addBody([
AdminFormElement::columns()->addColumn([

AdminFormElement::text('name', __('adm.name'))
->addValidationRule('max:190', __('adm.valid.max190'))
->required(),
AdminFormElement::text('slug', __('adm.slug'))
->addValidationRule('max:190', __('adm.valid.max190')),
AdminFormElement::columns()->addColumn([
AdminFormElement::image('image', __('adm.edit.image'))
->addValidationRule('max:190', __('adm.valid.max190')),
], 6)->addColumn([
AdminFormElement::text('icon', __('adm.edit.icon'))
->addValidationRule('max:190', __('adm.valid.max190')),
]),

AdminFormElement::wysiwyg('info_preview', __('adm.text_preview')),
// AdminFormElement::wysiwyg('info_full', __('adm.text_full'))->setHeight(500),

], 8)->addColumn([$tabs]),

AdminFormElement::html('<hr>'),
AdminFormElement::checkbox('active', __('adm.edit.actived')),
]);
AdminFormElement::columns()->addColumn([

AdminFormElement::text('name', __('adm.name'))
->addValidationRule('max:190', __('adm.valid.max190'))
->required(),
AdminFormElement::text('slug', __('adm.slug'))
->addValidationRule('max:190', __('adm.valid.max190')),
AdminFormElement::columns()->addColumn([
AdminFormElement::image('image', __('adm.edit.image'))
->addValidationRule('max:190', __('adm.valid.max190')),
], 6)->addColumn([
AdminFormElement::text('icon', __('adm.edit.icon'))
->addValidationRule('max:190', __('adm.valid.max190')),
]),

AdminFormElement::wysiwyg('info_preview', __('adm.text_preview')),
// AdminFormElement::wysiwyg('info_full', __('adm.text_full'))->setHeight(500),

], 8)->addColumn([$tabs]),

AdminFormElement::html('<hr>'),
AdminFormElement::checkbox('active', __('adm.edit.actived')),
]);

$form->getButtons()->setButtons([
// 'save' => new Save(),
'save_and_close' => new SaveAndClose(),
'cancel' => (new Cancel()),
]);
// 'save' => new Save(),
'save_and_close' => new SaveAndClose(),
'cancel' => (new Cancel()),
]);

return $form;
}
Expand Down
Loading