mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Update theme
This commit is contained in:
parent
1219d3a019
commit
f4e431da27
@ -266,21 +266,21 @@ class Blog_Controller extends Page_Controller {
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of paginated blog posts based on the blogPost dataList
|
||||
* If pagination is enabled, this returns a list of paginated blog posts
|
||||
* based on the blogPost dataList. Otherwise a simple list will be returned.
|
||||
*
|
||||
* @return PaginatedList
|
||||
* @return SS_List
|
||||
**/
|
||||
public function PaginatedList() {
|
||||
$posts = new PaginatedList($this->blogPosts);
|
||||
|
||||
// If pagination is set to '0' then no pagination will be shown.
|
||||
if($this->PostsPerPage > 0) $posts->setPageLength($this->PostsPerPage);
|
||||
else $posts->setPageLength($this->getBlogPosts()->count());
|
||||
|
||||
$start = $this->request->getVar($posts->getPaginationGetVar());
|
||||
$posts->setPageStart($start);
|
||||
|
||||
return $posts;
|
||||
// Set page size
|
||||
if($this->PostsPerPage > 0) {
|
||||
$posts = new PaginatedList($this->blogPosts, $this->request);
|
||||
$posts->setPageLength($this->PostsPerPage);
|
||||
return $posts;
|
||||
} else {
|
||||
// If there is no pagination, return the unpaginated list
|
||||
return $this->blogPosts;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,7 +75,7 @@ class BlogPost extends Page {
|
||||
|
||||
// We're going to add the url segment to sidebar so we're making it a little lighter
|
||||
$urlSegment = $fields->dataFieldByName('URLSegment');
|
||||
$urlSegment->setURLPrefix('/' . Director::makeRelative($self->Parent()->Link()));
|
||||
$urlSegment->setURLPrefix($self->Parent()->RelativeLink());
|
||||
|
||||
// Remove the MenuTitle and URLSegment from the main tab
|
||||
$fields->removeFieldsFromTab('Root.Main', array(
|
||||
|
43
css/blog.css
Executable file
43
css/blog.css
Executable file
@ -0,0 +1,43 @@
|
||||
.blog-sidebar {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.blog-sidebar .secondary {
|
||||
margin-bottom: 35px;
|
||||
}
|
||||
|
||||
#Form_CommentsForm + h4 {
|
||||
clear: both;
|
||||
padding-top: 35px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.typography ul.comments-list {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.typography ul.comments-list > li {
|
||||
list-style: none;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.typography ul.comments-list > li .action-links {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.typography ul.comments-list > li .action-links li {
|
||||
list-style: none;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.commenting-rss-feed {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
.blog-sidebar {
|
||||
width: 100%; /* sidenav is now shown above the page content */
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
}
|
3
templates/Includes/BlogSideBar.ss
Normal file
3
templates/Includes/BlogSideBar.ss
Normal file
@ -0,0 +1,3 @@
|
||||
<aside class="blog-sidebar unit size1of4">
|
||||
$SideBarView
|
||||
</aside>
|
17
templates/Includes/EntryMeta.ss
Normal file
17
templates/Includes/EntryMeta.ss
Normal file
@ -0,0 +1,17 @@
|
||||
<p>
|
||||
This entry was
|
||||
<% if Categories %>
|
||||
posted in
|
||||
<% loop Categories %>
|
||||
<a href="$Link" title="$Title">$Title</a><% if not Last %>, <% else_if Up.Tags %>, <% else %> and<% end_if %>
|
||||
<% end_loop %>
|
||||
<% end_if %>
|
||||
<% if Tags %>
|
||||
tagged
|
||||
<% loop Tags %>
|
||||
<a href="$Link" title="$Title">$Title</a><% if not Last %>, <% end_if %>
|
||||
<% end_loop %>
|
||||
and
|
||||
<% end_if %>
|
||||
posted on <a href="$MonthlyArchiveLink">$PublishDate.format("F j, Y")</a>
|
||||
</p>
|
64
templates/Layout/Blog.ss
Normal file
64
templates/Layout/Blog.ss
Normal file
@ -0,0 +1,64 @@
|
||||
<% require css(themes/simple_blog/css/blog.css) %>
|
||||
|
||||
<% include BlogSideBar %>
|
||||
<div class="unit size3of4 lastUnit searchResults">
|
||||
<h1>
|
||||
<% if ArchiveYear %>
|
||||
Archive: <% if ArchiveDay %>$ArchiveDate.Nice<% else_if ArchiveMonth %>$ArchiveDate.format("F, Y")<% else %>$ArchiveDate.format(Y)<% end_if %>
|
||||
<% else_if CurrentTag %>
|
||||
Tag: $CurrentTag.Title
|
||||
<% else_if CurrentCategory %>
|
||||
Category: $CurrentCategory.Title
|
||||
<% else %>
|
||||
$Title
|
||||
<% end_if %>
|
||||
</h1>
|
||||
|
||||
<% if PaginatedList %>
|
||||
<ul id="SearchResults">
|
||||
<% loop PaginatedList %>
|
||||
<li class="clear">
|
||||
<% if FeaturedImage %>
|
||||
<img src="$FeaturedImage.CroppedImage(200, 120).URL" alt="$FeaturedImage.Title" class="left" />
|
||||
<% end_if %>
|
||||
<h4>
|
||||
<a href="$Link">
|
||||
<% if $MenuTitle %>
|
||||
$MenuTitle
|
||||
<% else %>
|
||||
$Title
|
||||
<% end_if %>
|
||||
</a>
|
||||
</h4>
|
||||
<% if $Excerpt %>
|
||||
<p>$Excerpt</p>
|
||||
<% end_if %>
|
||||
<a class="readMoreLink" href="$Link" title="Read more about "{$Title}"">Read more about "{$Title}"...</a>
|
||||
</li>
|
||||
<% end_loop %>
|
||||
</ul>
|
||||
<% else %>
|
||||
<div class="content"><p>No Posts</p></div>
|
||||
<% end_if %>
|
||||
|
||||
<% if PaginatedList.MoreThanOnePage %>
|
||||
<div id="PageNumbers">
|
||||
<div class="pagination">
|
||||
<% if PaginatedList.NotFirstPage %>
|
||||
<a class="prev" href="$PaginatedList.PrevLink" title="View the previous page">←</a>
|
||||
<% end_if %>
|
||||
<% loop PaginatedList.Pages %>
|
||||
<% if $CurrentBool %>
|
||||
$PageNum
|
||||
<% else %>
|
||||
<a href="$Link" title="View page number $PageNum" class="go-to-page">$PageNum</a>
|
||||
<% end_if %>
|
||||
<% end_loop %>
|
||||
<% if PaginatedList.NotLastPage %>
|
||||
<a class="next" href="$PaginatedList.NextLink" title="View the next page">→</a>
|
||||
<% end_if %>
|
||||
</div>
|
||||
<p>Page $PaginatedList.CurrentPage of $PaginatedList.TotalPages</p>
|
||||
</div>
|
||||
<% end_if %>
|
||||
</div>
|
17
templates/Layout/BlogPost.ss
Normal file
17
templates/Layout/BlogPost.ss
Normal file
@ -0,0 +1,17 @@
|
||||
<% require css(themes/simple_blog/css/blog.css) %>
|
||||
|
||||
<% include BlogSideBar %>
|
||||
<div class="unit size3of4 lastUnit">
|
||||
<article>
|
||||
<h1>$Title</h1>
|
||||
|
||||
<% if FeaturedImage %>
|
||||
<img src="$FeaturedImage.URL" alt="$FeaturedImage.Title" class="center" />
|
||||
<% end_if %>
|
||||
|
||||
<div class="content">$Content</div>
|
||||
|
||||
<% include EntryMeta %>
|
||||
</article>
|
||||
$PageComments
|
||||
</div>
|
4
templates/WidgetHolder.ss
Normal file
4
templates/WidgetHolder.ss
Normal file
@ -0,0 +1,4 @@
|
||||
<nav class="secondary">
|
||||
<h3>$Title</h3>
|
||||
$Content
|
||||
</nav>
|
7
templates/widgets/BlogArchiveWidget.ss
Executable file → Normal file
7
templates/widgets/BlogArchiveWidget.ss
Executable file → Normal file
@ -1,7 +1,12 @@
|
||||
<% if Archive %>
|
||||
<ul>
|
||||
<% loop Archive %>
|
||||
<li><a href="$Link" title="$Title">$Title</a></li>
|
||||
<li>
|
||||
<a href="$Link" title="$Title">
|
||||
<span class="arrow">→</span>
|
||||
<span class="text">$Title</span>
|
||||
</a>
|
||||
</li>
|
||||
<% end_loop %>
|
||||
</ul>
|
||||
<% end_if %>
|
11
templates/widgets/BlogCategoriesWidget.ss
Executable file → Normal file
11
templates/widgets/BlogCategoriesWidget.ss
Executable file → Normal file
@ -1,7 +1,12 @@
|
||||
<% if Categories %>
|
||||
<% if $Categories %>
|
||||
<ul>
|
||||
<% loop Categories %>
|
||||
<li><a href="$Link" title="$Title">$Title</a></li>
|
||||
<% loop $Categories %>
|
||||
<li>
|
||||
<a href="$Link" title="$Title">
|
||||
<span class="arrow">→</span>
|
||||
<span class="text">$Title</span>
|
||||
</a>
|
||||
</li>
|
||||
<% end_loop %>
|
||||
</ul>
|
||||
<% end_if %>
|
11
templates/widgets/BlogRecentPostsWidget.ss
Executable file → Normal file
11
templates/widgets/BlogRecentPostsWidget.ss
Executable file → Normal file
@ -1,7 +1,12 @@
|
||||
<% if Posts %>
|
||||
<% if $Posts %>
|
||||
<ul>
|
||||
<% loop Posts %>
|
||||
<li><a href="$Link" title="$Title">$Title</a></li>
|
||||
<% loop $Posts %>
|
||||
<li>
|
||||
<a href="$Link" title="$Title">
|
||||
<span class="arrow">→</span>
|
||||
<span class="text">$Title</span>
|
||||
</a>
|
||||
</li>
|
||||
<% end_loop %>
|
||||
</ul>
|
||||
<% end_if %>
|
11
templates/widgets/BlogTagsWidget.ss
Executable file → Normal file
11
templates/widgets/BlogTagsWidget.ss
Executable file → Normal file
@ -1,7 +1,12 @@
|
||||
<% if Tags %>
|
||||
<% if $Tags %>
|
||||
<ul>
|
||||
<% loop Tags %>
|
||||
<li><a href="$Link" title="$Title">$Title</a></li>
|
||||
<% loop $Tags %>
|
||||
<li>
|
||||
<a href="$Link" title="$Title">
|
||||
<span class="arrow">→</span>
|
||||
<span class="text">$Title</span>
|
||||
</a>
|
||||
</li>
|
||||
<% end_loop %>
|
||||
</ul>
|
||||
<% end_if %>
|
Loading…
Reference in New Issue
Block a user