Skip to content

Commit

Permalink
Merge pull request #123 from acdh-oeaw/122-remove-download-buttons-in…
Browse files Browse the repository at this point in the history
…-list-views

only logged in users can download #122
  • Loading branch information
csae8092 authored Oct 27, 2022
2 parents 152a42e + 6242a6a commit 9f4f37a
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 2 deletions.
77 changes: 77 additions & 0 deletions archiv/templates/archiv/generic_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{% extends "webpage/base.html" %}
{% load static %}
{% load django_tables2 %}
{% load browsing_extras %}
{% load crispy_forms_field %}
{% load crispy_forms_tags %}
{% block title %} Browse {{ class_name }} {% endblock %}
{% block scriptHeader %}

{% endblock %}
{% block content %}

<script type="text/javascript">
$(document).ready(function() {
var fetchedParameter = "{{ table.page.number }}";
$("#goto option").each(function() {
if($(this).text() == fetchedParameter) {
$(this).attr('selected', 'selected');
}
});
});
</script>
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<div class="card">
<div class="card-body">
<h3 style="margin-bottom:15px;">
Browse {% class_definition %} {% block list_title %}{% endblock %}
</h3>
{% if user.is_authenticated %}
{% if create_view_link %}
<a class ="btn btn-outline-secondary" href="{{ create_view_link }}">Create new {{ class_name }}</a>
{% endif %}
{% endif %}
{% block customView %}{% endblock %}
{% block create_button %}{% endblock %}
<!--Search mask-->
{% load django_tables2 crispy_forms_tags %}
<form action="." class="uniForm" method="get">
{% if togglable_colums %}
<legend>Select additional columns</legend>
{% column_selector %}
{% endif %}
<br/>
{% crispy filter.form filter.form.helper %}
</form>
<a class ="btn btn-outline-secondary" href=".">Reset search</a>
{% include 'browsing/partials/chart_form.html' %}
</div>
</div>
</div>
<div class="col-md-8" id="results">
<div class="card">
<div class="card-body table-responsive">
{% with table.paginator.count as total %}
<legend>Total results: {{ total }}</legend>
{% endwith %}
{% if user.is_authenticated %}
{% include 'browsing/partials/download_menu.html' %}
{% endif %}
{% block table %}
{% include 'browsing/partials/table.html' %}
{% endblock table %}
{% block pagination.allpages %}
{% include 'browsing/partials/pagination.html' %}
{% endblock pagination.allpages %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts2 %}
<script src="{% static 'browsing/js/set-form-attributes.js' %}"></script>
<script src="{% static 'browsing/js/filter-for-blank-fields.js' %}"></script>
{% endblock scripts2 %}
10 changes: 8 additions & 2 deletions archiv/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class UseCaseListView(GenericListView):
'id', 'quick_edit', 'title', 'principal_investigator',
]
enable_merge = False
template_name = 'archiv/generic_list.html'


class UseCaseDelete(DeleteView):
Expand Down Expand Up @@ -171,7 +172,7 @@ class SpatialCoverageListView(GenericListView):
'id', 'quick_edit', 'stelle', 'key_word',
]
enable_merge = False
# template_name = 'archiv/spatial_list.html'
template_name = 'archiv/generic_list.html'


class SpatialCoverageDelete(DeleteView):
Expand All @@ -194,6 +195,7 @@ class AutorListView(GenericListView):
'id', 'quick_edit', 'name',
]
enable_merge = False
template_name = 'archiv/generic_list.html'


class AutorDetailView(BaseDetailView):
Expand Down Expand Up @@ -242,7 +244,7 @@ class KeyWordListView(GenericListView):
'id', 'quick_edit', 'stichwort', 'wurzel', 'varianten'
]
enable_merge = False
# template_name = 'archiv/generic_list.html'
template_name = 'archiv/generic_list.html'


class KeyWordDetailView(BaseDetailView):
Expand Down Expand Up @@ -291,6 +293,7 @@ class OrtListView(GenericListView):
'id', 'quick_edit', 'name', 'long', 'lat'
]
enable_merge = False
template_name = 'archiv/generic_list.html'


class OrtDetailView(BaseDetailView):
Expand Down Expand Up @@ -339,6 +342,7 @@ class StelleListView(GenericListView):
'id', 'quick_edit', 'display_label',
]
enable_merge = False
template_name = 'archiv/generic_list.html'


class StelleDetailView(BaseDetailView):
Expand Down Expand Up @@ -389,6 +393,7 @@ class TextListView(GenericListView):
'id', 'quick_edit', 'title',
]
enable_merge = False
template_name = 'archiv/generic_list.html'


class TextDetailView(BaseDetailView):
Expand Down Expand Up @@ -437,6 +442,7 @@ class EventListView(GenericListView):
'id', 'quick_edit', 'title',
]
enable_merge = False
template_name = 'archiv/generic_list.html'


class EventDetailView(BaseDetailView):
Expand Down

0 comments on commit 9f4f37a

Please sign in to comment.