Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: deleted from draft pages not showing up in GridField #22

Open
wants to merge 1 commit into
base: 1.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions code/extensions/Lumberjack.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ public function getExcludedSiteTreeClassNames() {
public function updateCMSFields(FieldList $fields) {
$excluded = $this->owner->getExcludedSiteTreeClassNames();
if(!empty($excluded)) {
$pages = SiteTree::get()->filter(array(
'ParentID' => $this->owner->ID,
'ClassName' => $excluded
));
$pages = $this->owner->AllChildrenIncludingDeleted()
->filter("ClassName", $excluded);

$gridField = new GridField(
"ChildPages",
$this->getLumberjackTitle(),
Expand Down Expand Up @@ -84,6 +83,8 @@ public function liveChildren($showAll = false, $onlyDeletedFromStage = false) {
// Filter the SiteTree
return $staged->exclude("ClassName", $this->owner->getExcludedSiteTreeClassNames());
}

return $staged;
}


Expand Down
24 changes: 12 additions & 12 deletions code/forms/gridfield/GridFieldSiteTreeState.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ public function getColumnContent($gridField, $record, $columnName) {
$modifiedLabel = "";
if($record->isModifiedOnStage) {
$modifiedLabel = "<span class='modified'>" . _t("GridFieldSiteTreeState.Modified") . "</span>";
}
}

$published = $record->isPublished();
if(!$published) {
return _t(
"GridFieldSiteTreeState.Draft",
'<i class="btn-icon gridfield-icon btn-icon-pencil"></i> Saved as Draft on {date}',
"State for when a post is saved.",
array(
"date" => $record->dbObject("LastEdited")->Nice()
)
);
if($record->IsDeletedFromStage) {
if($record->ExistsOnLive) {
return _t('SiteTree.REMOVEDFROMDRAFTHELP', 'Page is published, but has been deleted from draft');
} else {
return _t('SiteTree.DELETEDPAGEHELP', 'Page is no longer published');
}
} else if($record->IsAddedToStage) {
return _t('SiteTree.ADDEDTODRAFTHELP', "Page has not been published yet");
} else if($record->IsModifiedOnStage) {
return _t('SiteTree.MODIFIEDONDRAFTHELP', 'Page has unpublished changes');
} else {
return _t(
"GridFieldSiteTreeState.Published",
'<i class="btn-icon gridfield-icon btn-icon-accept"></i> Published on {date}',
"State for when a post is published.",
"State for when a post is published.",
array(
"date" => $record->dbObject("LastEdited")->Nice()
)
Expand Down