Skip to content

Commit

Permalink
feature #563 [CoreBundle]: Add block definition to organization and d…
Browse files Browse the repository at this point in the history
…omain navigation templates for easy overriding
  • Loading branch information
franzwilding committed Apr 17, 2019
1 parent 29e5066 commit ad165c7
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 117 deletions.
166 changes: 90 additions & 76 deletions Resources/views/Domain/_navigation.html.twig
@@ -1,9 +1,11 @@
<header class="uk-flex">
<button uk-toggle="target: #unite-main-menu-main; animation: uk-animation-slide-top"><i data-feather="menu"></i></button>

<button class="uk-button uk-button-default uk-flex-1" type="button">
<span>{{ unite.domain }}</span>
<i class="uk-margin-small-right" data-feather="chevron-down"></i></button>
{% block manage_domain %}
<button class="uk-button uk-button-default uk-flex-1" type="button">
<span>{{ unite.domain }}</span>
<i class="uk-margin-small-right" data-feather="chevron-down"></i>
</button>

{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\DomainVoter::UPDATE'), unite.domain) %}
<div id="unite-main-menu-domain" uk-dropdown="mode: click; pos: bottom-left; offset: -50; animation: uk-animation-slide-top" class="uk-width-large">
Expand Down Expand Up @@ -52,94 +54,106 @@
</ul>
</div>
{% endif %}
</div>
<button type="button" uk-close uk-toggle="target: #unite-main-menu-domain; animation: uk-animation-slide-top"></button>
</div>
<button type="button" uk-close uk-toggle="target: #unite-main-menu-domain; animation: uk-animation-slide-top"></button>
</div>
{% endblock manage_domain %}

<button uk-toggle="target: #unite-main-menu-user; animation: uk-animation-slide-top"><i data-feather="user"></i></button>
</header>
<article id="unite-main-menu-main" class="uk-flex-1" hidden>
<button type="button" uk-close uk-toggle="target: #unite-main-menu-main; animation: uk-animation-slide-top"></button>

{% if unite.domain.contentTypes|length == 0 and unite.domain.settingTypes|length == 0 %}
<div class="uk-placeholder uk-text-small uk-text-center">
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\DomainVoter::UPDATE'), unite.domain) %}
{% trans %}domain.menu.empty_placehodler_admin{% endtrans %}
{% else %}
{% trans %}domain.menu.empty_placehodler_user{% endtrans %}
{% endif %}
</div>
{% endif %}
{% block empty_placeholder %}
{% if unite.domain.contentTypes|length == 0 and unite.domain.settingTypes|length == 0 %}
<div class="uk-placeholder uk-text-small uk-text-center">
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\DomainVoter::UPDATE'), unite.domain) %}
{% trans %}domain.menu.empty_placehodler_admin{% endtrans %}
{% else %}
{% trans %}domain.menu.empty_placehodler_user{% endtrans %}
{% endif %}
</div>
{% endif %}
{% endblock empty_placeholder %}

<ul class="uk-nav uk-nav-parent-icon" uk-nav>
{% if unite.domain.contentTypes|length > 0 %}
<li class="uk-nav-header">{% trans %}domain.menu.content_types.headline{% endtrans %}</li>
{% for type in unite.domain.contentTypes %}
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\ContentVoter::LIST'), type) %}
<li><a {% spaceless %}
{% if view is defined and view.contentType.identifier == type.identifier and view.identifier == 'all' %}
class="uk-active"

{% block content_types %}
{% if unite.domain.contentTypes|length > 0 %}
<li class="uk-nav-header">{% trans %}domain.menu.content_types.headline{% endtrans %}</li>
{% for type in unite.domain.contentTypes %}
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\ContentVoter::LIST'), type) %}
<li><a {% spaceless %}
{% if view is defined and view.contentType.identifier == type.identifier and view.identifier == 'all' %}
class="uk-active"
{% endif %}
{% endspaceless %} href="{{ url('unitecms_core_content_index', [type]) }}">
<i class="uk-margin-small-right" data-feather="{{ type.icon ? type.icon : 'layers' }}"></i>
{{ type }}
</a>

{% if type.views|length > 1 %}
<ul class="uk-nav-sub">
{% for v in type.views %}
{% if v.identifier != "all" %}
<li><a {% spaceless %}
{% if view is defined and view.contentType.identifier == type.identifier and view.identifier == v.identifier %}
class="uk-active"
{% endif %}
{% endspaceless %}href="{{ url('unitecms_core_content_index', [v]) }}">
<i class="uk-margin-small-right" data-feather="{{ v.icon ? v.icon : 'layers' }}"></i>
{{ v }}
</a>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% endspaceless %} href="{{ url('unitecms_core_content_index', [type]) }}">
<i class="uk-margin-small-right" data-feather="{{ type.icon ? type.icon : 'layers' }}"></i>
{{ type }}
</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
{% endblock content_types %}

{% if type.views|length > 1 %}
<ul class="uk-nav-sub">
{% for v in type.views %}
{% if v.identifier != "all" %}
<li><a {% spaceless %}
{% if view is defined and view.contentType.identifier == type.identifier and view.identifier == v.identifier %}
class="uk-active"
{% endif %}
{% endspaceless %}href="{{ url('unitecms_core_content_index', [v]) }}">
<i class="uk-margin-small-right" data-feather="{{ v.icon ? v.icon : 'layers' }}"></i>
{{ v }}
</a>
{% block setting_types %}
{% if unite.domain.settingTypes|length > 0 %}
<li class="uk-nav-header">{% trans %}domain.menu.setting_types.headline{% endtrans %}</li>
{% for type in unite.domain.settingTypes %}
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\SettingVoter::UPDATE'), type) %}
<li><a {% spaceless %}
{% if settingType is defined and settingType.identifier == type.identifier %}
class="uk-active"
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}
{% endfor %}
{% endif %}
{% endspaceless %} href="{{ url('unitecms_core_setting_index', [type]) }}">
<i class="uk-margin-small-right" data-feather="{{ type.icon ? type.icon : 'settings' }}"></i>
{{ type }}
</a></li>
{% endif %}
{% endfor %}
{% endif %}
{% endblock setting_types %}

{% if unite.domain.settingTypes|length > 0 %}
<li class="uk-nav-header">{% trans %}domain.menu.setting_types.headline{% endtrans %}</li>
{% for type in unite.domain.settingTypes %}
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\SettingVoter::UPDATE'), type) %}
{% block member_types %}
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\DomainVoter::UPDATE'), unite.domain) %}
<li class="uk-nav-header">{% trans %}domain.menu.domain_member_types.headline{% endtrans %}</li>
{% for type in unite.domain.domainMemberTypes %}
<li><a {% spaceless %}
{% if settingType is defined and settingType.identifier == type.identifier %}
class="uk-active"
{% endif %}
{% endspaceless %} href="{{ url('unitecms_core_setting_index', [type]) }}">
<i class="uk-margin-small-right" data-feather="{{ type.icon ? type.icon : 'settings' }}"></i>
{% if memberType is defined and memberType.identifier == type.identifier %}
class="uk-active"
{% endif %}
{% endspaceless %} href="{{ url('unitecms_core_domainmember_index', [type]) }}">
<i class="uk-margin-small-right" data-feather="{{ type.icon ? type.icon : 'users' }}"></i>
{{ type }}
</a></li>
{% endif %}
{% endfor %}
{% endif %}

{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\DomainVoter::UPDATE'), unite.domain) %}
<li class="uk-nav-header">{% trans %}domain.menu.domain_member_types.headline{% endtrans %}</li>
{% for type in unite.domain.domainMemberTypes %}
<li><a {% spaceless %}
{% if memberType is defined and memberType.identifier == type.identifier %}
class="uk-active"
{% endif %}
{% endspaceless %} href="{{ url('unitecms_core_domainmember_index', [type]) }}">
<i class="uk-margin-small-right" data-feather="{{ type.icon ? type.icon : 'users' }}"></i>
{{ type }}
</a>
</li>
{% endfor %}
{% endif %}
</a>
</li>
{% endfor %}
{% endif %}
{% endblock member_types %}
</ul>

</article>
<footer id="unite-main-menu-user" hidden>
<button type="button" uk-close uk-toggle="target: #unite-main-menu-user; animation: uk-animation-slide-top"></button>
{% include '@UniteCMSCore/_user-menu.html.twig' %}
</footer>
{% block footer %}
<footer id="unite-main-menu-user" hidden>
<button type="button" uk-close uk-toggle="target: #unite-main-menu-user; animation: uk-animation-slide-top"></button>
{% include '@UniteCMSCore/_user-menu.html.twig' %}
</footer>
{% endblock footer %}
90 changes: 49 additions & 41 deletions Resources/views/Organization/_navigation.html.twig
Expand Up @@ -12,54 +12,60 @@
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\OrganizationVoter::UPDATE'), unite.organization) %}
<ul class="uk-nav">
<li class="uk-nav-header">{% trans %}organization.menu.manage.header{% endtrans %}</li>
<!--li><a href="#">{% trans %}organization.menu.manage.settings{% endtrans %}</a></li-->
<li>
<a href="{{ url('unitecms_core_organizationuser_index', [unite.organization]) }}">
<i data-feather="users" class="uk-margin-small-right"></i>
{% trans %}organization.menu.manage.user{% endtrans %}
</a>
</li>
<li>
<a href="{{ url('unitecms_core_organizationapikey_index', [unite.organization]) }}">
<i data-feather="lock" class="uk-margin-small-right"></i>
{% trans %}organization.menu.manage.api_keys{% endtrans %}
</a>
</li>
<!--li><a href="#">{% trans %}organization.menu.manage.delete{% endtrans %}</a></li-->
{% block manage_organization %}
<!--li><a href="#">{% trans %}organization.menu.manage.settings{% endtrans %}</a></li-->
<li>
<a href="{{ url('unitecms_core_organizationuser_index', [unite.organization]) }}">
<i data-feather="users" class="uk-margin-small-right"></i>
{% trans %}organization.menu.manage.user{% endtrans %}
</a>
</li>
<li>
<a href="{{ url('unitecms_core_organizationapikey_index', [unite.organization]) }}">
<i data-feather="lock" class="uk-margin-small-right"></i>
{% trans %}organization.menu.manage.api_keys{% endtrans %}
</a>
</li>
<!--li><a href="#">{% trans %}organization.menu.manage.delete{% endtrans %}</a></li-->
{% endblock manage_organization %}
</ul>
{% endif %}



<ul class="uk-nav">

{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\OrganizationVoter::UPDATE'), organization) and organization.missingDomainConfigIdentifiers|length > 0 %}
<li class="uk-nav-header uk-text-warning" title="{% trans %}organization.menu.new_domains_from_config.description{% endtrans %}" uk-tooltip>
{% trans %}organization.menu.new_domains_from_config.header{% endtrans %}
<i data-feather="help-circle"></i>
</li>
{% for identifier in organization.missingDomainConfigIdentifiers %}
<li>
<a class="uk-text-warning" href="{{ url('unitecms_core_domain_create', { organization: organization, import: identifier }) }}">
<i data-feather="plus-circle" class="uk-margin-small-right"></i>
{{ identifier }}
</a>
{% block new_domain_from_config %}
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\OrganizationVoter::UPDATE'), organization) and organization.missingDomainConfigIdentifiers|length > 0 %}
<li class="uk-nav-header uk-text-warning" title="{% trans %}organization.menu.new_domains_from_config.description{% endtrans %}" uk-tooltip>
{% trans %}organization.menu.new_domains_from_config.header{% endtrans %}
<i data-feather="help-circle"></i>
</li>
{% endfor %}
{% endif %}
{% for identifier in organization.missingDomainConfigIdentifiers %}
<li>
<a class="uk-text-warning" href="{{ url('unitecms_core_domain_create', { organization: organization, import: identifier }) }}">
<i data-feather="plus-circle" class="uk-margin-small-right"></i>
{{ identifier }}
</a>
</li>
{% endfor %}
{% endif %}
{% endblock new_domain_from_config %}

<li class="uk-nav-header">{% trans %}organization.menu.domains.header{% endtrans %}</li>

{% for domain in unite.organization.domains %}
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\DomainVoter::VIEW'), domain) %}
<li>
<a href="{{ url('unitecms_core_domain_view', [domain]) }}">
<i data-feather="globe" class="uk-margin-small-right"></i>
{{ domain }}
</a>
</li>
{% endif %}
{% endfor %}
{% block domain_list %}
{% for domain in unite.organization.domains %}
{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\DomainVoter::VIEW'), domain) %}
<li>
<a href="{{ url('unitecms_core_domain_view', [domain]) }}">
<i data-feather="globe" class="uk-margin-small-right"></i>
{{ domain }}
</a>
</li>
{% endif %}
{% endfor %}
{% endblock domain_list %}

{% if is_granted(constant('UniteCMS\\CoreBundle\\Security\\Voter\\OrganizationVoter::UPDATE'), organization) %}
<li>
Expand All @@ -75,7 +81,9 @@


</article>
<footer id="unite-main-menu-user" hidden>
<button type="button" uk-close uk-toggle="target: #unite-main-menu-user; animation: uk-animation-slide-top"></button>
{% include '@UniteCMSCore/_user-menu.html.twig' %}
</footer>
{% block footer %}
<footer id="unite-main-menu-user" hidden>
<button type="button" uk-close uk-toggle="target: #unite-main-menu-user; animation: uk-animation-slide-top"></button>
{% include '@UniteCMSCore/_user-menu.html.twig' %}
</footer>
{% endblock %}

0 comments on commit ad165c7

Please sign in to comment.