Making WordPress.org

Changeset 12841


Ignore:
Timestamp:
08/14/2023 10:29:28 PM (18 months ago)
Author:
coffee2code
Message:

Photo Directory, Admin CSS/JS: Highlight 'Note to User' field if empty when 'See below' is the selected reason for rejection.

See #7171.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/assets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/assets/css/admin.css

    r12790 r12841  
    6262
    6363#content.photo-missing-description,
     64.photo-missing-note-to-user,
    6465.photo-missing-taxonomy {
    6566    border: 1px solid orange;
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/assets/js/admin.js

    r12807 r12841  
    5050    // Highlight custom taxonomies lacking terms.
    5151    highlightCustomTaxonomiesWithoutTerms();
     52
     53    // Highlight rejection note to user if 'See below' option is chosen and no note exists.
     54    const photoRejectionReason = document.getElementById('rejected_reason');
     55    const photoRejectionNoteToUser = document.getElementById('moderator_note_to_user');
     56    function setNoteToUserHighlight() {
     57        const missingNoteClass = 'photo-missing-note-to-user';
     58        if ( photoRejectionReason?.value === 'other' && photoRejectionNoteToUser?.value.trim().length === 0 ) {
     59            photoRejectionNoteToUser?.classList.add(missingNoteClass);
     60        } else {
     61            photoRejectionNoteToUser?.classList.remove(missingNoteClass);
     62        }
     63    }
     64    setNoteToUserHighlight();
     65    photoRejectionReason?.addEventListener('change', e => setNoteToUserHighlight());
     66    photoRejectionNoteToUser?.addEventListener('input', e => setNoteToUserHighlight());
     67
    5268}, false);
    5369
Note: See TracChangeset for help on using the changeset viewer.