@@ -57,7 +57,7 @@ Table_import() | |||
{ | |||
docker cp $IMPORT_TXT_FILE $CONTAINER:/tmp/import_file | |||
docker exec -i $CONTAINER bash -c "mysql -u $USERNAME -p$PASSWORD $DATABASE -e 'LOAD DATA LOCAL INFILE '\''/tmp/import_file'\'' REPLACE INTO TABLE $TABLE FIELDS TERMINATED BY '\''\t'\'' LINES TERMINATED BY '\''\n'\'' IGNORE 1 ROWS;'" | |||
docker exec -i $CONTAINER bash -c "mysql -u $USERNAME -p$PASSWORD $DATABASE -e 'LOAD DATA LOCAL INFILE '\''/tmp/import_file'\'' REPLACE INTO TABLE $TABLE FIELDS TERMINATED BY '\''\t'\'' LINES TERMINATED BY '\''\r'\'' IGNORE 1 ROWS;'" | |||
} | |||
Drop_table() |
@@ -35,7 +35,9 @@ def get_books(): | |||
practices_filter = Resource.query.filter_by(type='practice').with_entities(Resource.id, Resource.name) | |||
# year | |||
year_filter = get_filter_values('year', type) | |||
return render_template('resources.html', resources=books, type=type, practices_filter=practices_filter, year_filter=year_filter) | |||
# typology | |||
typology_filter = get_filter_values('typology', type) | |||
return render_template('resources.html', resources=books, type=type, practices_filter=practices_filter, year_filter=year_filter, typology_filter=typology_filter) | |||
# route for displaying a single book based on the ID in the database | |||
@book.route('/books/<int:book_id>') |
@@ -22,6 +22,16 @@ | |||
<div class="col"> | |||
<table class="table table-hover"> | |||
<tbody> | |||
{% if resource['typology'] %} | |||
<tr> | |||
<th> | |||
Typology category: | |||
</th> | |||
<td> | |||
<a href="{{ resource['typology'] }}">{{ resource['typology'] }}</a> | |||
</td> | |||
</tr> | |||
{% endif %} | |||
{% if resource['bookUrl'] %} | |||
<tr> | |||
<th> |
@@ -76,6 +76,32 @@ | |||
{% endif %} | |||
</div> | |||
<div class="row"> | |||
{% if typology_filter %} | |||
<div class="col-sm-6 d-md-block d-sm-none d-none"> | |||
<div class="filter-title">Typology category</div> | |||
<ul class="filter-items"> | |||
{% for typology in typology_filter %} | |||
<li {% if request.args.get('typology') == typology %} class="fw-bold"{% endif %}> | |||
<a href="/books?typology={{typology}}">{{ typology }}</a> | |||
</li> | |||
{% endfor %} | |||
</ul> | |||
</div> | |||
<div class="d-md-none accordion"> | |||
<div class="accordion-item"> | |||
<div class="filter-title accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#filter-typology">Typology category</div> | |||
<div class="accordion-body"> | |||
<ul id="filter-typology" class="collapse filter-items"> | |||
{% for typology in typology_filter %} | |||
<li {% if request.args.get('typology') == typology %} class="fw-bold"{% endif %}> | |||
<a href="/books?typology={{typology}}">{{ typology }}</a> | |||
</li> | |||
{% endfor %} | |||
</ul> | |||
</div> | |||
</div> | |||
</div> | |||
{% endif %} | |||
{% if languages_filter %} | |||
<div class="col-sm-6 d-md-block d-sm-none d-none"> | |||
<div class="filter-title">Scripting languages</div> |