mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#11 Can't create multilanguage categories fix
This commit is contained in:
parent
0f095eafa8
commit
351c5afd5d
@ -1,25 +1,39 @@
|
|||||||
{% extends "theme::layouts/default" %}
|
{% extends "theme::layouts/default" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "theme::partials/messages" %}
|
{% include "theme::partials/messages" %}
|
||||||
{% set form = form('cats','category').entry(id).get() %}
|
|
||||||
{{ form_open()|raw }}
|
<div class="container-fluid">
|
||||||
<div class="container-fluid">
|
<div class="card">
|
||||||
<div class="card">
|
<div class="card-block">
|
||||||
<div class="card-block">
|
|
||||||
{{ form.fields.name|raw }}
|
{% set actions = ['save'] %}
|
||||||
{{ form.fields.slug|raw }}
|
|
||||||
<input type="hidden" name="parent_category"
|
{% if id is not null %}
|
||||||
value="{% if form.fields.parent_category.value.id is defined %}{{ form.fields.parent_category.value.id }}{% elseif app.request.get('parent') is defined %}{{ app.request.get('parent') }}{% endif %}">
|
{% set actions = ['update'] %}
|
||||||
{{ form.fields.order|raw }}
|
{% endif %}
|
||||||
{{ form.fields.files|raw }}
|
|
||||||
</div>
|
{% set form = form('cats','category').entry(id).actions(actions).get() %}
|
||||||
</div>
|
{{ form_open({
|
||||||
<div class="controls card">
|
'class': 'form ' ~ form.options.class ,
|
||||||
<div class="card-block">
|
'enctype': 'multipart/form-data',
|
||||||
{{ form.actions|raw }}
|
})|raw }}
|
||||||
</div>
|
<fieldset>
|
||||||
|
<div class="section">
|
||||||
|
{{ nameField|raw }}
|
||||||
|
{{ form.fields.slug|raw }}
|
||||||
|
<input type="hidden" name="parent_category"
|
||||||
|
value="{% if form.fields.parent_category.value.id is defined %}{{ form.fields.parent_category.value.id }}{% elseif app.request.get('parent') is defined %}{{ app.request.get('parent') }}{% endif %}">
|
||||||
|
{{ form.fields.order|raw }}
|
||||||
|
{{ form.fields.files|raw }}
|
||||||
|
</div><!-- section -->
|
||||||
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{ form.close|raw}}
|
<div class="controls card">
|
||||||
|
<div class="card-block">
|
||||||
|
{{ form.actions|raw }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{{ asset_add("scripts.js", "visiosoft.module.cats::js/admin-cat.js") }}
|
{{ asset_add("scripts.js", "visiosoft.module.cats::js/admin-cat.js") }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
|
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Sunra\PhpSimple\HtmlDomParser;
|
||||||
use Visiosoft\CatsModule\Category\CategoryCollection;
|
use Visiosoft\CatsModule\Category\CategoryCollection;
|
||||||
use Visiosoft\CatsModule\Category\CategoryModel;
|
use Visiosoft\CatsModule\Category\CategoryModel;
|
||||||
use Visiosoft\CatsModule\Category\Form\CategoryFormBuilder;
|
use Visiosoft\CatsModule\Category\Form\CategoryFormBuilder;
|
||||||
@ -65,9 +66,21 @@ class CategoryController extends AdminController
|
|||||||
return $this->redirect->to('/admin/cats/create');
|
return $this->redirect->to('/admin/cats/create');
|
||||||
}
|
}
|
||||||
return $this->redirect->to('/admin/cats');
|
return $this->redirect->to('/admin/cats');
|
||||||
|
} else {
|
||||||
|
$form->setFields(['name']);
|
||||||
|
$form->setActions(['save']);
|
||||||
|
$formBuilder = $form;
|
||||||
|
$nameField = HTMLDomParser::str_get_html($form->render()->getContent());
|
||||||
|
$nameField = $nameField->find('.name', 0);
|
||||||
|
if ($nameField !== null) {
|
||||||
|
$nameField = $nameField->innertext();
|
||||||
|
} else {
|
||||||
|
$nameField = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->view->make('visiosoft.module.cats::cats/admin-cat');
|
|
||||||
|
return $this->view->make('visiosoft.module.cats::cats/admin-cat', compact('nameField','formBuilder'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,8 +97,18 @@ class CategoryController extends AdminController
|
|||||||
if ($form->hasFormErrors()) {
|
if ($form->hasFormErrors()) {
|
||||||
return $this->redirect->back();
|
return $this->redirect->back();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$form->setFields(['name']);
|
||||||
|
$nameField = HTMLDomParser::str_get_html($form->render($id)->getContent());
|
||||||
|
$nameField = $nameField->find('.name', 0);
|
||||||
|
if ($nameField !== null) {
|
||||||
|
$nameField = $nameField->innertext();
|
||||||
|
} else {
|
||||||
|
$nameField = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $this->view->make('visiosoft.module.cats::cats/admin-cat')->with('id', $id);
|
|
||||||
|
return $this->view->make('visiosoft.module.cats::cats/admin-cat', compact('nameField'))->with('id', $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user