mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Add a fallback plugin handling twig
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Plugin\PluginMetadataInterface;
|
||||
use Alchemy\WebGalleryPlugin\Controller\BaseController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
@@ -1,60 +1 @@
|
||||
|
||||
{% extends app['request'].isXmlHttpRequest ? "admin/common/ajax_wrap.html.twig" : "admin/common/iframe_wrap.html.twig" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="page-header">
|
||||
<h1>{% trans 'plugin.name' plugin.localeTextDomain %}</h1>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" id="configurationTabs">
|
||||
{% for divId, configurationTab in configurationTabs %}
|
||||
{% set tabTitle = configurationTab.title %}
|
||||
<li role="presentation"><a href="#{{ divId }}" aria-controls="{{ divId }}" role="tab" data-toggle="tab" data-url="{{ configurationTab.url }}">{% trans tabTitle plugin.localeTextDomain %}</a></li>
|
||||
{% endfor %}
|
||||
<li role="presentation" class="active"><a href="#about" aria-controls="about" role="tab" data-toggle="tab">{% trans 'admin::plugins: about' %}</a></li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
{% for divId, configurationTab in configurationTabs %}
|
||||
<div role="tabpanel" class="tab-pane fade" id="{{ divId }}"></div>
|
||||
{% endfor %}
|
||||
<div role="tabpanel" class="tab-pane fade in active" id="about">
|
||||
<ul>
|
||||
<li>{{ 'admin::plugins: name'|trans }}{{ plugin.name }}</li>
|
||||
<li>{{ 'admin::plugins: version'|trans }}{{ plugin.version }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var contentsDownloaded = {};
|
||||
var remoteContent = function(url) {
|
||||
return $.get(url);
|
||||
};
|
||||
|
||||
var tabs = $('#configurationTabs a[data-toggle="tab"]');
|
||||
|
||||
tabs.on('show', function (e) {
|
||||
if (e.target.hash != '#about' && contentsDownloaded[e.target.hash] === undefined) {
|
||||
$(e.target.hash).empty().html('<img src="/skins/icons/main-loader.gif" alt="loading"/>');
|
||||
}
|
||||
});
|
||||
tabs.on('shown', function (e) {
|
||||
if (e.target.hash != '#about' && contentsDownloaded[e.target.hash] === undefined) {
|
||||
var targetDiv = $(e.target.hash);
|
||||
|
||||
remoteContent($(e.target).attr('data-url')).then(function(response) {
|
||||
targetDiv.empty().html(response);
|
||||
contentsDownloaded[e.target.hash] = true;
|
||||
}, function(error) {
|
||||
console.log(error);
|
||||
targetDiv.empty().html('<i class="icon-fire">{% trans 'admin::plugins: retrieveConfigurationError' %}</i>');
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% include ['@plugin-'~ plugin.name ~ '/admin/index.html.twig', '/admin/plugins/show_fallback.html.twig'] %}
|
||||
|
60
templates/web/admin/plugins/show_fallback.html.twig
Normal file
60
templates/web/admin/plugins/show_fallback.html.twig
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
{% extends app['request'].isXmlHttpRequest ? "admin/common/ajax_wrap.html.twig" : "admin/common/iframe_wrap.html.twig" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="page-header">
|
||||
<h1>{% trans 'plugin.name' plugin.localeTextDomain %}</h1>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" id="configurationTabs">
|
||||
{% for divId, configurationTab in configurationTabs %}
|
||||
{% set tabTitle = configurationTab.title %}
|
||||
<li role="presentation"><a href="#{{ divId }}" aria-controls="{{ divId }}" role="tab" data-toggle="tab" data-url="{{ configurationTab.url }}">{% trans tabTitle plugin.localeTextDomain %}</a></li>
|
||||
{% endfor %}
|
||||
<li role="presentation" class="active"><a href="#about" aria-controls="about" role="tab" data-toggle="tab">{% trans 'admin::plugins: about' %}</a></li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
{% for divId, configurationTab in configurationTabs %}
|
||||
<div role="tabpanel" class="tab-pane fade" id="{{ divId }}"></div>
|
||||
{% endfor %}
|
||||
<div role="tabpanel" class="tab-pane fade in active" id="about">
|
||||
<ul>
|
||||
<li>{{ 'admin::plugins: name'|trans }}{{ plugin.name }}</li>
|
||||
<li>{{ 'admin::plugins: version'|trans }}{{ plugin.version }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var contentsDownloaded = {};
|
||||
var remoteContent = function(url) {
|
||||
return $.get(url);
|
||||
};
|
||||
|
||||
var tabs = $('#configurationTabs a[data-toggle="tab"]');
|
||||
|
||||
tabs.on('show', function (e) {
|
||||
if (e.target.hash != '#about' && contentsDownloaded[e.target.hash] === undefined) {
|
||||
$(e.target.hash).empty().html('<img src="/skins/icons/main-loader.gif" alt="loading"/>');
|
||||
}
|
||||
});
|
||||
tabs.on('shown', function (e) {
|
||||
if (e.target.hash != '#about' && contentsDownloaded[e.target.hash] === undefined) {
|
||||
var targetDiv = $(e.target.hash);
|
||||
|
||||
remoteContent($(e.target).attr('data-url')).then(function(response) {
|
||||
targetDiv.empty().html(response);
|
||||
contentsDownloaded[e.target.hash] = true;
|
||||
}, function(error) {
|
||||
console.log(error);
|
||||
targetDiv.empty().html('<i class="icon-fire">{% trans 'admin::plugins: retrieveConfigurationError' %}</i>');
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user