Skip to content

Commit

Permalink
Copy over default site bundle templates
Browse files Browse the repository at this point in the history
  • Loading branch information
emodric committed Nov 9, 2022
1 parent 316aee5 commit 4759cee
Show file tree
Hide file tree
Showing 12 changed files with 194 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/app/packages/templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ parameters:
ngsite.default.template.errors.500: "@@ibexadesign/errors/500.html.twig"
ngsite.default.template.errors.default: "@@ibexadesign/errors/default.html.twig"

ngsite.default.template.pagerfanta.ngsite: "@@ibexadesign/pagerfanta/ngsite.html.twig"
ngsite.default.template.search: "@@ibexadesign/search/search.html.twig"

ngsite.default.template.menu: '@@ibexadesign/menu.html.twig'
8 changes: 4 additions & 4 deletions templates/themes/app/pagelayout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
{% endblock %}

{% block open_graph %}
{% include '@NetgenSite/parts/opengraph.html.twig' %}
{% include '@ibexadesign/parts/opengraph.html.twig' %}
{% endblock %}

{{ nglayouts_template_plugin('preview.javascripts') }}

{% include '@NetgenSite/parts/google_tag_manager_code_script.html.twig' %}
{% include '@ibexadesign/parts/google_tag_manager_code_script.html.twig' %}

{% block structuredData %}{% endblock %}
</head>
<body>

{% include '@NetgenSite/parts/google_tag_manager_code_noscript.html.twig' %}
{% include '@NetgenSite/parts/facebook_api.html.twig' %}
{% include '@ibexadesign/parts/google_tag_manager_code_noscript.html.twig' %}
{% include '@ibexadesign/parts/facebook_api.html.twig' %}

<div id="page"{% if page_css_class|default is not empty %} class="{{ page_css_class }}"{% endif %}{% if location is defined and location is not empty %} data-path='["{{ location.path|join('","') }}"]'{% endif %}>
{% block layout %}
Expand Down
66 changes: 66 additions & 0 deletions templates/themes/common/pagerfanta/ngsite.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{% trans_default_domain 'ngsite' %}

<nav class="page-navigation">
<ul>

{# First page link (for mobile) #}
{% if pages.mobile_first_page %}
<li class="page-item d-block d-xs-none"><a href="{{ pages.mobile_first_page }}" class="page-link"><i class="fa fa-angle-double-left"></i></a></li>
{% endif %}

{# Previous page link #}
{% if pages.previous_page %}
<li class="page-item"><a href="{{ pages.previous_page }}" class="page-link" rel="prev">{{ 'pagination.previous'|trans }}</a></li>
{% endif %}

{# First page link #}
{% if pages.first_page %}
<li class="page-item d-none d-xs-block"><a href="{{ pages.first_page }}" class="page-link">1</a></li>
{% endif %}

{# Second page link #}
{% if pages.second_page %}
<li class="page-item d-none d-xs-block"><a href="{{ pages.second_page }}" class="page-link">2</a></li>
{% endif %}

{# Dots if start is over 3 #}
{% if pages.separator_before %}
<li class="page-item disabled d-none d-xs-block"><span class="page-link page-link-separate">...</span></li>
{% endif %}

{# Middle pages #}
{% for page, page_url in pages.middle_pages %}
{% if page == pager.currentPage %}
<li class="page-item current"><span class="page-link">{{ page }}<span class="d-inline d-xs-none"> of {{ pager.nbPages }}</span></span></li>
{% else %}
<li class="page-item d-none d-xs-block"><a href="{{ page_url }}" class="page-link">{{ page }}</a></li>
{% endif %}
{% endfor %}

{# Dots if end is under 3 to last #}
{% if pages.separator_after %}
<li class="page-item disabled d-none d-xs-block"><span class="page-link page-link-separate">...</span></li>
{% endif %}

{# Second to last page link #}
{% if pages.second_to_last_page %}
<li class="page-item d-none d-xs-block"><a href="{{ pages.second_to_last_page }}" class="page-link">{{ pager.nbPages - 1 }}</a></li>
{% endif %}

{# Last page link #}
{% if pages.last_page %}
<li class="page-item d-none d-xs-block"><a href="{{ pages.last_page }}" class="page-link">{{ pager.nbPages }}</a></li>
{% endif %}

{# Next page link #}
{% if pages.next_page %}
<li class="page-item"><a href="{{ pages.next_page }}" class="page-link" rel="next">{{ 'pagination.next'|trans }}</a></li>
{% endif %}

{# Last page link (for mobile) #}
{% if pages.mobile_last_page %}
<li class="page-item d-block d-xs-none"><a href="{{ pages.mobile_last_page }}" class="page-link"><i class="fa fa-angle-double-right"></i></a></li>
{% endif %}

</ul>
</nav>
2 changes: 1 addition & 1 deletion templates/themes/common/parts/content_fields.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
{% set longitude = field.value.longitude|default(false) %}

{% include
'@NetgenSite/parts/google_maps.html.twig' with {
'@ibexadesign/parts/google_maps.html.twig' with {
'container_id': field.id,
'latitude': latitude,
'longitude': longitude,
Expand Down
33 changes: 33 additions & 0 deletions templates/themes/common/parts/facebook_api.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% if ibexa.configResolver.hasParameter('site_settings.facebook_api', 'ngsite')
and ibexa.configResolver.hasParameter('facebook_app_id', 'netgen_open_graph') %}
{% set facebook_api = ibexa.configResolver.getParameter('site_settings.facebook_api', 'ngsite') %}

{% if facebook_api %}
{% set facebook_app_id = ibexa.configResolver.getParameter('facebook_app_id', 'netgen_open_graph') %}
{% set facebook_locale = 'en_US' %}
{% if ibexa.configResolver.hasParameter('site_settings.facebook_locale', 'ngsite') %}
{% set facebook_locale = ibexa.configResolver.parameter('site_settings.facebook_locale', 'ngsite') %}
{% endif %}

{% if facebook_app_id is not empty and facebook_locale is not empty %}
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{{ facebook_app_id|raw|escape('js') }}',
autoLogAppEvents : true,
xfbml : true,
version : 'v2.12'
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/{{ facebook_locale|raw|escape('js') }}/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
{% endif %}
{% endif %}
{% endif %}
25 changes: 25 additions & 0 deletions templates/themes/common/parts/google_maps.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% include '@ibexadesign/parts/google_maps_init.html.twig' %}

{% set container_id = container_id|default(0) %}
{% set latitude = latitude|default(ibexa.configResolver.parameter('google_maps.latitude', 'ngsite')) %}
{% set longitude = longitude|default(ibexa.configResolver.parameter('google_maps.longitude', 'ngsite')) %}
{% set zoom = zoom|default(ibexa.configResolver.parameter('google_maps.zoom', 'ngsite')) %}
{% set map_type = map_type|default(ibexa.configResolver.parameter('google_maps.map_type', 'ngsite')) %}

<script type="text/javascript">
google.maps.event.addDomListener(window, 'load', function(){
initializeGoogleMaps({
containerId: "{{ container_id|raw|escape('js') }}",
latitude: {{ latitude|raw|escape('js') }},
longitude: {{ longitude|raw|escape('js') }},
zoom: {{ zoom|raw|escape('js') }},
mapType: "{{ map_type|raw|escape('js') }}"
});
});
</script>

<div
id="map-canvas-{{ container_id|raw|escape( 'js' ) }}"
class="google-maps"
style="height:{{ map_height|default(560)|raw|escape('js') }}px; width:100%;">
</div>
25 changes: 25 additions & 0 deletions templates/themes/common/parts/google_maps_init.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% if include_google_maps_script|default(false) %}
{% include '@ibexadesign/parts/google_maps_script.html.twig' %}
{% endif %}

<script type="text/javascript">
function initializeGoogleMaps( options ) {
var mapCenter = new google.maps.LatLng(
options.latitude > 90 || options.latitude < -90 ? defaults.latitude : options.latitude,
options.longitude > 180 || options.longitude < -180 ? defaults.longitude : options.longitude
);
var mapOptions = {
zoom: options.zoom > 21 || options.zoom < 0 ? defaults.zoom : options.zoom,
center: mapCenter,
mapTypeId: google.maps.MapTypeId[options.mapType]
};
var map = new google.maps.Map(document.getElementById('map-canvas-' + options.containerId), mapOptions);
var marker = new google.maps.Marker({
position: mapCenter,
map: map
});
}
</script>
3 changes: 3 additions & 0 deletions templates/themes/common/parts/google_maps_script.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% set google_maps_api_key = ibexa.configResolver.parameter('api_keys.google_maps')|default('') %}

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;key={{ google_maps_api_key }}"></script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% if ibexa.configResolver.hasParameter('site_settings.google_tag_manager_code', 'ngsite') %}
{% set google_tag_manager_code = ibexa.configResolver.getParameter('site_settings.google_tag_manager_code', 'ngsite') %}

{% if google_tag_manager_code is not empty %}
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ google_tag_manager_code|raw|escape('js') }}"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
{% endif %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% if ibexa.configResolver.hasParameter('site_settings.google_tag_manager_code', 'ngsite') %}
{% set google_tag_manager_code = ibexa.configResolver.getParameter('site_settings.google_tag_manager_code', 'ngsite') %}

{% if google_tag_manager_code is not empty %}
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{ google_tag_manager_code|raw|escape('js') }}');</script>
{% endif %}
{% endif %}
15 changes: 15 additions & 0 deletions templates/themes/common/parts/opengraph.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% if open_graph is defined %}
{% for key, value in open_graph %}
<meta property="{{ key|trim }}" content="{{ value|trim }}" />
{% endfor %}
{% endif %}

{% if content is defined %}
{% set meta_tags = get_netgen_open_graph(content.innerContent) %}

{% for meta_tag in meta_tags %}
{% if open_graph is not defined or open_graph[meta_tag.tagName] is not defined %}
<meta property="{{ meta_tag.tagName|trim }}" content="{{ meta_tag.tagValue|trim }}" />
{% endif %}
{% endfor %}
{% endif %}
2 changes: 2 additions & 0 deletions translations/ngsite.en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pagination.previous: 'Previous'
pagination.next: 'Next'

0 comments on commit 4759cee

Please sign in to comment.