Skip to content

Commit

Permalink
Added additional extension points for standard_layout
Browse files Browse the repository at this point in the history
  • Loading branch information
elHornair committed Sep 12, 2016
1 parent 317fd55 commit a999372
Showing 1 changed file with 41 additions and 35 deletions.
76 changes: 41 additions & 35 deletions Resources/views/standard_layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -37,44 +37,50 @@ file that was distributed with this source code.
{% endblock %}

{% block javascripts %}
<script>
window.SONATA_CONFIG = {
CONFIRM_EXIT: {% if sonata_admin.adminPool.getOption('confirm_exit') %}true{% else %}false{% endif %},
USE_SELECT2: {% if sonata_admin.adminPool.getOption('use_select2') %}true{% else %}false{% endif %},
USE_ICHECK: {% if sonata_admin.adminPool.getOption('use_icheck') %}true{% else %}false{% endif %},
USE_STICKYFORMS: {% if sonata_admin.adminPool.getOption('use_stickyforms') %}true{% else %}false{% endif %}
};
window.SONATA_TRANSLATIONS = {
CONFIRM_EXIT: '{{ 'confirm_exit'|trans({}, 'SonataAdminBundle')|escape('js') }}'
};
// http://getbootstrap.com/getting-started/#support-ie10-width
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement('style');
msViewportStyle.appendChild(document.createTextNode('@-ms-viewport{width:auto!important}'));
document.querySelector('head').appendChild(msViewportStyle);
}
</script>

{% for javascript in sonata_admin.adminPool.getOption('javascripts', []) %}
<script src="{{ asset(javascript) }}"></script>
{% endfor %}

{% set locale = app.request.locale %}
{# localize moment #}
{% if locale[:2] != 'en' %}
<script src="{{ asset('bundles/sonatacore/vendor/moment/locale/' ~ locale|replace({'_':'-'}) ~ '.js') }}"></script>
{% endif %}
{% block javascripts_sonata_config %}
<script>
window.SONATA_CONFIG = {
CONFIRM_EXIT: {% if sonata_admin.adminPool.getOption('confirm_exit') %}true{% else %}false{% endif %},
USE_SELECT2: {% if sonata_admin.adminPool.getOption('use_select2') %}true{% else %}false{% endif %},
USE_ICHECK: {% if sonata_admin.adminPool.getOption('use_icheck') %}true{% else %}false{% endif %},
USE_STICKYFORMS: {% if sonata_admin.adminPool.getOption('use_stickyforms') %}true{% else %}false{% endif %}
};
window.SONATA_TRANSLATIONS = {
CONFIRM_EXIT: '{{ 'confirm_exit'|trans({}, 'SonataAdminBundle')|escape('js') }}'
};
// http://getbootstrap.com/getting-started/#support-ie10-width
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement('style');
msViewportStyle.appendChild(document.createTextNode('@-ms-viewport{width:auto!important}'));
document.querySelector('head').appendChild(msViewportStyle);
}
</script>
{% endblock %}

{% block javascripts_sonata_pool %}
{% for javascript in sonata_admin.adminPool.getOption('javascripts', []) %}
<script src="{{ asset(javascript) }}"></script>
{% endfor %}
{% endblock %}

{% block javascripts_sonata_localised %}
{% set locale = app.request.locale %}
{# localize moment #}
{% if locale[:2] != 'en' %}
<script src="{{ asset('bundles/sonatacore/vendor/moment/locale/' ~ locale|replace({'_':'-'}) ~ '.js') }}"></script>
{% endif %}

{# localize select2 #}
{% if sonata_admin.adminPool.getOption('use_select2') %}
{% if locale == 'pt' %}{% set locale = 'pt_PT' %}{% endif %}
{# localize select2 #}
{% if sonata_admin.adminPool.getOption('use_select2') %}
{% if locale == 'pt' %}{% set locale = 'pt_PT' %}{% endif %}

{# omit default EN locale #}
{% if locale[:2] != 'en' %}
<script src="{{ asset('bundles/sonatacore/vendor/select2/select2_locale_' ~ locale|replace({'_':'-'}) ~ '.js') }}"></script>
{# omit default EN locale #}
{% if locale[:2] != 'en' %}
<script src="{{ asset('bundles/sonatacore/vendor/select2/select2_locale_' ~ locale|replace({'_':'-'}) ~ '.js') }}"></script>
{% endif %}
{% endif %}
{% endif %}
{% endblock %}
{% endblock %}

<title>
Expand Down

0 comments on commit a999372

Please sign in to comment.