diff --git a/ai_eval/shortanswer.py b/ai_eval/shortanswer.py index 2501a9d..cd9b553 100644 --- a/ai_eval/shortanswer.py +++ b/ai_eval/shortanswer.py @@ -30,6 +30,15 @@ class ShortAnswerAIEvalXBlock(AIEvalXBlock): scope=Scope.settings, ) + character_image = String( + display_name=_("Character Image URL"), + help=_( + "URL for an image to be shown to the left of the chat box; " + "leave empty to disable" + ), + scope=Scope.settings, + ) + max_responses = Integer( display_name=_("Max Responses"), help=_("The maximum number of response messages the student can submit"), @@ -47,6 +56,7 @@ class ShortAnswerAIEvalXBlock(AIEvalXBlock): editable_fields = AIEvalXBlock.editable_fields + ( "max_responses", "allow_reset", + "character_image", ) def validate_field_data(self, validation, data): diff --git a/ai_eval/static/css/shortanswer.css b/ai_eval/static/css/shortanswer.css index fb0bec5..5f42743 100644 --- a/ai_eval/static/css/shortanswer.css +++ b/ai_eval/static/css/shortanswer.css @@ -1,5 +1,14 @@ /* CSS for ShortAnswerAIEvalXBlock */ +.shortanswer_image { + float: left; + margin-right: 4rem; + width: 30%; +} + +.shortanswer_image + .shortanswer_block { +} + .shortanswer_block .count { font-weight: bold; } diff --git a/ai_eval/templates/shortanswer.html b/ai_eval/templates/shortanswer.html index 2fc4d32..7a7293d 100644 --- a/ai_eval/templates/shortanswer.html +++ b/ai_eval/templates/shortanswer.html @@ -1,3 +1,9 @@ +{% if self.character_image %} +