MBS-10672: Fix formelements display for long content#56
Conversation
Barbuia
commented
Mar 27, 2026
- Add truncation logic in chat.js for suggestion values > 300 chars
- Update agent_suggestions.mustache with styled pre/code block
- Add scrollable container and truncation indicator
8be5644 to
8e8c96c
Compare
PhMemmel
left a comment
There was a problem hiding this comment.
I don't think truncation is the correct way of dealing with the layout here. Please see comments in the other PR in local_ai_manager
ad60d05 to
7cf68d0
Compare
templates/agent_suggestions.mustache
Outdated
| <br/><b>{{#str}}suggestionlabel, block_ai_chat{{/str}}: </b> | ||
| <details class="block_ai_chat-suggestion-details mb-2"> | ||
| <summary class="btn btn-sm btn-outline-secondary">{{#str}}showsuggestion, block_ai_chat{{/str}}</summary> | ||
| <pre class="block_ai_chat-suggestion-code mt-2 p-2 bg-light border rounded"><code>{{{suggestiondisplayvalue}}}</code></pre> |
There was a problem hiding this comment.
The suggestion is not always code. It's often just plain text.
In case of plain text, for example to fill the form field "course description" it's irritating that this is in a single-line code field and you have to scroll to the right to see the full description.
However, a different formatting for the suggestion is a good thing. Please keep this, but it should not be formatted as "code".
Also, for longer values: If it's short enough it should just be there.
If it's long: Show the shortened text, and add a SMALL button (or probably even better: no button at all and instead make the text just clickable for toggling expanding and collapsing(.
- Add collapsible details element for suggestion values to handle HTML/code output
- Use triple mustache {{{ }}} for proper HTML rendering in suggestions
- Fix async forEach bug in _getAgentAnswerTemplateContext (was not awaiting)
- Add suggestiondisplayvalue fallback from backend formatting
- Add CSS styles for suggestion details and code blocks
7cf68d0 to
d0964dd
Compare