Skip to content

Commit

Permalink
Merge pull request #3023 from BirkbeckCTP/2847-next_workflow_element
Browse files Browse the repository at this point in the history
#2847 replace hard coded next stage text when completing copyediting with calculation of next stage.
  • Loading branch information
joemull authored Aug 3, 2022
2 parents f68a77c + 95e3e84 commit eb0ad6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/submission/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,15 @@ def current_workflow_element_url(self):
return '?workflow_element_url=no_element'
return self.journal.site_url(path=path)

def next_workflow_element(self):
try:
current_workflow_element = self.current_workflow_element
journal_elements = list(self.journal.workflow().elements.all())
i = journal_elements.index(current_workflow_element)
return journal_elements[i+1]
except IndexError:
return 'No next workflow stage found'

@cache(600)
def render_sample_doi(self):
return id_logic.render_doi_from_pattern(self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<h4><i class="fa fa-check">&nbsp;</i>Complete Copyediting</h4>
</div>
<div class="card-section">
<p>Complete copyediting and move this article to the next stage, production.</p>
<p>Complete copyediting and move this article to the next stage, {{ article.next_workflow_element }}.</p>
<form method="POST">
{% csrf_token %}
<button type="submit" class="button success" name="complete"><i class="fa fa-check">&nbsp;</i>Complete</button>
Expand Down

0 comments on commit eb0ad6c

Please sign in to comment.