update ui of pages and menus
This commit is contained in:
parent
ad2a92242a
commit
a2c61522a4
|
@ -10,6 +10,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Gedmo\Mapping\Annotation as Gedmo;
|
use Gedmo\Mapping\Annotation as Gedmo;
|
||||||
|
use function Symfony\Component\String\u;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Gedmo\Tree(type="nested")
|
* @Gedmo\Tree(type="nested")
|
||||||
|
@ -278,6 +279,13 @@ class Node implements EntityInterface
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasExternalUrl(): bool
|
||||||
|
{
|
||||||
|
$string = u($this->getUrl());
|
||||||
|
|
||||||
|
return $string->startsWith('http://') || $string->startsWith('https://');
|
||||||
|
}
|
||||||
|
|
||||||
public function getIsVisible(): ?bool
|
public function getIsVisible(): ?bool
|
||||||
{
|
{
|
||||||
return $this->isVisible;
|
return $this->isVisible;
|
||||||
|
|
|
@ -39,6 +39,10 @@ class SiteRouteLoader extends Loader
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($node->hasExternalUrl()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$requirements = [];
|
$requirements = [];
|
||||||
|
|
||||||
$defaults = [
|
$defaults = [
|
||||||
|
|
|
@ -42,6 +42,10 @@ class SitemapBuilder
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($node->hasExternalUrl()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$nodeItems = [];
|
$nodeItems = [];
|
||||||
|
|
||||||
foreach ($this->getNodeUrls($node) as $url) {
|
foreach ($this->getNodeUrls($node) as $url) {
|
||||||
|
@ -63,7 +67,9 @@ class SitemapBuilder
|
||||||
$urls = [];
|
$urls = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($node->getController()) {
|
if ($node->hasExternalUrl()) {
|
||||||
|
$urls[] = $node->getUrl();
|
||||||
|
} elseif ($node->getController()) {
|
||||||
$annotation = $this->getAnnotation($node);
|
$annotation = $this->getAnnotation($node);
|
||||||
|
|
||||||
if (false !== $annotation) {
|
if (false !== $annotation) {
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
{{ node.label }}
|
{{ node.label }}
|
||||||
</a>
|
</a>
|
||||||
{% elseif node.page %}
|
{% elseif node.page %}
|
||||||
<a {% if isActive %}style="color: red"{% endif %} href="{{ url(node.routeName) }}">
|
{% set url = node.hasExternalUrl ? node.url : url(node.routeName) %}
|
||||||
|
|
||||||
|
<a {% if isActive %}style="color: red"{% endif %} href="{{ url }}">
|
||||||
{{ node.label }}
|
{{ node.label }}
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -23,11 +23,21 @@
|
||||||
{% set edit = path('admin_site_page_edit', {entity: item.id}) %}
|
{% set edit = path('admin_site_page_edit', {entity: item.id}) %}
|
||||||
|
|
||||||
<tr data-dblclick="{{ edit }}">
|
<tr data-dblclick="{{ edit }}">
|
||||||
<td class="col-10">
|
<td class="col-5">
|
||||||
<a href="{{ edit }}" class="font-weight-bold text-body d-block">
|
<a href="{{ edit }}" class="font-weight-bold text-body d-block">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="col-5">
|
||||||
|
{% for node in item.nodes %}
|
||||||
|
<a href="{{ path('admin_site_tree_navigation', {
|
||||||
|
navigation: node.menu.navigation.id,
|
||||||
|
'data-modal': path('admin_site_node_edit', {entity: node.id}),
|
||||||
|
}) }}" class="btn btn-sm btn-light mr-1">
|
||||||
|
{{ node.label }}
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
<td class="col-2 text-right">
|
<td class="col-2 text-right">
|
||||||
<a href="{{ edit }}" class="btn btn-sm btn-primary mr-1">
|
<a href="{{ edit }}" class="btn btn-sm btn-primary mr-1">
|
||||||
<span class="fa fa-edit"></span>
|
<span class="fa fa-edit"></span>
|
||||||
|
|
|
@ -105,7 +105,6 @@
|
||||||
|
|
||||||
<button type="submit" form="form-node-delete-{{ node.id }}" class="btn btn-sm btn-danger">
|
<button type="submit" form="form-node-delete-{{ node.id }}" class="btn btn-sm btn-danger">
|
||||||
<span class="fa fa-trash"></span>
|
<span class="fa fa-trash"></span>
|
||||||
Supprimer
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -113,7 +112,13 @@
|
||||||
{{ node.label }}
|
{{ node.label }}
|
||||||
|
|
||||||
<span class="ml-3 btn-group">
|
<span class="ml-3 btn-group">
|
||||||
{% if node.url %}
|
{% if node.hasExternalUrl %}
|
||||||
|
<a href="{{ node.url }}" class="btn btn-sm border border-secondary btn-light">
|
||||||
|
<span class="fa fa-sign-out-alt text-muted"></span>
|
||||||
|
|
||||||
|
{{ node.url }}
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
{% if node.parameters|length %}
|
{% if node.parameters|length %}
|
||||||
<span class="btn btn-sm border border-secondary btn-light">
|
<span class="btn btn-sm border border-secondary btn-light">
|
||||||
{{ node.url }}
|
{{ node.url }}
|
||||||
|
@ -123,12 +128,12 @@
|
||||||
{{ node.url }}
|
{{ node.url }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.controller %}
|
{% if node.controller %}
|
||||||
<span title="{{ node.controller }}" data-toggle="tooltip" data-placement="top" class="btn btn-sm border border-secondary btn-light">
|
<span title="{{ node.controller }}" data-toggle="tooltip" data-placement="top" class="btn btn-sm border border-secondary btn-light">
|
||||||
<span class="fa fa-dice-d6"></span>
|
<span class="fa fa-dice-d6"></span>
|
||||||
</span>
|
</span>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue