Show next review date for inherited settings

This commit is contained in:
Stig Lindqvist 2014-02-27 11:43:56 +13:00
parent 4c88574799
commit 09586b4b12
2 changed files with 35 additions and 17 deletions

View File

@ -307,15 +307,21 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$notesField = GridField::create('ReviewNotes', 'Review Notes', $this->owner->ReviewLogs(), GridFieldConfig_RecordEditor::create());
$schedule = self::get_schedule();
$fields->addFieldsToTab("Root.ContentReview", array(
new HeaderField(_t('ContentReview.REVIEWHEADER', "Content review"), 2),
$viewersOptionsField,
CompositeField::create(
ReadonlyField::create('ROContentOwners', _t('ContentReview.CONTENTOWNERS', 'Content Owners'), $this->getOwnerNames()),
ReadonlyField::create('RONextReviewDate', _t("ContentReview.NEXTREVIEWDATE", "Next review date"), $this->owner->NextReviewDate)
)->addExtraClass('inherited-settings'),
CompositeField::create(
$userField,
$groupField,
$reviewDate,
$reviewFrequency
)->addExtraClass('contentReviewSettings'),
)->addExtraClass('custom-settings'),
$notesField
));
}

View File

@ -15,30 +15,42 @@ jQuery(function($) {
$('.cms-edit-form #ContentReviewType').entwine({
// Constructor: onmatch
onmatch: function() {
// TODO Decouple
var dropdown;
if(this.attr('id') == 'ContentReviewType') dropdown = $('.contentReviewSettings');
this.find('.optionset :input').bind('change', function(e) {
var wrapper = $(this).closest('.middleColumn').parent('div');
if(e.target.value == 'Custom') {
wrapper.addClass('remove-splitter');
dropdown['show']();
}
else {
wrapper.removeClass('remove-splitter');
dropdown['hide']();
}
var self = this;
this.find('.optionset :input').on('change', function(e) {
self.show_option(e.target.value);
});
// initial state
var currentVal = this.find('input[name=' + this.attr('id') + ']:checked').val();
dropdown[currentVal == 'Custom' ? 'show' : 'hide']();
this.show_option(currentVal);
this._super();
},
onunmatch: function() {
this.find('.optionset :input').off('change');
this._super();
},
show_option: function(value) {
if(value === 'Custom') {
this._custom();
} else if(value === 'Inherit') {
this._inherited();
} else {
this._disabled();
}
},
_custom: function() {
$('.custom-settings')['show']();
$('.inherited-settings')['hide']();
},
_inherited: function() {
$('.inherited-settings')['show']();
$('.custom-settings')['hide']();
},
_disabled: function() {
$('.inherited-settings')['hide']();
$('.custom-settings')['hide']();
}
});