Skip to content

Commit

Permalink
finalize export table view
Browse files Browse the repository at this point in the history
TODO :
* csv file export
  • Loading branch information
noodle69 committed Jan 7, 2018
1 parent 13323af commit bc70f62
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/bundle/DependencyInjection/EdgarEzUIAuditExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

use Edgar\EzUIAudit\Audit\AuditInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

class EdgarEzUIAuditExtension extends Extension
class EdgarEzUIAuditExtension extends Extension implements PrependExtensionInterface
{
public function load(array $configs, ContainerBuilder $container)
{
Expand All @@ -23,4 +24,9 @@ public function load(array $configs, ContainerBuilder $container)

$loader->load('services.yml');
}

public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig('assetic', array('bundles' => array('EdgarEzUIAuditBundle')));
}
}
29 changes: 29 additions & 0 deletions src/bundle/Resources/public/js/edgarezuiaudit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
(function () {
const iconsAuditExportUp = document.querySelectorAll('a.audit-export-up');
const iconAuditExportDown = document.querySelectorAll('a.audit-export-down');

const exportUp = (event) => {
event.preventDefault();
const svgUp = event.currentTarget.querySelector('.ez-icon-caret-up');
const svgDown = event.currentTarget.querySelector('.ez-icon-caret-down');
svgDown.style.display = "none";
svgUp.style.display = "block";
event.currentTarget.parentNode.parentNode.nextElementSibling.style.display = "table-row";
event.currentTarget.removeEventListener('click', exportUp);
event.currentTarget.addEventListener('click', exportDown, false)
};

const exportDown = (event) => {
event.preventDefault();
const svgUp = event.currentTarget.querySelector('.ez-icon-caret-up');
const svgDown = event.currentTarget.querySelector('.ez-icon-caret-down');
svgDown.style.display = "block";
svgUp.style.display = "none";
event.currentTarget.parentNode.parentNode.nextElementSibling.style.display = "none";
event.currentTarget.removeEventListener('click', exportDown);
event.currentTarget.addEventListener('click', exportUp, false)
};

iconsAuditExportUp.forEach(icon => icon.addEventListener('click', exportUp, false));
iconAuditExportDown.forEach(icon => icon.addEventListener('click', exportDown, false));
})();
10 changes: 9 additions & 1 deletion src/bundle/Resources/views/audit/export.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
<tr>
<th>{{ 'export.user_id'|trans|desc('User ID') }}</th>
<th>{{ 'export.user_name'|trans|desc('User name') }}</th>
<th>{{ 'export.audits'|trans|desc('Audits') }}</th>
<th>{{ 'export.date_start'|trans|desc('Date start') }}</th>
<th>{{ 'export.date_end'|trans|desc('Date end') }}</th>
<th>{{ 'export.date'|trans|desc('Date') }}</th>
<th>{{ 'export.status'|trans|desc('Status') }}</th>
<th>{{ 'export.file'|trans|desc('File') }}</th>
<th></th>
</tr>
</thead>
<tbody>
Expand All @@ -64,3 +64,11 @@
{% endif %}
</section>
{% endblock %}

{% block javascripts %}
{% javascripts
'@EdgarEzUIAuditBundle/Resources/public/js/edgarezuiaudit.js'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
21 changes: 20 additions & 1 deletion src/bundle/Resources/views/audit/export/table_row.html.twig
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
<tr>
<td>{{ row.user_id }}</td>
<td>{{ row.user_name }}</td>
<td></td>
<td>{{ row.date_start|date('M d, Y') }}</td>
<td>{{ row.date_end|date('M d, Y') }}</td>
<td>{{ row.date|date('M d, Y') }}</td>
<td>{{ row.status }}</td>
<td>{{ row.file }}</td>
<td>
<a href="#" class="audit-export audit-export-up">
<svg class="ez-icon ez-icon-caret-down">
<use xlink:href="{{ asset('bundles/ezplatformadminui/img/ez-icons.svg') }}#caret-down"></use>
</svg>
<svg class="ez-icon ez-icon-caret-up" style="display:none;">
<use xlink:href="{{ asset('bundles/ezplatformadminui/img/ez-icons.svg') }}#caret-up"></use>
</svg>
</a>
</td>
</tr>
<tr style="display:none;">
<th>{{ 'export.audits'|trans|desc('Audits') }}</th>
<td colspan="7">
<ul>
{% for audit in row.audits %}
<li>{{ audit }}</li>
{% endfor %}
</ul>
</td>
</tr>

0 comments on commit bc70f62

Please sign in to comment.