silverstripe-contentreview/client/src/bundles/PagesDueForReview.js
Robbie Averill 8b8b8e3620 API Add React modal popup for reviewing content in SiteTree
* Add i18n javascript source file and Transifex configuration
* Add npm requirements, React + entwine wrapper for CMS
* Overload LeftAndMain::getSchema... methods in extension so they can be used
* Refactor CSS to only the content review button
2017-09-15 16:06:37 +12:00

34 lines
855 B
JavaScript

import jQuery from 'jquery';
/**
* @todo Re-validate this with Subsites
*/
jQuery.entwine('ss', ($) => {
// Hide all owner dropdowns except the one for the current subsite
function showCorrectSubsiteIDDropdown(value) {
const domid = `ContentReviewOwnerID${value}`;
const ownerIDDropdowns = $('div.subsiteSpecificOwnerID');
let i = 0;
for (i = 0; i < ownerIDDropdowns.length; i++) {
if (ownerIDDropdowns[i].id === domid) {
$(ownerIDDropdowns[i]).show();
} else {
$(ownerIDDropdowns[i]).hide();
}
}
}
$('#Form_EditForm_SubsiteIDWithOwner').entwine({
// Call method to show on report load
onmatch() {
showCorrectSubsiteIDDropdown(this.value);
},
// Call method to show on dropdown change
change() {
showCorrectSubsiteIDDropdown(this.value);
},
});
});