Skip to content

Instantly share code, notes, and snippets.

@mickaelandrieu
Created June 6, 2019 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickaelandrieu/ca53081e19032628a16ce18c3e6ec3a5 to your computer and use it in GitHub Desktop.
Save mickaelandrieu/ca53081e19032628a16ce18c3e6ec3a5 to your computer and use it in GitHub Desktop.
{#**
* 2007-2019 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*#}
{% extends '@PrestaShop/Admin/layout.html.twig' %}
{% trans_default_domain "Admin.Advparameters.Feature" %}
{% import '@PrestaShop/Admin/macros.html.twig' as ps %}
{%
set smartyForm, debugModeForm, optionalFeaturesForm, combineCompressCacheForm, mediaServersForm, cachingForm, memcacheForm =
form.smarty, form.debug_mode, form.optional_features, form.ccc, form.media_servers, form.caching, form.add_memcache_server
%}
{% block content %}
{{ form_start(form, {'attr' : {'class': 'form'} }) }}
<div class="row justify-content-center">
{% block perfs_form_smarty_cache %}
{{ form(smartyForm) }}
{% endblock %}
{% block perfs_form_debug_mode %}
{{ form(debugModeForm) }}
{% endblock %}
{% block perfs_form_optional_features %}
{{ form(optionalFeaturesForm) }}
{% endblock %}
{% block perfs_form_ccc %}
{{ form(combineCompressCacheForm) }}
{% endblock %}
{% block perfs_form_media_servers %}
{{ form(mediaServersForm) }}
{% endblock %}
{% block perfs_form_caching %}
{{ form(cachingForm) }}
{% endblock %}
</div>
{{ form_end(form) }}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script src="{{ asset('themes/default/js/bundle/admin_parameters/performancePage.js') }}"></script>
<script>
var configuration = {
'addServerUrl': '{{ url('admin_servers_add')|e('js') }}',
'removeServerUrl': '{{ url('admin_servers_delete')|e('js') }}',
'testServerUrl': '{{ url('admin_servers_test')|e('js') }}'
};
var app = new PerformancePage(
configuration.addServerUrl,
configuration.removeServerUrl,
configuration.testServerUrl
);
window.addEventListener('load', function() {
var addServerBtn = document.getElementById('add-server-btn');
var testServerBtn = document.getElementById('test-server-btn');
addServerBtn.addEventListener('click', function(event) {
event.preventDefault();
app.addServer();
});
testServerBtn.addEventListener('click', function(event) {
event.preventDefault();
app.testServer();
});
});
</script>
<script src="{{ asset('themes/default/js/bundle/admin_parameters/performancePageUI.js') }}"></script>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment