diff --git a/production/admin.py b/production/admin.py index 8d7fef8b4cc21ea13c156ee4a763b3f7f9dfa507..00de781beffebe4af20c88d3195249f9a977dabe 100644 --- a/production/admin.py +++ b/production/admin.py @@ -30,6 +30,11 @@ class ProductionStreamAdmin(GuardedModelAdmin): ) -admin.site.register(Proof) +class ProductionProofsAdmin(admin.ModelAdmin): + list_display = ['stream', 'version', 'status', 'accessible_for_authors'] + list_filter = ['status', 'accessible_for_authors'] + + +admin.site.register(Proof, ProductionProofsAdmin) admin.site.register(ProductionUser) admin.site.register(ProductionStream, ProductionStreamAdmin) diff --git a/production/models.py b/production/models.py index 84f7ea4a614362e06b10348a7d2bfe940493acc0..c04f85841a1f6e31859b269b1cd6903a3bee3aa1 100644 --- a/production/models.py +++ b/production/models.py @@ -117,11 +117,15 @@ class Proof(models.Model): objects = ProofsQuerySet.as_manager() class Meta: - ordering = ['version'] + ordering = ['stream', 'version'] def get_absolute_url(self): return reverse('production:proof_pdf', kwargs={'slug': self.slug}) + def __str__(self): + return 'Proof {version} for Stream {stream}'.format( + version=self.version, stream=self.stream.submission.title) + def save(self, *args, **kwargs): # Control Report count per Submission. if not self.version: diff --git a/production/templates/production/partials/production_stream_card.html b/production/templates/production/partials/production_stream_card.html index b495d127a56e28307a09af12a27ee61af1c94972..d171c8b6e08bafd630b193866200228b78670494 100644 --- a/production/templates/production/partials/production_stream_card.html +++ b/production/templates/production/partials/production_stream_card.html @@ -46,8 +46,17 @@ </div> </li> {% endif %} - {% if perms.scipost.can_upload_proofs and stream.status != 'accepted' and stream.status != 'completed' and stream.status != 'cited' %} - <li><a href="{% url 'production:upload_proofs' stream_id=stream.id %}">Upload Proofs</a></li> + {% if perms.scipost.can_upload_proofs and stream.status != 'accepted' and stream.status != 'completed' and stream.status != 'cited' and upload_proofs_form %} + <li> + <a href="javascript:;" data-toggle="toggle" data-target="#upload_proofs">Upload Proofs</a> + <div id="upload_proofs" style="display: none;"> + <form class="my-3" action="{% url 'production:upload_proofs' stream_id=stream.id %}" method="post" enctype="multipart/form-data"> + {% csrf_token %} + {{ upload_proofs_form|bootstrap_inline }} + <input type="submit" class="btn btn-outline-primary" name="submit" value="Upload"> + </form> + </div> + </li> {% endif %} {% if perms.scipost.can_publish_accepted_submission %} {% if not stream.submission.publication %} diff --git a/production/templates/production/proofs.html b/production/templates/production/proofs.html index dbd22466ab3c92b77d19bd47009fba54f9511780..cf469815995a8761a6e98661c93c2ef4dceb2a50 100644 --- a/production/templates/production/proofs.html +++ b/production/templates/production/proofs.html @@ -40,7 +40,7 @@ <li><a href="{% url 'production:send_proofs' proof.stream.id proof.version %}">Send proofs to authors</a></li> {% endif %} {% if proof.status != 'uploaded' %} - <li><a href="{% url 'production:toggle_accessibility' proof.stream.id proof.version %}">{{ proof.accessible_for_authors|yesno:'Make accessible,Hide' }} for authors</a></li> + <li><a href="{% url 'production:toggle_accessibility' proof.stream.id proof.version %}">{{ proof.accessible_for_authors|yesno:'Hide,Make accessible' }} for authors</a></li> {% endif %} {% endif %} </ul> diff --git a/production/views.py b/production/views.py index 168eb2e49988249fa7d87acb9b2cb46b59ca5aeb..4e5ee983259ff9b23275bcd168d2ac3de85b0363 100644 --- a/production/views.py +++ b/production/views.py @@ -86,6 +86,7 @@ def stream(request, stream_id): prodevent_form = ProductionEventForm() assign_officer_form = AssignOfficerForm() assign_supervisor_form = AssignSupervisorForm() + upload_proofs_form = ProofUploadForm() status_form = StreamStatusForm(instance=stream, production_user=request.user.production_user) context = { @@ -94,6 +95,7 @@ def stream(request, stream_id): 'assign_officer_form': assign_officer_form, 'assign_supervisor_form': assign_supervisor_form, 'status_form': status_form, + 'upload_proofs_form': upload_proofs_form, } if request.GET.get('json'):