Feature/server side datatables schools clean#425
Open
ronikriger wants to merge 7 commits intobeautyjoy:mainfrom
Open
Feature/server side datatables schools clean#425ronikriger wants to merge 7 commits intobeautyjoy:mainfrom
ronikriger wants to merge 7 commits intobeautyjoy:mainfrom
Conversation
added 6 commits
April 29, 2026 17:55
- Add ajax-datatables-rails gem - Create SchoolDatatable class with view_columns and data methods - Update SchoolsController#index to respond to JSON format - Add request spec verifying DataTables JSON structure
- Add datatable_params helper for realistic DataTables request params - Verify recordsTotal/recordsFiltered match school count - Verify each record returns name, location, country, website, teachers_count, grade_level, and DT_RowId
Override filter_records in SchoolDatatable to include state in global search (not covered by view_columns since Location is a composite display column).
- Replace server-rendered rows with empty tbody for AJAX population - Add id="schools-table" and data-source attribute for JS init - Remove js-dataTable class so shared init doesn't interfere - Remove @Schools assignment from HTML path (data comes via JSON) - Update index spec to match new behavior
- Add schools_index.js with serverSide DataTables init on #schools-table - Bind to both document.ready and turbolinks:load - Return HTML links and action buttons from SchoolDatatable#data - Mark HTML output as html_safe to prevent double-escaping - Add Cucumber scenarios for page load and search behavior - Update RSpec assertions for HTML-wrapped field values
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #425 +/- ##
==========================================
+ Coverage 74.71% 75.32% +0.60%
==========================================
Files 29 30 +1
Lines 1135 1163 +28
==========================================
+ Hits 848 876 +28
Misses 287 287 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
@ronikriger Can you resolve the linter issues? |
Contributor
done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
ajax-datatables-railsgem and created aSchoolDatatableclass that handles pagination, sorting, and server-side search across Name, City, State, Country, and Website columns.SchoolsController#indexto respond with JSON (viaSchoolDatatable) for AJAX requests and HTML for normal page loads.<tbody>in the schools index view with a DataTables-managed table (#schools-table) that fetches data from the JSON endpoint.schools_index.jspack to initialize the table withserverSide: true, bound to bothdocument.readyandturbolinks:load.Who authored this PR?
@ronikriger
How should this PR be tested?
/schoolsand verify the table loads with paginated databundle exec rspec spec/controllers/schools_controller_spec.rbbundle exec cucumber features/schools_datatable.featureIMPORTANT FOR DEVELOPERS!!!
This PR puts a new gem
ajax-datatables-railsto the Gemfile. After merging, all developers will need to runbundle installto pick up the new dependency.@cycomachead @armandofox @mdawn65