diff --git a/anatomy/templates/anatomy/anatomyquestion_form.html b/anatomy/templates/anatomy/anatomyquestion_form.html index 133a5950..6e97fb31 100644 --- a/anatomy/templates/anatomy/anatomyquestion_form.html +++ b/anatomy/templates/anatomy/anatomyquestion_form.html @@ -2,6 +2,7 @@ {% load static %} {% load crispy_forms_tags %} +{% load help_tags %} {% block title %} Anatomy @@ -11,69 +12,69 @@ {% block js %} - + -{{ form.media }} + {{ form.media }} {% endblock %} {% block content %} -{% if object %} - {% include 'anatomy/question_link_header.html' %} -{% endif %} - -

{{object|yesno:"Update,Create"}} Question

-
- Help -

This form can be used to create an Anatomy question.

+ {% if object %} + {% include 'anatomy/question_link_header.html' %} + {% endif %} -

Question type can be selected from a predefined list. If you require a more please contact ross.kruger@nhs.net.

+

{{object|yesno:"Update,Create"}} Question

+ {% help "Help" %} +

This form can be used to create an Anatomy question.

-

Correct and incorrect answers can be defined once the question has been created.

-
-
- {% csrf_token %} - - +

Question type can be selected from a predefined list. If you require a more please contact ross.kruger@nhs.net.

- {{ form|crispy }} -
Drop image here -
-
- -
+

Correct and incorrect answers can be defined once the question has been created.

+ {% endhelp %} +
+ {% csrf_token %} + + + + {{ form|crispy }} +
Drop image here +
+
+ +
{% endblock %} \ No newline at end of file diff --git a/generic/templatetags/help_tags.py b/generic/templatetags/help_tags.py new file mode 100644 index 00000000..b20fafa4 --- /dev/null +++ b/generic/templatetags/help_tags.py @@ -0,0 +1,57 @@ +from django import template +from django.template import Node, TemplateSyntaxError, Variable + +register = template.Library() + +class HelpNode(Node): + def __init__(self, nodelist, title, icon, extra_class): + self.nodelist = nodelist + self.title = title + self.icon = icon + self.extra_class = extra_class + + def resolve(self, val, context): + if isinstance(val, Variable): + try: + return val.resolve(context) + except Exception: + return '' + return val + + def render(self, context): + title = self.resolve(self.title, context) or "Help" + icon = self.resolve(self.icon, context) or "bi bi-info-circle" + extra_class = self.resolve(self.extra_class, context) or "help-text" + body = self.nodelist.render(context) + return f'
{title}{body}
' + +@register.tag(name="help") +def do_help(parser, token): + bits = token.split_contents() + title = "Help" + icon = "bi bi-info-circle" + extra_class = "help-text" + + for bit in bits[1:]: + if "=" in bit: + key, val = bit.split("=", 1) + if (val.startswith('"') and val.endswith('"')) or (val.startswith("'") and val.endswith("'")): + val = val[1:-1] + else: + val = Variable(val) + if key == "icon": + icon = val + elif key in ("class", "extra_class"): + extra_class = val + else: + raise TemplateSyntaxError(f"Unknown keyword for help tag: {key}") + else: + v = bit + if (v.startswith('"') and v.endswith('"')) or (v.startswith("'") and v.endswith("'")): + title = v[1:-1] + else: + title = Variable(v) + + nodelist = parser.parse(("endhelp",)) + parser.delete_first_token() + return HelpNode(nodelist, title, icon, extra_class) \ No newline at end of file diff --git a/shorts/models.py b/shorts/models.py index d3475ce9..e539e6de 100644 --- a/shorts/models.py +++ b/shorts/models.py @@ -545,11 +545,12 @@ class UserAnswer(UserAnswerBase): # If score is null then the answer is unmarked score = models.IntegerField( - default=0, blank=True, validators=[MinValueValidator(0), MaxValueValidator(5)], null=True + default=0, blank=True, validators=[MinValueValidator(0), MaxValueValidator(5)], null=True, + help_text="Score for the answer. If null then the answer is unmarked. This should be number 0-5.", ) candidate_feedback = models.TextField( - null=True, blank=True, help_text="Feedback for the candidate" + null=True, blank=True, help_text="Feedback for the candidate, this is optional but WILL be shown to the candidate." ) class CallStateOptions(models.TextChoices): diff --git a/shorts/templates/shorts/mark_answer.html b/shorts/templates/shorts/mark_answer.html index dbbbc3c9..69dcee8f 100644 --- a/shorts/templates/shorts/mark_answer.html +++ b/shorts/templates/shorts/mark_answer.html @@ -1,5 +1,6 @@ {% extends 'shorts/exams.html' %} {% load crispy_forms_tags %} +{% load help_tags %} {% block content %} View @@ -7,47 +8,153 @@ {% if request.user.is_superuser %} Admin Edit Admin - Edit (user answer) + title="Edit the user answer using the admin interface">Admin + Edit (user answer) {% endif %}

Marking question {{question_details.current}} of {{question_details.total}}

+ title="View question answers">{{question_details.current}} of {{question_details.total}} {% if discrepancy_form %} {% endif %} + {% help "Help" %} +

Marking guidance for the 2B exam can be viewed on the RCR site at here

+ +

For convienience the info is also copied below:

+ + +

Ideally each question will have individual marking guidance that will be shown below.

+ {% endhelp %} + {% if not next_unmarked_id and not unmarked %}