mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Created initial concept for blog UI rework
This commit is contained in:
parent
c31a45497d
commit
f6c35d67e6
5
code/forms/BlogAdminSidebar.php
Normal file
5
code/forms/BlogAdminSidebar.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class BlogAdminSidebar extends FieldGroup {
|
||||
|
||||
}
|
@ -62,8 +62,24 @@ class BlogPost extends Page {
|
||||
|
||||
$self =& $this;
|
||||
$this->beforeUpdateCMSFields(function($fields) use ($self) {
|
||||
$fields->addFieldsToTab('Root.Main', array(
|
||||
HeaderField::create('Post Options', 3),
|
||||
|
||||
// Add featured image
|
||||
$fields->insertBefore(
|
||||
$uploadField = UploadField::create("FeaturedImage", _t("BlogPost.FeaturedImage", "Featured Image")),
|
||||
"Content"
|
||||
);
|
||||
$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
|
||||
|
||||
// Now we're going to create the blog options panel.
|
||||
$menuTitle = $fields->dataFieldByName('MenuTitle');
|
||||
$urlSegment = $fields->dataFieldByName('URLSegment');
|
||||
$fields->removeFieldsFromTab('Root.Main', array(
|
||||
'MenuTitle',
|
||||
'URLSegment',
|
||||
));
|
||||
$options = BlogAdminSidebar::create(
|
||||
$menuTitle,
|
||||
$urlSegment,
|
||||
$publishDate = DatetimeField::create("PublishDate", _t("BlogPost.PublishDate", "Publish Date")),
|
||||
ListboxField::create(
|
||||
"Categories",
|
||||
@ -75,40 +91,13 @@ class BlogPost extends Page {
|
||||
_t("BlogPost.Tags", "Tags"),
|
||||
$self->Parent()->Tags()->map()->toArray()
|
||||
)->setMultiple(true)
|
||||
));
|
||||
)->setTitle('Post Options');
|
||||
$fields->insertBefore($options, 'Root');
|
||||
$publishDate->getDateField()->setConfig("showcalendar", true);
|
||||
|
||||
// Add featured image
|
||||
$fields->insertBefore(
|
||||
$uploadField = UploadField::create("FeaturedImage", _t("BlogPost.FeaturedImage", "Featured Image")),
|
||||
"Content"
|
||||
);
|
||||
$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
|
||||
});
|
||||
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
// We're going to make an SEO tab and move all the usual crap there
|
||||
$menuTitle = $fields->dataFieldByName('MenuTitle');
|
||||
$urlSegment = $fields->dataFieldByName('URLSegment');
|
||||
$fields->addFieldsToTab('Root.SEO', array(
|
||||
$menuTitle,
|
||||
$urlSegment,
|
||||
));
|
||||
|
||||
$metaField = $fields->fieldByName('Root.Main.Metadata');
|
||||
if($metaField) {
|
||||
$metaFields = $metaField->getChildren();
|
||||
if($metaFields->count() > 0) {
|
||||
$tab = $fields->findOrMakeTab('Root.SEO');
|
||||
$tab->push(HeaderField::create('Meta', 3));
|
||||
foreach($metaFields as $field) {
|
||||
$tab->push($field);
|
||||
}
|
||||
}
|
||||
$fields->removeByName('Metadata');
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
19
css/cms.css
19
css/cms.css
@ -21,3 +21,22 @@
|
||||
clear: none;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/* line 23, ../scss/cms.scss */
|
||||
.blog-admin-sidebar {
|
||||
width: 280px !important;
|
||||
border-right: none;
|
||||
border-left: 1px solid #C0C0C2;
|
||||
height: 547px;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
}
|
||||
/* line 31, ../scss/cms.scss */
|
||||
.blog-admin-sidebar ~ .ss-tabset {
|
||||
width: 866px;
|
||||
float: left;
|
||||
}
|
||||
/* line 37, ../scss/cms.scss */
|
||||
.blog-admin-sidebar.cms-content-tools .cms-panel-content {
|
||||
width: auto;
|
||||
}
|
||||
|
@ -19,3 +19,23 @@
|
||||
clear: none;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.blog-admin-sidebar {
|
||||
width: 280px !important;
|
||||
border-right: none;
|
||||
border-left: 1px solid #C0C0C2;
|
||||
height: 547px;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
|
||||
~ .ss-tabset {
|
||||
width: 866px;
|
||||
float:left;
|
||||
}
|
||||
|
||||
&.cms-content-tools {
|
||||
.cms-panel-content {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
17
templates/BlogAdminSidebar_holder.ss
Normal file
17
templates/BlogAdminSidebar_holder.ss
Normal file
@ -0,0 +1,17 @@
|
||||
<div class="cms-content-tools west cms-panel cms-panel-layout blog-admin-sidebar" data-expandOnClick="true" data-layout-type="border" id="blog-admin-sidebar">
|
||||
<div class="cms-panel-content center">
|
||||
<div class="cms-content-view cms-tree-view-sidebar" id="blog-admin-content">
|
||||
<h3 class="cms-panel-header">$Title</h3>
|
||||
<% loop $Children %>
|
||||
$FieldHolder
|
||||
<% end_loop %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cms-panel-content-collapsed">
|
||||
<h3 class="cms-panel-header">$Title</h3>
|
||||
</div>
|
||||
<div class="cms-panel-toggle south">
|
||||
<a class="toggle-expand" href="#"><span>«</span></a>
|
||||
<a class="toggle-collapse" href="#"><span>»</span></a>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user