Start work on export

For now:
 - ebook
 - mobi
 - pdf
 - csv
This commit is contained in:
Thomas Citharel
2015-10-15 20:06:59 +02:00
committed by Nicolas Lœuillet
parent f1eccfd63f
commit 03690d1387
8 changed files with 715 additions and 14 deletions

View File

@ -91,6 +91,24 @@
{% endfor %}
</ul>
<!-- Export -->
<div id="export" class="side-nav fixed right-aligned">
{% set currentRoute = app.request.attributes.get('_route') %}
{% if currentRoute == 'homepage' %}
{% set currentRoute = 'unread' %}
{% endif %}
<h4 class="center">{% trans %}Export{% endtrans %}</h4>
<ul>
<li class="bold"><a class="waves-effect" href="{{ path('ebook', { 'category': currentRoute, 'format': 'epub' }) }}">{% trans %}EPUB{% endtrans %}</a></li>
<li class="bold"><a class="waves-effect" href="{{ path('ebook', { 'category': currentRoute, 'format': 'mobi' }) }}">{% trans %}MOBI{% endtrans %}</a></li>
<li class="bold"><a class="waves-effect" href="{{ path('ebook', { 'category': currentRoute, 'format': 'pdf' }) }}">{% trans %}PDF{% endtrans %}</a></li>
<li class="bold"><del><a class="waves-effect" href="{{ path('ebook', { 'category': currentRoute, 'format': 'xml' }) }}">{% trans %}XML{% endtrans %}</a></del></li>
<li class="bold"><del><a class="waves-effect" href="{{ path('ebook', { 'category': currentRoute, 'format': 'json' }) }}">{% trans %}JSON{% endtrans %}</a></del></li>
<li class="bold"><a class="waves-effect" href="{{ path('ebook', { 'category': currentRoute, 'format': 'csv' }) }}">{% trans %}CSV{% endtrans %}</a></li>
<li class="bold"><del><a class="waves-effect" href="{{ path('ebook', { 'category': currentRoute, 'format': 'txt' }) }}">{% trans %}TXT{% endtrans %}</a></del></li>
</ul>
</div>
<!-- Filters -->
<div id="filters" class="side-nav fixed right-aligned">
<form action="{{ path('all') }}">

View File

@ -102,13 +102,14 @@
<li class="bold">
<a class="waves-effect collapsible-header">
<i class="mdi-file-file-download small"></i>
<span><del>{% trans %}Download{% endtrans %}</del></span>
<span>{% trans %}Download{% endtrans %}</span>
</a>
<div class="collapsible-body">
<ul>
{% if export_epub %}<li><del><a href="?epub&amp;method=id&amp;value={{ entry.id }}" title="Generate ePub file">EPUB</a></del></li>{% endif %}
{% if export_mobi %}<li><del><a href="?mobi&amp;method=id&amp;value={{ entry.id }}" title="Generate Mobi file">MOBI</a></del></li>{% endif %}
{% if export_pdf %}<li><del><a href="?pdf&amp;method=id&amp;value={{ entry.id }}" title="Generate PDF file">PDF</a></del> </li>{% endif %}
{% if export_epub %}<li><a href="{{ path('ebook_entry', { 'id': entry.id, 'format': 'epub' }) }}" title="Generate ePub file">EPUB</a></li>{% endif %}
{% if export_mobi %}<li><a href="{{ path('ebook_entry', { 'id': entry.id, 'format': 'mobi' }) }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
{% if export_pdf %}<li><a href="{{ path('ebook_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %}
<li><a href="{{ path('ebook_entry', { 'id': entry.id, 'format': 'csv' }) }}" title="Generate CSV file">CSV</a></li>
</ul>
</div>
</li>

View File

@ -59,6 +59,7 @@
<li class="bold"><a title="{% trans %}Add a new entry{% endtrans %}" class="waves-effect" href="{{ path('new') }}" id="nav-btn-add"><i class="mdi-content-add"></i></a></li>
<li><a title="{% trans %}Search{% endtrans %}" class="waves-effect" href="javascript: void(null);" id="nav-btn-search"><i class="mdi-action-search"></i></a>
<li id="button_filters"><a title="{% trans %}Filter entries{% endtrans %}" href="#" data-activates="filters" class="nav-panel-menu button-collapse-right"><i class="mdi-content-filter-list"></i></a></li>
<li id="button_export"><a title="{% trans %}Export{% endtrans %}" class="nav-panel-menu button-collapse-right" href="#" data-activates="export" class="nav-panel-menu button-collapse-right"><i class="mdi-file-file-download"></i></a></li>
</ul>
</div>
<form method="get" action="index.php">

View File

@ -11,6 +11,14 @@ function init_filters() {
}
}
function init_export() {
// no display if export not aviable
if ($("div").is("#export")) {
$('#button_export').show();
$('.button-collapse-right').sideNav({ edge: 'right' });
}
}
$(document).ready(function(){
// sideNav
$('.button-collapse').sideNav();
@ -26,6 +34,7 @@ $(document).ready(function(){
format: 'dd/mm/yyyy',
});
init_filters();
init_export();
$('#nav-btn-add-tag').on('click', function(){
$(".nav-panel-add-tag").toggle(100);