Skip to content

Add Enable All / Disable All assignments bulk action (#273)#354

Closed
ba88im wants to merge 1 commit into
mainfrom
ba88im-superset/enable/disable-all-assignments-feature-request
Closed

Add Enable All / Disable All assignments bulk action (#273)#354
ba88im wants to merge 1 commit into
mainfrom
ba88im-superset/enable/disable-all-assignments-feature-request

Conversation

@ba88im
Copy link
Copy Markdown

@ba88im ba88im commented Apr 27, 2026

Closes #273.

Summary

  • Adds Enable All Assignments and Disable All Assignments buttons to the instructor course view, alongside the existing Sync button.
  • New PATCH /assignments/bulk_update_enabled collection route, backed by AssignmentsController#bulk_update_enabled. The action is instructor-only and returns JSON with updated_count and skipped_count.
  • When enabling, assignments without a due_date are skipped so the existing enabled_requires_date_present validation isn't tripped; the skip count is reported back in the flash so instructors know what happened.
  • Front-end wiring lives in assignment_controller.js (enableAll / disableAll), reusing the existing CSRF + flash + reload pattern from sync.

Files changed

  • config/routes.rb — add collection { patch :bulk_update_enabled } on resources :assignments
  • app/controllers/assignments_controller.rb — add bulk_update_enabled
  • app/views/courses/instructor_show.html.erb — add the two buttons and lift data-controller="assignment" to a wrapper with the new values
  • app/javascript/controllers/assignment_controller.jsenableAll, disableAll, _bulkUpdate
  • spec/controllers/assignments_controller_spec.rb — controller specs for the new action
  • features/assignments.feature — scenario asserting the buttons render for instructors

Test plan

  • CI green (RSpec + Cucumber)
  • Manual: as an instructor on a course page, click Enable All Assignments — confirm assignments with due dates flip to enabled and ones without due dates are skipped (reported in flash)
  • Manual: click Disable All Assignments — confirm every assignment flips to disabled
  • Manual: as a student, hit /assignments/bulk_update_enabled directly — confirm 403

Adds two buttons to the instructor course view that let instructors
enable or disable every assignment for a course in one click. When
enabling, assignments without a due date are skipped to satisfy the
existing enabled_requires_date_present validation, and the count of
skipped assignments is reported back in the flash.

- New PATCH /assignments/bulk_update_enabled collection route
- New AssignmentsController#bulk_update_enabled action (instructor-only)
- New Stimulus actions enableAll / disableAll on assignment_controller
- New buttons rendered next to Sync Assignments on instructor_show
- RSpec coverage for instructor success, role enforcement, due-date
  skipping, and missing-course handling
- Cucumber scenario asserting the buttons render for instructors

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Shklalom
Copy link
Copy Markdown

Duplicate PR

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.

2 participants