Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add actions to detail view #508

Merged
merged 16 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified locale/en/LC_MESSAGES/django.mo
Binary file not shown.
23 changes: 16 additions & 7 deletions locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ msgstr "Website export text"
#: proposals/templates/proposals/proposal_confirmation.html:25
#: reviews/templates/reviews/vue_templates/decision_list.html:95
#: reviews/templates/reviews/vue_templates/review_list.html:87
#: reviews/utils/review_actions.py:281
msgid "Bevestigingsbrief versturen"
msgstr "Send confirmation letter"

Expand Down Expand Up @@ -3548,15 +3549,15 @@ msgstr ""
"This overview shows all practice applications in which you are involved as a "
"student, researcher or accountable researcher."

#: proposals/views/proposal_views.py:256
#: proposals/views/proposal_views.py:257 proposals/views/proposal_views.py:256
msgid "Aanvraag verwijderd"
msgstr "Application deleted"

#: proposals/views/proposal_views.py:380
#: proposals/views/proposal_views.py:381 proposals/views/proposal_views.py:380
msgid "Wijzigingen opgeslagen"
msgstr "Changes saved"

#: proposals/views/proposal_views.py:481
#: proposals/views/proposal_views.py:482 proposals/views/proposal_views.py:481
msgid "Aanvraag gekopieerd"
msgstr "Application copied"

Expand Down Expand Up @@ -4331,22 +4332,30 @@ msgstr "Information letter for the parents"
msgid "Toestemmingsdocument observatie"
msgstr "Consent document for observation"

#: reviews/utils/review_actions.py:126
#: reviews/utils/review_actions.py:128 reviews/utils/review_actions.py:126
msgid "Geef jouw beslissing en/of commentaar door"
msgstr "Provide feedback on this proposal"

#: reviews/utils/review_actions.py:152
#: reviews/utils/review_actions.py:154 reviews/utils/review_actions.py:152
msgid "Deze aanvraag afsluiten"
msgstr "Conclude this application"

#: reviews/utils/review_actions.py:182
#: reviews/utils/review_actions.py:184 reviews/utils/review_actions.py:182
msgid "Beëindig definitief de afhandeling van deze aanvraag"
msgstr "Discontinue assessment of this application"

#: reviews/utils/review_actions.py:212
#: reviews/utils/review_actions.py:214 reviews/utils/review_actions.py:212
msgid "Verander aangestelde commissieleden"
msgstr "Change appointment of committee members"

#: reviews/utils/review_actions.py:255
msgid "Verberg aanvraag uit het archief"
msgstr "Remove this application from the archive"

#: reviews/utils/review_actions.py:282
msgid "Datum van bevestigingsbrief aanpassen"
msgstr "Change date of confirmation letter"

#: reviews/utils/review_utils.py:53
msgid "FETC-GW {}: bevestiging indienen concept-aanmelding"
msgstr "FEtC-H {}: confirmation of draft application submission"
Expand Down
4 changes: 3 additions & 1 deletion proposals/views/proposal_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,11 @@ def get_redirect_url(self, *args, **kwargs):

proposal = Proposal.objects.get(pk=pk)
proposal.public = False
#proposal.in_archive = False
proposal.save()

return reverse('proposals:archive')
committee = proposal.reviewing_committee.name
return reverse('proposals:archive', args=[committee])

##########################
# CRUD actions on Proposal
Expand Down
68 changes: 68 additions & 0 deletions reviews/utils/review_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def __init__(self, review, user):
DecideAction(review, user),
ChangeAssignment(review, user),
DiscontinueReview(review, user),
SendConfirmation(review, user),
#HideReview(review, user),
]
self.ufl_actions = []

Expand Down Expand Up @@ -210,3 +212,69 @@ def action_url(self):
def description(self):

return _('Verander aangestelde commissieleden')

class SendConfirmation(ReviewAction):

def is_available(self):
'''Only the secretary is able to send the confirmation letter and/or change the date.
The review needs to be closed and have an approved status.'''

user = self.user
review = self.review

user_groups = user.groups.values_list("name", flat=True)
if not settings.GROUP_SECRETARY in user_groups:
return False

if review.stage < review.CLOSED:
return False

if not review.continuation in [review.GO, review.GO_POST_HOC]:
return False

return True

def action_url(self):

return reverse('proposals:confirmation', args=(self.review.proposal.pk,))

def description(self):
proposal = self.review.proposal
send_letter = _('Bevestigingsbrief versturen')
change_date = _('Datum van bevestigingsbrief aanpassen')

if proposal.date_confirmed is None:
return send_letter
else:
return change_date

class HideReview(ReviewAction):
'''This class should lead to the archive_hide url, but the hide
functionality does currently not work properly/ is not in use.
Therefore it is commented out in the ReviewActions class.'''

def is_available(self):

user = self.user
review = self.review

user_groups = user.groups.values_list("name", flat=True)
if not settings.GROUP_SECRETARY in user_groups:
return False

if review.proposal.public == False:
return False

if review.proposal.status < Proposal.DECISION_MADE:
return False

return True

def action_url(self):

return reverse('proposals:archive_hide', args=(self.review.proposal.pk,))

def description(self):

return _('Verberg aanvraag uit het archief')