Skip to content

Commit

Permalink
feat: working summary view
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Oct 20, 2024
1 parent 5352e12 commit 12f341c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion xmodule/item_bank_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
})
Expand Down
8 changes: 6 additions & 2 deletions xmodule/templates/item_bank/author_view.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<div style="padding: 1em">
{% if block_count > 0 %}
<p>Will show {{ max_count }} of the {{ block_count }} selected components:</p>

<p>Learners will see {{ max_count }} of the {{ block_count }} selected components:</p>
<ol style="list-style: decimal; margin-left: 2em;">
{% for block in blocks %}
<li>{{ block.display_name }}</li>
{% endfor %}
</ol>
<p style="color: var(--gray);">Press <a href="/container/{{ item_bank_id }}">View</a> to preview, sync/update, and/or remove the selected components.</p>
<p style="color: var(--gray);">Press <a role="button" href="#" class="edit-button action-button">Edit</a> to configure how many will be shown and other settings.</p>
{% else %}
Expand Down

0 comments on commit 12f341c

Please sign in to comment.