mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Add an option show full blog entry on the holder
https://github.com/silverstripe/silverstripe-blog/issues/57
This commit is contained in:
parent
59731c2b13
commit
289940b7e7
@ -230,6 +230,20 @@ class BlogEntry extends Page {
|
|||||||
'Date ASC'
|
'Date ASC'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the blog holder of this entry
|
||||||
|
*
|
||||||
|
* @return BlogHolder
|
||||||
|
*/
|
||||||
|
function getBlogHolder() {
|
||||||
|
$holder = null;
|
||||||
|
if($this->ParentID && $this->Parent()->ClassName == 'BlogHolder') {
|
||||||
|
$holder = $this->Parent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $holder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BlogEntry_Controller extends Page_Controller {
|
class BlogEntry_Controller extends Page_Controller {
|
||||||
|
@ -23,6 +23,7 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
|||||||
static $db = array(
|
static $db = array(
|
||||||
'TrackBacksEnabled' => 'Boolean',
|
'TrackBacksEnabled' => 'Boolean',
|
||||||
'AllowCustomAuthors' => 'Boolean',
|
'AllowCustomAuthors' => 'Boolean',
|
||||||
|
'ShowFullEntry' => 'Boolean',
|
||||||
);
|
);
|
||||||
|
|
||||||
static $has_one = array(
|
static $has_one = array(
|
||||||
@ -43,6 +44,7 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
|||||||
$fields->addFieldToTab('Root.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks'), "Content");
|
$fields->addFieldToTab('Root.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks'), "Content");
|
||||||
$fields->addFieldToTab('Root.Main', new DropdownField('OwnerID', 'Blog owner', array_merge(array('' => "(None)"), $blogOwners->map('ID', 'Name')->toArray())), "Content");
|
$fields->addFieldToTab('Root.Main', new DropdownField('OwnerID', 'Blog owner', array_merge(array('' => "(None)"), $blogOwners->map('ID', 'Name')->toArray())), "Content");
|
||||||
$fields->addFieldToTab('Root.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field'), "Content");
|
$fields->addFieldToTab('Root.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field'), "Content");
|
||||||
|
$fields->addFieldToTab("Root.Main", new CheckboxField("ShowFullEntry", "Show Full Entry"), "Content");
|
||||||
|
|
||||||
$this->extend('updateCMSFields', $fields);
|
$this->extend('updateCMSFields', $fields);
|
||||||
|
|
||||||
|
@ -9,8 +9,12 @@
|
|||||||
<% end_loop %>
|
<% end_loop %>
|
||||||
</p>
|
</p>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
|
||||||
<p>$Content.FirstParagraph(html)</p>
|
<% if BlogHolder.ShowFullEntry %>
|
||||||
|
$Content
|
||||||
|
<% else %>
|
||||||
|
<p>$Content.FirstParagraph(html)</p>
|
||||||
|
<% end_if %>
|
||||||
|
|
||||||
<p class="blogVitals"><a href="$Link#PageComments_holder" class="comments" title="View Comments for this post">$Comments.Count comments</a> | <a href="$Link" class="readmore" title="Read Full Post">Read the full post</a></p>
|
<p class="blogVitals"><a href="$Link#PageComments_holder" class="comments" title="View Comments for this post">$Comments.Count comments</a> | <a href="$Link" class="readmore" title="Read Full Post">Read the full post</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user