mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Save and edit next button appears on documents without viewer as well.
Made the new recent correspondents filter optional. Disabled by default.
This commit is contained in:
parent
0dc3644cc1
commit
8d003a6a85
@ -94,6 +94,7 @@ class RecentCorrespondentFilter(admin.RelatedFieldListFilter):
|
||||
|
||||
def field_choices(self, field, request, model_admin):
|
||||
lookups = []
|
||||
if settings.PAPERLESS_RECENT_CORRESPONDENT_YEARS and settings.PAPERLESS_RECENT_CORRESPONDENT_YEARS > 0:
|
||||
date_limit = datetime.now() - timedelta(days=365*settings.PAPERLESS_RECENT_CORRESPONDENT_YEARS)
|
||||
for c in Correspondent.objects.filter(documents__created__gte = date_limit).distinct():
|
||||
lookups.append( (c.id, c.name) )
|
||||
|
5
src/documents/templates/admin/documents/document/change_form.html
Executable file → Normal file
5
src/documents/templates/admin/documents/document/change_form.html
Executable file → Normal file
@ -4,7 +4,7 @@
|
||||
|
||||
{{ block.super }}
|
||||
|
||||
{% if file_type in "pdf jpg png" %}
|
||||
{% if file_type in "asd" %}
|
||||
|
||||
<div id="change_form_twocolumn_parent">
|
||||
<div id="change_form_form_parent"></div>
|
||||
@ -23,6 +23,8 @@
|
||||
django.jQuery("#content-main").append(django.jQuery("#change_form_twocolumn_parent"));
|
||||
</script>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if next_object %}
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
(function($){
|
||||
@ -33,7 +35,6 @@
|
||||
})(django.jQuery);
|
||||
//]]></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
|
1
src/documents/templates/admin/documents/document/viewers/viewer_image.html
Executable file → Normal file
1
src/documents/templates/admin/documents/document/viewers/viewer_image.html
Executable file → Normal file
@ -1,2 +1 @@
|
||||
<img src="{{download_url}}" style="max-width: 100%">
|
||||
|
||||
|
11
src/documents/templates/admin/documents/document/viewers/viewer_pdf.html
Executable file → Normal file
11
src/documents/templates/admin/documents/document/viewers/viewer_pdf.html
Executable file → Normal file
@ -15,6 +15,7 @@
|
||||
</div>
|
||||
<script type="text/javascript" src="{% static 'documents/js/pdf.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'documents/js/pdf.worker.js' %}"></script>
|
||||
|
||||
{# Load and display PDF document#}
|
||||
<script>
|
||||
var pdfjsLib = window['pdfjs-dist/build/pdf'];
|
||||
@ -57,6 +58,7 @@ var pdfDoc = null,
|
||||
// Update page counters
|
||||
document.getElementById('page_num').textContent = num;
|
||||
}
|
||||
|
||||
/**
|
||||
* If another page rendering in progress, waits until the rendering is
|
||||
* finised. Otherwise, executes rendering immediately.
|
||||
@ -68,6 +70,7 @@ var pdfDoc = null,
|
||||
renderPage(num);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays previous page.
|
||||
*/
|
||||
@ -78,7 +81,9 @@ var pdfDoc = null,
|
||||
pageNum--;
|
||||
queueRenderPage(pageNum);
|
||||
}
|
||||
|
||||
document.getElementById('prev').addEventListener('click', onPrevPage);
|
||||
|
||||
/**
|
||||
* Displays next page.
|
||||
*/
|
||||
@ -89,7 +94,9 @@ var pdfDoc = null,
|
||||
pageNum++;
|
||||
queueRenderPage(pageNum);
|
||||
}
|
||||
|
||||
document.getElementById('next').addEventListener('click', onNextPage);
|
||||
|
||||
/**
|
||||
* Displays next page.
|
||||
*/
|
||||
@ -97,7 +104,9 @@ var pdfDoc = null,
|
||||
scale *= 1.2;
|
||||
queueRenderPage(pageNum);
|
||||
}
|
||||
|
||||
document.getElementById('zoomin').addEventListener('click', onZoomIn);
|
||||
|
||||
/**
|
||||
* Displays next page.
|
||||
*/
|
||||
@ -105,7 +114,9 @@ var pdfDoc = null,
|
||||
scale /= 1.2;
|
||||
queueRenderPage(pageNum);
|
||||
}
|
||||
|
||||
document.getElementById('zoomout').addEventListener('click', onZoomOut);
|
||||
|
||||
/**
|
||||
* Asynchronously downloads PDF.
|
||||
*/
|
||||
|
@ -298,4 +298,8 @@ FY_END = os.getenv("PAPERLESS_FINANCIAL_YEAR_END")
|
||||
# Specify the default date order (for autodetected dates)
|
||||
DATE_ORDER = os.getenv("PAPERLESS_DATE_ORDER", "DMY")
|
||||
|
||||
PAPERLESS_RECENT_CORRESPONDENT_YEARS = int(os.getenv("PAPERLESS_RECENT_CORRESPONDENT_YEARS", 1))
|
||||
# Specify for how many years a correspondent is considered recent. Recent
|
||||
# correspondents will be shown in a separate "Recent correspondents" filter as
|
||||
# well. Set to 0 to disable this filter.
|
||||
PAPERLESS_RECENT_CORRESPONDENT_YEARS = int(os.getenv(
|
||||
"PAPERLESS_RECENT_CORRESPONDENT_YEARS", 0))
|
||||
|
Loading…
x
Reference in New Issue
Block a user