Skip to content

Commit

Permalink
add the required indicator to the label
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead committed Aug 28, 2024
1 parent fcb58d0 commit 69e5d98
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/javascript/packs/schools.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ $("#new_school").on("submit", function (e) {
});

// TODO: This list should match the model attributes.
const SCHOOL_REQUIRED_ATTRIBUTES = ['name', 'city', 'state', 'website', 'grade_level', 'school_type'];
// These are all prefixed with schol_ on the page form.
const SCHOOL_REQUIRED_ATTRIBUTES = ['name', 'city', 'state', 'website', 'grade_level', 'type'];

let toggle_required = (selectors, state) => {
selectors.forEach(s => $(`#school_${s}`).prop("required", state))
let toggle_required = (fields, state) => {
fields.forEach(s => $(`#school_${s}`).prop("required", state));
fields.forEach(s => $(`[for=school_${s}]`).addClass('label-required'));
}

let create_school = function (input, callback) {
Expand Down

0 comments on commit 69e5d98

Please sign in to comment.