add 'disableUrl' attribute in node
This commit is contained in:
parent
730fb3e820
commit
40b2798c0c
|
@ -129,7 +129,6 @@ tr.table-primary-light {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
width: 260px;
|
width: 260px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -258,6 +257,13 @@ th {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-tiles {
|
||||||
|
background-color: #c1c1c1;
|
||||||
|
background-image: linear-gradient(45deg, #646464 25%, transparent 25%, transparent 75%, #646464 75%), linear-gradient(45deg, #646464 25%, transparent 25%, transparent 75%, #646464 75%);
|
||||||
|
background-size: 20px 20px;
|
||||||
|
background-position: 0 0, 10px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.tab-form {
|
.tab-form {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,11 @@ class Node implements EntityInterface
|
||||||
*/
|
*/
|
||||||
private $url;
|
private $url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean", options={"default"=0})
|
||||||
|
*/
|
||||||
|
private $disableUrl = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="boolean", options={"default"=0})
|
* @ORM\Column(type="boolean", options={"default"=0})
|
||||||
*/
|
*/
|
||||||
|
@ -298,6 +303,18 @@ class Node implements EntityInterface
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDisableUrl(): ?bool
|
||||||
|
{
|
||||||
|
return $this->disableUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDisableUrl(bool $disableUrl): self
|
||||||
|
{
|
||||||
|
$this->disableUrl = $disableUrl;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getTreeLabel()
|
public function getTreeLabel()
|
||||||
{
|
{
|
||||||
$prefix = str_repeat('-', ($this->getTreeLevel() - 1) * 5);
|
$prefix = str_repeat('-', ($this->getTreeLevel() - 1) * 5);
|
||||||
|
|
|
@ -60,6 +60,12 @@ class NodeEventSubscriber extends EntityManagerEventSubscriber
|
||||||
|
|
||||||
$node->setCode($this->codeSlugify->slugify($node->getCode()));
|
$node->setCode($this->codeSlugify->slugify($node->getCode()));
|
||||||
|
|
||||||
|
if ($node->getDisableUrl()) {
|
||||||
|
$node->setUrl(null);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($node->getUrl()) {
|
if ($node->getUrl()) {
|
||||||
$generatedUrl = $node->getUrl();
|
$generatedUrl = $node->getUrl();
|
||||||
} else {
|
} else {
|
||||||
|
@ -138,6 +144,10 @@ class NodeEventSubscriber extends EntityManagerEventSubscriber
|
||||||
$generatedUrl = $generatedUrl.'-'.$number;
|
$generatedUrl = $generatedUrl.'-'.$number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!u($generatedUrl)->startsWith('/')) {
|
||||||
|
$generatedUrl = '/'.$generatedUrl;
|
||||||
|
}
|
||||||
|
|
||||||
$node->setUrl($generatedUrl);
|
$node->setUrl($generatedUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
|
||||||
class NodeType extends AbstractType
|
class NodeType extends AbstractType
|
||||||
{
|
{
|
||||||
|
@ -46,6 +47,19 @@ class NodeType extends AbstractType
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$builder->add(
|
||||||
|
'disableUrl',
|
||||||
|
CheckboxType::class,
|
||||||
|
[
|
||||||
|
'label' => 'Disable URL',
|
||||||
|
'required' => false,
|
||||||
|
'attr' => [
|
||||||
|
],
|
||||||
|
'constraints' => [
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$builder->add(
|
$builder->add(
|
||||||
'code',
|
'code',
|
||||||
TextType::class,
|
TextType::class,
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
"Yearly": "Annuelle"
|
"Yearly": "Annuelle"
|
||||||
"Never": "Jamais"
|
"Never": "Jamais"
|
||||||
"URL": "URL"
|
"URL": "URL"
|
||||||
|
"Disable URL": "Désactiver l'URL"
|
||||||
"Controller": "Contrôleur"
|
"Controller": "Contrôleur"
|
||||||
"Leave blank for automatic generation": "Laisser vide pour une génération automatique"
|
"Leave blank for automatic generation": "Laisser vide pour une génération automatique"
|
||||||
"Leave blank to use the default one. Example: App\\Controller\\FooController::barAction": "Laisser vide pour utiliser celui par défaut. Exemple : App\\Controller\\FooController::barAction"
|
"Leave blank to use the default one. Example: App\\Controller\\FooController::barAction": "Laisser vide pour utiliser celui par défaut. Exemple : App\\Controller\\FooController::barAction"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{% if value %}
|
{% if value %}
|
||||||
{% if value and value.extension in ['jpeg', 'jpg', 'gif', 'png', 'svg'] %}
|
{% if value and value.extension in ['jpeg', 'jpg', 'gif', 'png', 'svg'] %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-img-top bg-dark text-center">
|
<div class="card-img-top bg-tiles text-center">
|
||||||
<a href="{{ asset(value.pathname) }}" target="_blank">
|
<a href="{{ asset(value.pathname) }}" target="_blank">
|
||||||
<img src="{{ asset(value.pathname) }}" class="img-fluid">
|
<img src="{{ asset(value.pathname) }}" class="img-fluid">
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -144,6 +144,7 @@
|
||||||
{{ 'Route name: <code>%routeName%</code>'|trans({'%routeName%': entity.routeName})|raw }}
|
{{ 'Route name: <code>%routeName%</code>'|trans({'%routeName%': entity.routeName})|raw }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ form_row(form.disableUrl) }}
|
||||||
{{ form_row(form.code) }}
|
{{ form_row(form.code) }}
|
||||||
{{ form_row(form.controller) }}
|
{{ form_row(form.controller) }}
|
||||||
|
|
||||||
|
|
|
@ -84,23 +84,25 @@
|
||||||
<span class="fa fa-sign-out-alt text-muted"></span>
|
<span class="fa fa-sign-out-alt text-muted"></span>
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if node.parameters|length %}
|
{% if not node.disableUrl %}
|
||||||
<span class="btn btn-sm border border-secondary btn-light">
|
{% if node.parameters|length %}
|
||||||
{{ node.url }}
|
<span class="btn btn-sm border border-secondary btn-light">
|
||||||
</span>
|
|
||||||
{% else %}
|
|
||||||
{% set url = safe_node_url(node) %}
|
|
||||||
|
|
||||||
{% if url %}
|
|
||||||
<a href="{{ url ? url : '#' }}" target="_blank" class="btn btn-sm border border-secondary btn-light">
|
|
||||||
{{ node.url }}
|
{{ node.url }}
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if url is same as(null) %}
|
|
||||||
<span class="btn btn-sm border border-secondary btn-light" title="{{ 'Edit the routing'|trans }}">
|
|
||||||
<span class="fa fa-exclamation"></span>
|
|
||||||
</span>
|
</span>
|
||||||
|
{% else %}
|
||||||
|
{% set url = safe_node_url(node) %}
|
||||||
|
|
||||||
|
{% if url %}
|
||||||
|
<a href="{{ url ? url : '#' }}" target="_blank" class="btn btn-sm border border-secondary btn-light">
|
||||||
|
{{ node.url }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if url is same as(null) %}
|
||||||
|
<span class="btn btn-sm border border-secondary btn-light" title="{{ 'Edit the routing'|trans }}">
|
||||||
|
<span class="fa fa-exclamation"></span>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue