mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
Show next review date for inherited settings
This commit is contained in:
parent
4c88574799
commit
09586b4b12
@ -307,15 +307,21 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
|
|
||||||
$notesField = GridField::create('ReviewNotes', 'Review Notes', $this->owner->ReviewLogs(), GridFieldConfig_RecordEditor::create());
|
$notesField = GridField::create('ReviewNotes', 'Review Notes', $this->owner->ReviewLogs(), GridFieldConfig_RecordEditor::create());
|
||||||
|
|
||||||
|
$schedule = self::get_schedule();
|
||||||
|
|
||||||
$fields->addFieldsToTab("Root.ContentReview", array(
|
$fields->addFieldsToTab("Root.ContentReview", array(
|
||||||
new HeaderField(_t('ContentReview.REVIEWHEADER', "Content review"), 2),
|
new HeaderField(_t('ContentReview.REVIEWHEADER', "Content review"), 2),
|
||||||
$viewersOptionsField,
|
$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(
|
CompositeField::create(
|
||||||
$userField,
|
$userField,
|
||||||
$groupField,
|
$groupField,
|
||||||
$reviewDate,
|
$reviewDate,
|
||||||
$reviewFrequency
|
$reviewFrequency
|
||||||
)->addExtraClass('contentReviewSettings'),
|
)->addExtraClass('custom-settings'),
|
||||||
$notesField
|
$notesField
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -15,30 +15,42 @@ jQuery(function($) {
|
|||||||
$('.cms-edit-form #ContentReviewType').entwine({
|
$('.cms-edit-form #ContentReviewType').entwine({
|
||||||
// Constructor: onmatch
|
// Constructor: onmatch
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
// TODO Decouple
|
var self = this;
|
||||||
var dropdown;
|
this.find('.optionset :input').on('change', function(e) {
|
||||||
if(this.attr('id') == 'ContentReviewType') dropdown = $('.contentReviewSettings');
|
self.show_option(e.target.value);
|
||||||
|
|
||||||
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']();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// initial state
|
// initial state
|
||||||
var currentVal = this.find('input[name=' + this.attr('id') + ']:checked').val();
|
var currentVal = this.find('input[name=' + this.attr('id') + ']:checked').val();
|
||||||
dropdown[currentVal == 'Custom' ? 'show' : 'hide']();
|
this.show_option(currentVal);
|
||||||
|
|
||||||
this._super();
|
this._super();
|
||||||
},
|
},
|
||||||
onunmatch: function() {
|
onunmatch: function() {
|
||||||
|
this.find('.optionset :input').off('change');
|
||||||
this._super();
|
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']();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user