Main save/publish actions to change icons when state changed

This commit is contained in:
Paul Clarke 2016-12-12 13:53:50 +13:00 committed by Damian Mooyman
parent 16e3e40c2b
commit 9f4acfe3bf

View File

@ -2339,7 +2339,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if ($canEdit && $isOnDraft) { if ($canEdit && $isOnDraft) {
$majorActions->push( $majorActions->push(
FormAction::create('save', _t('SiteTree.BUTTONSAVED', 'Saved')) FormAction::create('save', _t('SiteTree.BUTTONSAVED', 'Saved'))
->addExtraClass('btn-secondary-outline font-icon-save') ->addExtraClass('btn-secondary-outline font-icon-check-mark')
->setAttribute('data-btn-alternative', 'btn-primary font-icon-save')
->setUseButtonTag(true) ->setUseButtonTag(true)
->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT','Save draft')) ->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT','Save draft'))
); );
@ -2349,17 +2350,17 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// "publish", as with "save", it supports an alternate state to show when action is needed. // "publish", as with "save", it supports an alternate state to show when action is needed.
$majorActions->push( $majorActions->push(
$publish = FormAction::create('publish', _t('SiteTree.BUTTONPUBLISHED', 'Published')) $publish = FormAction::create('publish', _t('SiteTree.BUTTONPUBLISHED', 'Published'))
->addExtraClass('btn-secondary-outline font-icon-rocket') ->addExtraClass('btn-secondary-outline font-icon-check-mark')
->setAttribute('data-btn-alternative', 'btn-primary') ->setAttribute('data-btn-alternative', 'btn-primary font-icon-rocket')
->setUseButtonTag(true) ->setUseButtonTag(true)
->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish')) ->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))
); );
// Set up the initial state of the button to reflect the state of the underlying SiteTree object. // Set up the initial state of the button to reflect the state of the underlying SiteTree object.
if($stagesDiffer) { if($stagesDiffer) {
$publish->addExtraClass('btn-primary'); $publish->addExtraClass('btn-primary font-icon-rocket');
$publish->setTitle(_t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish')); $publish->setTitle(_t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'));
$publish->removeExtraClass('btn-secondary-outline'); $publish->removeExtraClass('btn-secondary-outline font-icon-check-mark');
} }
} }