diff --git a/code/model/Blog.php b/code/model/Blog.php
index 7b98869..7dbfd46 100644
--- a/code/model/Blog.php
+++ b/code/model/Blog.php
@@ -274,8 +274,12 @@ class Blog_Controller extends Page_Controller {
$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());
+ if($this->PostsPerPage > 0) {
+ $posts->setPageLength($this->PostsPerPage);
+ } else {
+ $pageSize = $this->getBlogPosts()->count() ?: 99999;
+ $posts->setPageLength($pageSize);
+ }
$start = $this->request->getVar($posts->getPaginationGetVar());
$posts->setPageStart($start);
diff --git a/code/model/BlogPost.php b/code/model/BlogPost.php
index e4b0cb9..1c9ade1 100644
--- a/code/model/BlogPost.php
+++ b/code/model/BlogPost.php
@@ -41,6 +41,10 @@ class BlogPost extends Page {
"Title",
);
+ private static $casting = array(
+ 'Excerpt' => 'Text'
+ );
+
private static $allowed_children = array();
private static $default_sort = "PublishDate DESC";
@@ -75,7 +79,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(
@@ -117,7 +121,7 @@ class BlogPost extends Page {
/**
* If no publish date is set, set the date to now.
**/
- public function onBeforeWrite() {
+ protected function onBeforeWrite() {
parent::onBeforeWrite();
if(!$this->PublishDate) $this->setCastedField("PublishDate", time());
}
diff --git a/css/blog.css b/css/blog.css
new file mode 100755
index 0000000..ed5df79
--- /dev/null
+++ b/css/blog.css
@@ -0,0 +1,43 @@
+.no-sidebar .content-container.size3of4 {
+ width: 75%;
+}
+
+.blog-entry .post-image img {
+ width: 98.75%;
+}
+
+.blog-sidebar .WidgetHolder ul {
+ margin-left: 0;
+}
+ .blog-sidebar .WidgetHolder ul li {
+ list-style-type: none;
+ }
+
+#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;
+}
diff --git a/lang/en.yml b/lang/en.yml
index fa656fa..4b94e0e 100755
--- a/lang/en.yml
+++ b/lang/en.yml
@@ -1,38 +1,62 @@
en:
+ Blog:
+ Archive: Archive
+ Categories: Categories
+ Category: Category
+ Comments: Comments
+ DESCRIPTION: 'Adds a blog to your website.'
+ LumberjackTitle: 'Blog Posts'
+ NoPosts: 'There are no posts'
+ PLURALNAME: Blogs
+ Posted: Posted
+ PostedIn: 'Posted in'
+ PostsPerPage: 'Posts Per Page'
+ ReadMoreAbout: 'Read more about ''{title}''...'
+ SINGULARNAME: Blog
+ Tag: Tag
+ Tagged: Tagged
+ Tags: Tags
+ BlogArchiveWidget:
+ Blog: Blog
+ NumberToDisplay: 'No. to Display'
+ PLURALNAME: 'Blog Archive Widgets'
+ SINGULARNAME: 'Blog Archive Widget'
+ Type: Type
+ BlogCategoriesWidget:
+ Blog: Blog
+ PLURALNAME: 'Blog Categories Widgets'
+ SINGULARNAME: 'Blog Categories Widget'
+ BlogCategory:
+ PLURALNAME: 'Blog Categories'
+ SINGULARNAME: 'Blog Category'
+ Title: Title
+ BlogPost:
+ Categories: Categories
+ DESCRIPTION: 'Generic content page'
+ FeaturedImage: 'Featured Image'
+ PLURALNAME: 'Blog Posts'
+ PageTitleLabel: 'Post Title'
+ PublishDate: 'Publish Date'
+ SINGULARNAME: 'Blog Post'
+ Tags: Tags
+ BlogRecentPostsWidget:
+ Blog: Blog
+ NumberOfPosts: 'Number of Posts'
+ PLURALNAME: 'Blog Recent Posts Widgets'
+ SINGULARNAME: 'Blog Recent Posts Widget'
+ BlogTag:
+ PLURALNAME: 'Blog Tags'
+ SINGULARNAME: 'Blog Tag'
+ Title: Title
+ BlogTagsWidget:
+ Blog: Blog
+ PLURALNAME: 'Blog Tags Widgets'
+ SINGULARNAME: 'Blog Tags Widget'
GridFieldAddByDBField:
+ Add: 'Add {name}'
AddFail: 'Unable to save {class} to the database.'
PermissionFail: 'You don''t have permission to create a {class}.'
- Add: 'Add {name}'
GridFieldBlogPostState:
- StateTitle: 'State'
- Draft: ' Saved as Draft on {date}'
- Published: ' Published on {date}'
- Timer: ' Publish at {date}'
- Modified: 'Modified'
- BlogPost:
- PublishDate: 'Publish Date'
- Categories: 'Categories'
- Tags: 'Tags'
- FeaturedImage: 'Featured Image'
- PageTitleLabel: 'Post Title'
- Blog:
- BlogPosts: 'Blog Posts'
- Categories: 'Categories'
- Tags: 'Tags'
- PostsPerPage: 'Posts Per Page'
- BlogTag:
- Title: 'Title'
- BlogCategory:
- Title: 'Title'
- BlogRecentPostsWidget:
- Blog: 'Blog'
- NumberOfPosts: 'Number of Posts'
- BlogCategoriesWidget:
- Blog: 'Blog'
- BlogArchiveWidget:
- Blog: 'Blog'
- Monthly: 'Monthly'
- Yearly: 'Yearly'
- NumberToDisplay: 'Number to Display'
- BlogTagsWidget:
- Blog: 'Blog'
\ No newline at end of file
+ Draft: ' Saved as Draft on {date}'
+ Published: ' Published on {date}'
+ Timer: ' Publish at {date}'
diff --git a/templates/Includes/BlogSideBar.ss b/templates/Includes/BlogSideBar.ss
new file mode 100644
index 0000000..840df55
--- /dev/null
+++ b/templates/Includes/BlogSideBar.ss
@@ -0,0 +1,5 @@
+<% if $SideBarView %>
+
+<% end_if %>
diff --git a/templates/Includes/EntryMeta.ss b/templates/Includes/EntryMeta.ss
new file mode 100644
index 0000000..b2467aa
--- /dev/null
+++ b/templates/Includes/EntryMeta.ss
@@ -0,0 +1,25 @@
+
+ <% if $Categories.exists %>
+ <%t Blog.PostedIn "Posted in" %>
+ <% loop $Categories %>
+ $Title <% if not Last %>, <% else %>;<% end_if %>
+ <% end_loop %>
+ <% end_if %>
+
+ <% if $Tags.exists %>
+ <%t Blog.Tagged "Tagged" %>
+ <% loop $Tags %>
+ $Title <% if not Last %>, <% else %>;<% end_if %>
+ <% end_loop %>
+ <% end_if %>
+
+ <% if $Comments.exists %>
+
+ <%t Blog.Comments "Comments" %>
+ $Comments.count
+ ;
+ <% end_if %>
+
+ <%t Blog.Posted "Posted" %>
+ $PublishDate.ago
+
diff --git a/templates/Includes/Pagination.ss b/templates/Includes/Pagination.ss
new file mode 100644
index 0000000..1a20c7e
--- /dev/null
+++ b/templates/Includes/Pagination.ss
@@ -0,0 +1,25 @@
+<%-- NOTE: Before including this, you will need to wrap the include in a with block --%>
+
+<% if $MoreThanOnePage %>
+
+<% end_if %>
diff --git a/templates/Layout/Blog.ss b/templates/Layout/Blog.ss
new file mode 100644
index 0000000..a736f39
--- /dev/null
+++ b/templates/Layout/Blog.ss
@@ -0,0 +1,72 @@
+<% require themedCSS('blog', 'blog') %>
+
+
+
+<% include BlogSideBar %>
diff --git a/templates/Layout/BlogPost.ss b/templates/Layout/BlogPost.ss
new file mode 100644
index 0000000..3a34c6e
--- /dev/null
+++ b/templates/Layout/BlogPost.ss
@@ -0,0 +1,20 @@
+<% require themedCSS('blog', 'blog') %>
+
+
+
+<% include BlogSideBar %>
diff --git a/templates/WidgetHolder.ss b/templates/WidgetHolder.ss
new file mode 100644
index 0000000..f73142e
--- /dev/null
+++ b/templates/WidgetHolder.ss
@@ -0,0 +1,4 @@
+
+ $Title
+ $Content
+
\ No newline at end of file
diff --git a/templates/widgets/BlogArchiveWidget.ss b/templates/widgets/BlogArchiveWidget.ss
old mode 100755
new mode 100644
index 5a30f2b..bba3265
--- a/templates/widgets/BlogArchiveWidget.ss
+++ b/templates/widgets/BlogArchiveWidget.ss
@@ -1,7 +1,12 @@
-<% if Archive %>
+<% if $Archive %>
-<% end_if %>
\ No newline at end of file
+<% end_if %>
diff --git a/templates/widgets/BlogCategoriesWidget.ss b/templates/widgets/BlogCategoriesWidget.ss
old mode 100755
new mode 100644
index 395a87c..558f09f
--- a/templates/widgets/BlogCategoriesWidget.ss
+++ b/templates/widgets/BlogCategoriesWidget.ss
@@ -1,7 +1,12 @@
-<% if Categories %>
+<% if $Categories %>
<% end_if %>
\ No newline at end of file
diff --git a/templates/widgets/BlogRecentPostsWidget.ss b/templates/widgets/BlogRecentPostsWidget.ss
old mode 100755
new mode 100644
index c1905e4..0dfc2a2
--- a/templates/widgets/BlogRecentPostsWidget.ss
+++ b/templates/widgets/BlogRecentPostsWidget.ss
@@ -1,7 +1,12 @@
-<% if Posts %>
+<% if $Posts %>
<% end_if %>
\ No newline at end of file
diff --git a/templates/widgets/BlogTagsWidget.ss b/templates/widgets/BlogTagsWidget.ss
old mode 100755
new mode 100644
index faa10a0..4fcb1dc
--- a/templates/widgets/BlogTagsWidget.ss
+++ b/templates/widgets/BlogTagsWidget.ss
@@ -1,7 +1,12 @@
-<% if Tags %>
+<% if $Tags %>
<% end_if %>
\ No newline at end of file