From 1b0c54b0d1de1ca3480797cf00d960edcb9fc770 Mon Sep 17 00:00:00 2001 From: Andy Byers Date: Tue, 23 Sep 2025 11:25:35 +0100 Subject: [PATCH 1/2] feat: adds datatable to section editor table on dash --- src/core/views.py | 8 ++++---- src/templates/admin/core/dashboard.html | 3 ++- src/templates/admin/elements/datatables.html | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/views.py b/src/core/views.py index 023c8c5c2f..2fea9c682f 100755 --- a/src/core/views.py +++ b/src/core/views.py @@ -6,7 +6,7 @@ from importlib import import_module import json -from urllib.parse import unquote, urlencode +from urllib.parse import urlencode import pytz import time import warnings @@ -16,12 +16,11 @@ from django.contrib.auth import authenticate, logout, login from django.contrib.auth.decorators import login_required from django.core.cache import cache -from django.urls import NoReverseMatch, reverse, reverse_lazy +from django.urls import NoReverseMatch, reverse from django.shortcuts import render, get_object_or_404, redirect, Http404 from django.utils import timezone from django.utils.decorators import method_decorator from django.http import HttpResponse, QueryDict -from django.contrib.messages.views import SuccessMessageMixin from django.contrib.sessions.models import Session from django.core.validators import validate_email from django.core.exceptions import ValidationError @@ -29,7 +28,6 @@ from django.conf import settings as django_settings from django.views.decorators.http import require_POST from django.views.decorators.csrf import ensure_csrf_cookie -from django.views.generic import CreateView, UpdateView, DeleteView from django.contrib.contenttypes.models import ContentType from django.utils.translation import gettext_lazy as _ from django.utils.html import mark_safe @@ -817,6 +815,8 @@ def dashboard(request): editor=request.user, editor_type="section-editor", article__journal=request.journal, + ).order_by( + '-article__date_submitted', ) # TODO: Move most of this to model logic. diff --git a/src/templates/admin/core/dashboard.html b/src/templates/admin/core/dashboard.html index 0460d5524a..77ed4951d5 100644 --- a/src/templates/admin/core/dashboard.html +++ b/src/templates/admin/core/dashboard.html @@ -178,7 +178,7 @@

Proofing Corrections

Section Editor

- +
@@ -221,4 +221,5 @@

Section Editor

{% if published_submissions %}{% include "admin/elements/datatables.html" with target="#published" sort=2 order="desc" %}{% endif %} {% include "admin/elements/datatables.html" with target="#active" sort=2 order="desc" %} {% include "admin/elements/datatables.html" with target="#incomplete" sort=2 order="desc" %} + {% include "admin/elements/datatables.html" with target="#section-editor-articles" sort=3 order="desc" save_state=True %} {% endblock %} \ No newline at end of file diff --git a/src/templates/admin/elements/datatables.html b/src/templates/admin/elements/datatables.html index 399e22a2a5..8a4c5e7f12 100644 --- a/src/templates/admin/elements/datatables.html +++ b/src/templates/admin/elements/datatables.html @@ -7,6 +7,7 @@ $(document).ready(function() { '{{ target }}'.split(' ').forEach(target => { $(target).DataTable({ + {% if save_state %}"stateSave": true,{% endif %} "lengthMenu": [[25, 50, 10, 5, -1], [25, 50, 10, 5, "All"]], {% if hide_length %}"bLengthChange": false,{% endif %} {% if hide_page %}"bPaginate": false,{% endif %} From f32c259ad184808375c39c0b8596b5f087f5a9bb Mon Sep 17 00:00:00 2001 From: Andy Byers Date: Tue, 23 Sep 2025 11:36:28 +0100 Subject: [PATCH 2/2] fmt: ruff formating --- src/core/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/views.py b/src/core/views.py index 2fea9c682f..26d7b6f6e9 100755 --- a/src/core/views.py +++ b/src/core/views.py @@ -816,7 +816,7 @@ def dashboard(request): editor_type="section-editor", article__journal=request.journal, ).order_by( - '-article__date_submitted', + "-article__date_submitted", ) # TODO: Move most of this to model logic.
ID