Skip to content

Commit 1b0c54b

Browse files
committed
feat: adds datatable to section editor table on dash
1 parent 53f0f43 commit 1b0c54b

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/core/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from importlib import import_module
88
import json
9-
from urllib.parse import unquote, urlencode
9+
from urllib.parse import urlencode
1010
import pytz
1111
import time
1212
import warnings
@@ -16,20 +16,18 @@
1616
from django.contrib.auth import authenticate, logout, login
1717
from django.contrib.auth.decorators import login_required
1818
from django.core.cache import cache
19-
from django.urls import NoReverseMatch, reverse, reverse_lazy
19+
from django.urls import NoReverseMatch, reverse
2020
from django.shortcuts import render, get_object_or_404, redirect, Http404
2121
from django.utils import timezone
2222
from django.utils.decorators import method_decorator
2323
from django.http import HttpResponse, QueryDict
24-
from django.contrib.messages.views import SuccessMessageMixin
2524
from django.contrib.sessions.models import Session
2625
from django.core.validators import validate_email
2726
from django.core.exceptions import ValidationError
2827
from django.db import IntegrityError
2928
from django.conf import settings as django_settings
3029
from django.views.decorators.http import require_POST
3130
from django.views.decorators.csrf import ensure_csrf_cookie
32-
from django.views.generic import CreateView, UpdateView, DeleteView
3331
from django.contrib.contenttypes.models import ContentType
3432
from django.utils.translation import gettext_lazy as _
3533
from django.utils.html import mark_safe
@@ -817,6 +815,8 @@ def dashboard(request):
817815
editor=request.user,
818816
editor_type="section-editor",
819817
article__journal=request.journal,
818+
).order_by(
819+
'-article__date_submitted',
820820
)
821821

822822
# TODO: Move most of this to model logic.

src/templates/admin/core/dashboard.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ <h2>Proofing Corrections</h2>
178178
<h2>Section Editor</h2>
179179
</div>
180180
<div class="content">
181-
<table class="scroll">
181+
<table id="section-editor-articles" class="scroll">
182182
<thead>
183183
<tr>
184184
<th>ID</th>
@@ -221,4 +221,5 @@ <h2>Section Editor</h2>
221221
{% if published_submissions %}{% include "admin/elements/datatables.html" with target="#published" sort=2 order="desc" %}{% endif %}
222222
{% include "admin/elements/datatables.html" with target="#active" sort=2 order="desc" %}
223223
{% include "admin/elements/datatables.html" with target="#incomplete" sort=2 order="desc" %}
224+
{% include "admin/elements/datatables.html" with target="#section-editor-articles" sort=3 order="desc" save_state=True %}
224225
{% endblock %}

src/templates/admin/elements/datatables.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
$(document).ready(function() {
88
'{{ target }}'.split(' ').forEach(target => {
99
$(target).DataTable({
10+
{% if save_state %}"stateSave": true,{% endif %}
1011
"lengthMenu": [[25, 50, 10, 5, -1], [25, 50, 10, 5, "All"]],
1112
{% if hide_length %}"bLengthChange": false,{% endif %}
1213
{% if hide_page %}"bPaginate": false,{% endif %}

0 commit comments

Comments
 (0)