-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring and improving validation error handling (#2285)
Refactoring and improving validation error handling
- Loading branch information
Showing
50 changed files
with
2,279 additions
and
2,207 deletions.
There are no files selected for viewing
733 changes: 366 additions & 367 deletions
733
assets/src/amp-validation/amp-validated-url-post-edit-screen.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,14 @@ | ||
/* exported ampValidatedUrlsIndex */ | ||
|
||
const ampValidatedUrlsIndex = ( function() { // eslint-disable-line no-unused-vars | ||
const component = { | ||
classes: {}, | ||
}; | ||
|
||
/** | ||
* The class for the new status | ||
* | ||
* @type {string} | ||
*/ | ||
component.classes.new = 'new'; | ||
|
||
/** | ||
* Boot. | ||
*/ | ||
component.boot = function boot() { | ||
component.highlightRowsWithNewStatus(); | ||
}; | ||
|
||
/** | ||
* Highlight rows with new status. | ||
*/ | ||
component.highlightRowsWithNewStatus = function highlightRowsWithNewStatus() { | ||
document.querySelectorAll( 'tr[id^="post-"]' ).forEach( function( row ) { | ||
if ( row.querySelector( 'span.status-text.' + component.classes.new ) ) { | ||
row.classList.add( 'new' ); | ||
} | ||
} ); | ||
}; | ||
|
||
return component; | ||
}() ); | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import domReady from '@wordpress/dom-ready'; | ||
|
||
const CLASS_NAME = 'new'; | ||
|
||
domReady( () => { | ||
document.querySelectorAll( 'tr[id^="post-"]' ).forEach( function( row ) { | ||
if ( row.querySelector( 'span.status-text.' + CLASS_NAME ) ) { | ||
row.classList.add( CLASS_NAME ); | ||
} | ||
} ); | ||
} ); |
This file contains 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
Oops, something went wrong.