Skip to content

Modernize configuration forms#119

Merged
ronryv merged 5 commits intotraining_programfrom
ronr_tp_bu
Feb 5, 2026
Merged

Modernize configuration forms#119
ronryv merged 5 commits intotraining_programfrom
ronr_tp_bu

Conversation

@ronryv
Copy link
Collaborator

@ronryv ronryv commented Feb 4, 2026


Open with Devin

Summary by CodeRabbit

  • New Features

    • Redesigned admin interface with modern card-based layouts for contest and training program configuration
    • Added responsive grid system with improved visual hierarchy and layout structure
    • Introduced modern toggle switches and enhanced language selector components
  • Style

    • Updated sidebar navigation icons
    • Unified icon system across admin pages with consistent styling
    • Enhanced button and input field styling for improved usability

@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • ✅ Full review completed - (🔄 Check again to review again)
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ronr_tp_bu

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional flags.

Open in Devin Review

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 !important in 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.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 8 additional findings in Devin Review.

Open in Devin Review

- 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>
@ronryv ronryv force-pushed the ronr_tp_bu branch 2 times, most recently from 3a25275 to f83b823 Compare February 5, 2026 07:48
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 5, 2026

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@ronryv ronryv merged commit 588c8e6 into training_program Feb 5, 2026
6 checks passed
ronryv added a commit that referenced this pull request Feb 5, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant