From 12f341ca5456d9e99da6595492bef631f8494ad8 Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Sat, 19 Oct 2024 18:25:19 -0700 Subject: [PATCH] feat: working summary view --- xmodule/item_bank_block.py | 6 +++++- xmodule/templates/item_bank/author_view.html | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xmodule/item_bank_block.py b/xmodule/item_bank_block.py index 7431296cd932..49f5a88ddda6 100644 --- a/xmodule/item_bank_block.py +++ b/xmodule/item_bank_block.py @@ -19,6 +19,7 @@ from xblock.fields import Boolean, Integer, List, Scope, String from xblock.utils.resources import ResourceLoader +from xmodule.block_metadata_utils import display_name_with_default from xmodule.mako_block import MakoTemplateBlockBase from xmodule.studio_editable import StudioEditableBlock from xmodule.util.builtin_assets import add_webpack_js_to_fragment @@ -481,7 +482,10 @@ def author_view(self, context): # Show a summary message and instructions. summary_html = loader.render_django_template('templates/item_bank/author_view.html', { "item_bank_id": self.usage_key, - "block_ids": self.children, + "blocks": [ + {"display_name": display_name_with_default(child)} + for child in self.get_children() + ], "block_count": len(self.children), "max_count": self.max_count, }) diff --git a/xmodule/templates/item_bank/author_view.html b/xmodule/templates/item_bank/author_view.html index 6a66e1e20f7b..40b27272ba4d 100644 --- a/xmodule/templates/item_bank/author_view.html +++ b/xmodule/templates/item_bank/author_view.html @@ -1,7 +1,11 @@
{% if block_count > 0 %} -

Will show {{ max_count }} of the {{ block_count }} selected components:

- +

Learners will see {{ max_count }} of the {{ block_count }} selected components:

+
    + {% for block in blocks %} +
  1. {{ block.display_name }}
  2. + {% endfor %} +

Press View to preview, sync/update, and/or remove the selected components.

Press Edit to configure how many will be shown and other settings.

{% else %}