Skip to content

Commit

Permalink
RC-5: Typesetters can now see images and download links for galleys.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrbyers authored and Andy Byers committed Oct 20, 2021
1 parent dfdacc5 commit 2d6a08a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
1 change: 1 addition & 0 deletions hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from plugins.typesetting import models


def author_tasks(context):
request = context['request']
article = context['article']
Expand Down
6 changes: 3 additions & 3 deletions templates/typesetting/elements/typesetter/galleys.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<td>{{ galley.file.date_modified|date:"Y-m-d G:i" }}</td>
<td>
<a class="button small" href="{% url 'typesetting_edit_galley' article.pk galley.pk %}?return={% url 'typesetting_assignment' assignment.pk %}">Edit</a></td>
<td>{% if can_view_file_flag %}
<a href="{% url 'article_file_download' 'id' article.pk galley.file.pk %}"><i
class="fa fa-download">&nbsp;</i></a>{% endif %}
<td>
<a href="{% url 'typesetting_typesetter_download_file' assignment.pk galley.file.pk %}"><i
class="fa fa-download">&nbsp;</i></a>
</td>
<td>
<a href="{% url 'typesetting_preview_galley' article_id=article.pk galley_id=galley.pk assignment_id=assignment.pk %}"
Expand Down
39 changes: 27 additions & 12 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,9 @@ def typesetting_typesetter_download_file(request, assignment_id, file_id):
or file.pk in assignment.round.article.supplementary_files.values_list(
'file__pk', flat=True,
)
or file.pk in assignment.round.article.galley_set.values_list(
'file__pk', flat=True,
)
):
return files.serve_any_file(
request,
Expand Down Expand Up @@ -801,6 +804,7 @@ def typesetting_delete_galley(request, galley_id):
)
)


@decorators.has_journal
@decorators.typesetter_user_required
def typesetting_assignment(request, assignment_id):
Expand Down Expand Up @@ -1360,24 +1364,36 @@ def typesetting_proofing_download(request, article_id, assignment_id, file_id):
return redirect(request.META.get('HTTP_REFERER'))


@security.proofreader_for_article_required
@security.can_preview_typesetting_article
def preview_figure(
request,
galley_id,
file_name,
assignment_id=None,
article_id=None
article_id=None,
):

if assignment_id:
assignment = get_object_or_404(
models.GalleyProofing,
pk=assignment_id,
)
galley = get_object_or_404(
core_models.Galley,
pk=galley_id,
article_id=assignment.round.article.pk,
)
try:
assignment = models.TypesettingAssignment.objects.get(
pk=assignment_id,
typesetter=request.user,
)
galley = core_models.Galley.objects.get(
pk=galley_id,
article_id=assignment.round.article.pk,
)
except (models.TypesettingAssignment.DoesNotExist, core_models.Galley.DoesNotExist):
assignment = get_object_or_404(
models.GalleyProofing,
pk=assignment_id,
proofreader=request.user
)
galley = get_object_or_404(
core_models.Galley,
pk=galley_id,
article_id=assignment.round.article.pk,
)
elif article_id and request.user.has_an_editor_role(request):
article = get_object_or_404(
submission_models.Article,
Expand Down Expand Up @@ -1458,6 +1474,5 @@ def mint_supp_doi(request, supp_file_id):
'Minted DOI for supplementary file #%d' % supp_file.pk,
)


return redirect(request.META.get('HTTP_REFERER'))

0 comments on commit 2d6a08a

Please sign in to comment.