Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@cms/server/admin/templates/fragments/contest_config_fields.html`:
- Around line 337-378: The template calls .total_seconds() on optional fields
token_min_interval and token_gen_interval which raises if those attributes are
None; update the input value expressions for token_min_interval and
token_gen_interval to conditionally call .total_seconds() only when the contest
attribute is not none and otherwise render an empty string (or 0 as desired).
Specifically, change the value expression for token_min_interval (referencing
contest.token_min_interval) to use a conditional like
"contest.token_min_interval.total_seconds()|int if contest.token_min_interval is
not none else ''" and do the analogous guarded expression for token_gen_interval
(referencing contest.token_gen_interval) with the division by 60 applied only
when not none.
In `@cms/server/admin/templates/fragments/training_day_groups.html`:
- Around line 311-319: The submit handler attached to mainForm currently
renumbers only group_id[] (variable groupIds) but not the alphabetical_*
checkbox names, causing misalignment after row deletions; update the same submit
callback to also select checkboxes in '#groups-tbody' whose name starts with
'alphabetical_' (e.g. document.querySelectorAll('#groups-tbody
input[type="checkbox"][name^="alphabetical_"]')) and forEach over them setting
each input.name = 'alphabetical_' + index (and if you have matching label
elements or id attributes, update those too) so checkbox indices align with the
renumbered group_id[] values.
In `@cms/server/admin/templates/training_program.html`:
- Around line 65-72: The Remove Program UI is currently always active; gate it
with the same permission check used for other destructive actions by rendering
the active <form action="training_programs"> and its <button name="operation"
value="Remove" class="tp-btn-remove"> only when the user has the edit/delete
permission (e.g., permissions.can_edit_training_programs or
current_user.can_edit); otherwise render a non-submitting disabled button
(disabled attribute, no surrounding form, and a tooltip/title like "Read-only"
or aria-disabled) so read-only admins cannot trigger the POST from the UI. Keep
the same hidden input training_program_id and xsrf_form_html in the permitted
branch and preserve styling/markup for the disabled branch to match appearance.
🧹 Nitpick comments (2)
cms/server/admin/static/aws_tp_styles.css (1)
2608-2618: Consider dropping!importantin the groups-table button sizing rules if specificity already wins.This keeps the cascade more maintainable and easier to override later.
♻️ Possible simplification
.tp-groups-table .tp-btn-primary, .tp-groups-table .tp-btn-secondary, .tp-groups-table .tp-btn-remove { - font-size: 0.9rem !important; - padding: 6px 16px !important; + font-size: 0.9rem; + padding: 6px 16px; } .tp-groups-table .tp-btn-remove { - padding: 4px 10px !important; + padding: 4px 10px; }cms/server/admin/templates/fragments/training_day_groups.html (1)
21-60: Consider moving the inline<style>block into the shared stylesheet.Keeps styling centralized and avoids duplication when this fragment is included in multiple pages.
- Add new icons to svg_icons.html: upload, download, tag, alert-triangle, star, user, database, eye, unlock, duration - Update admin templates to use <use href> references instead of inline SVGs: - training_program_students.html - contest.html - training_day_groups.html - user_detail_layout.html - info_alert.html - contest_config_fields.html - student_tasks.html - training_program_tasks.html - training_program.html
…, permission gating - contest_config_fields.html: Guard .total_seconds() calls for optional token_min_interval and token_gen_interval fields to prevent errors when None - training_day_groups.html: Renumber alphabetical_* checkbox names in submit handler to align with group_id[] indices after row deletions - training_program.html: Gate Remove Program UI with admin.permission_all check, showing disabled button with 'Read-only' tooltip for non-privileged users Co-Authored-By: Ron Ryvchin <ron.ryv@gmail.com>
3a25275 to
f83b823
Compare
|
* re-design forms * Consolidate inline SVGs to use svg_icons.html sprite pattern - Add new icons to svg_icons.html: upload, download, tag, alert-triangle, star, user, database, eye, unlock, duration - Update admin templates to use <use href> references instead of inline SVGs: - training_program_students.html - contest.html - training_day_groups.html - user_detail_layout.html - info_alert.html - contest_config_fields.html - student_tasks.html - training_program_tasks.html - training_program.html * Fix template issues: token interval null checks, checkbox renumbering, permission gating - contest_config_fields.html: Guard .total_seconds() calls for optional token_min_interval and token_gen_interval fields to prevent errors when None - training_day_groups.html: Renumber alphabetical_* checkbox names in submit handler to align with group_id[] indices after row deletions - training_program.html: Gate Remove Program UI with admin.permission_all check, showing disabled button with 'Read-only' tooltip for non-privileged users Co-Authored-By: Ron Ryvchin <ron.ryv@gmail.com> * Fix timezone set * fix functional tests --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Summary by CodeRabbit
New Features
Style