Added merging of tags and categories

This commit is contained in:
Christopher Pitt 2015-04-21 16:47:46 +12:00
parent 09145a25f7
commit 5d9ed5b9e0
7 changed files with 333 additions and 91 deletions

View File

@ -0,0 +1,51 @@
<?php
class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor {
/**
* @param int $itemsPerPage
* @param array|SS_List $mergeRecords
* @param string $parentType
* @param string $parentMethod
* @param string $childMethod
*/
public function __construct($itemsPerPage = 15, $mergeRecords, $parentType, $parentMethod, $childMethod) {
parent::__construct($itemsPerPage);
$this->removeComponentsByType("GridFieldAddNewButton");
$this->addComponent(
new GridFieldAddByDBField("buttons-before-left")
);
$this->addComponent(
new GridFieldMergeAction($mergeRecords, $parentType, $parentMethod, $childMethod)
);
$columns = $this->getComponentByType('GridFieldDataColumns');
$columns->setFieldFormatting(array(
'BlogPostsCount' => function($value, &$item) {
return $item->BlogPosts()->Count();
}
));
$this->changeColumnOrder();
}
/**
* Reorders GridField columns so that Actions is last.
*/
protected function changeColumnOrder() {
/**
* @var GridFieldDataColumns $columns
*/
$columns = $this->getComponentByType('GridFieldDataColumns');
$columns->setDisplayFields(array(
'Title' => 'Title',
'BlogPostsCount' => 'Posts',
'MergeAction' => 'MergeAction',
'Actions' => 'Actions',
));
}
}

View File

@ -0,0 +1,28 @@
<?php
class GridFieldFormAction extends GridField_FormAction {
/**
* @var array
*/
protected $extraAttributes = array();
/**
* @param array $attributes
*/
public function setExtraAttributes(array $attributes) {
$this->extraAttributes = $attributes;
}
/**
* @return array
*/
public function getAttributes()
{
$attributes = parent::getAttributes();
return array_merge(
$attributes,
$this->extraAttributes
);
}
}

View File

@ -0,0 +1,140 @@
<?php
class GridFieldMergeAction implements GridField_ColumnProvider, GridField_ActionProvider {
/**
* List of records to show in the MergeAction column.
*
* @var array|SS_List
*/
protected $records;
/**
* Type of parent DataObject (i.e BlogTag, BlogCategory).
*
* @var string
*/
protected $parentType;
/**
* Relationship method to reference parent (i.e BlogTags).
*
* @var string
*/
protected $parentMethod;
/**
* Relationship method to reference child (i.e BlogPosts).
*
* @var string
*/
protected $childMethod;
/**
* @param array|SS_List $records
* @param string $parentType
* @param string $parentMethod
* @param string $childMethod
*/
public function __construct($records = array(), $parentType, $parentMethod, $childMethod) {
$this->records = $records;
$this->parentType = $parentType;
$this->parentMethod = $parentMethod;
$this->childMethod = $childMethod;
}
/**
* {@inheritdoc}
*/
public function augmentColumns($gridField, &$columns) {
if(!in_array('MergeAction', $columns)) {
$columns[] = 'MergeAction';
}
return $columns;
}
/**
* {@inheritdoc}
*/
public function getColumnsHandled($gridField) {
return array('MergeAction');
}
/**
* {@inheritdoc}
*/
public function getColumnContent($gridField, $record, $columnName) {
if($columnName === 'MergeAction') {
$dropdown = new DropdownField('Target', 'Target', $this->records->map());
$prefix = strtolower($this->parentMethod . '-' . $this->childMethod);
$action = GridFieldFormAction::create(
$gridField,
'MergeAction' . $record->ID,
'Move',
'merge',
array(
'record' => $record->ID,
'target' => $prefix . '-target-record-' . $record->ID,
)
);
$action->setExtraAttributes(array(
'data-target' => $prefix . '-target-record-' . $record->ID
));
return $dropdown->Field() . $action->Field() . '<a class="MergeActionReveal">move posts to</a>';
}
return null;
}
/**
* {@inheritdoc}
*/
public function getColumnAttributes($gridField, $record, $columnName) {
return array('class' => 'MergeAction');
}
/**
* {@inheritdoc}
*/
public function getColumnMetadata($gridField, $columnName) {
return array('title' => 'Move Posts To');
}
/**
* {@inheritdoc}
*/
public function getActions($gridField) {
return array('merge');
}
/**
* {@inheritdoc}
*/
public function handleAction(GridField $gridField, $actionName, $arguments, $data) {
if($actionName === 'merge') {
$controller = Controller::curr();
$request = $controller->getRequest();
$target = $request->requestVar($arguments["target"]);
$parentType = $this->parentType;
$fromParent = $parentType::get()->byId($arguments['record']);
$toParent = $parentType::get()->byId($target);
$posts = $fromParent->{$this->childMethod}();
foreach ($posts as $post) {
$relationship = $post->{$this->parentMethod}();
$relationship->remove($fromParent);
$relationship->add($toParent);
}
}
}
}

View File

@ -5,7 +5,7 @@
* *
* @package silverstripe * @package silverstripe
* @subpackage blog * @subpackage blog
* *
* @method HasManyList Tags() List of tags in this blog * @method HasManyList Tags() List of tags in this blog
* @method HasManyList Categories() List of categories in this blog * @method HasManyList Categories() List of categories in this blog
* @method ManyManyList Editors() List of editors * @method ManyManyList Editors() List of editors
@ -13,7 +13,7 @@
* @method ManyManyList Contributors() List of contributors * @method ManyManyList Contributors() List of contributors
* *
* @author Michael Strong <github@michaelstrong.co.uk> * @author Michael Strong <github@michaelstrong.co.uk>
**/ **/
class Blog extends Page implements PermissionProvider { class Blog extends Page implements PermissionProvider {
/** /**
@ -63,7 +63,7 @@ class Blog extends Page implements PermissionProvider {
'Writers' => 'Member', 'Writers' => 'Member',
'Contributors' => 'Member', 'Contributors' => 'Member',
); );
private static $allowed_children = array( private static $allowed_children = array(
"BlogPost", "BlogPost",
); );
@ -80,41 +80,38 @@ class Blog extends Page implements PermissionProvider {
public function getCMSFields() { public function getCMSFields() {
Requirements::css(BLOGGER_DIR . '/css/cms.css'); Requirements::css(BLOGGER_DIR . '/css/cms.css');
Requirements::javascript(BLOGGER_DIR . '/js/expandable-help-text.js'); Requirements::javascript(BLOGGER_DIR . '/js/expandable-help-text.js');
Requirements::javascript(BLOGGER_DIR . '/js/merge-action.js');
$self =& $this; $self =& $this;
$this->beforeUpdateCMSFields(function($fields) use ($self) {
// Don't show this tab if edit is not allowed $this->beforeUpdateCMSFields(function ($fields) use ($self) {
if(!$self->canEdit()) return; if(!$self->canEdit()) {
return;
// Create categories and tag config }
$config = GridFieldConfig_RecordEditor::create();
$config->removeComponentsByType("GridFieldAddNewButton");
$config->addComponent(new GridFieldAddByDBField("buttons-before-left"));
$categories = GridField::create( $categories = GridField::create(
"Categories", "Categories",
_t("Blog.Categories", "Categories"), _t("Blog.Categories", "Categories"),
$self->Categories(), $self->Categories(),
$config GridFieldCategorisationConfig::create(15, $self->Categories(), 'BlogCategory', 'Categories', 'BlogPosts')
); );
$tags = GridField::create( $tags = GridField::create(
"Tags", "Tags",
_t("Blog.Tags", "Tags"), _t("Blog.Tags", "Tags"),
$self->Tags(), $self->Tags(),
$config GridFieldCategorisationConfig::create(15, $self->Categories(), 'BlogTag', 'Tags', 'BlogPosts')
); );
$fields->addFieldsToTab("Root.BlogOptions", array( $fields->addFieldsToTab("Root.Categorisation", array(
$categories, $categories,
$tags $tags
)); ));
}); });
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();
return $fields; return $fields;
} }
@ -122,6 +119,7 @@ class Blog extends Page implements PermissionProvider {
* Check if this member is an editor of the blog * Check if this member is an editor of the blog
* *
* @param Member $member * @param Member $member
*
* @return boolean * @return boolean
*/ */
public function isEditor($member) { public function isEditor($member) {
@ -134,6 +132,7 @@ class Blog extends Page implements PermissionProvider {
* Check if this member is a writer of the blog * Check if this member is a writer of the blog
* *
* @param Member $member * @param Member $member
*
* @return boolean * @return boolean
*/ */
public function isWriter($member) { public function isWriter($member) {
@ -146,6 +145,7 @@ class Blog extends Page implements PermissionProvider {
* Check if this member is a contributor of the blog * Check if this member is a contributor of the blog
* *
* @param Member $member * @param Member $member
*
* @return boolean * @return boolean
*/ */
public function isContributor($member) { public function isContributor($member) {
@ -161,6 +161,7 @@ class Blog extends Page implements PermissionProvider {
* E.g. `Hello $RoleOf($CurrentMember.ID)` * E.g. `Hello $RoleOf($CurrentMember.ID)`
* *
* @param Member|integer $member * @param Member|integer $member
*
* @return string|null Author, Editor, Writer, Contributor, or null if no role * @return string|null Author, Editor, Writer, Contributor, or null if no role
*/ */
public function RoleOf($member) { public function RoleOf($member) {
@ -178,6 +179,7 @@ class Blog extends Page implements PermissionProvider {
* *
* @param Member $member * @param Member $member
* @param DataList $list Relation to check * @param DataList $list Relation to check
*
* @return boolean * @return boolean
*/ */
protected function isMemberOf($member, $list) { protected function isMemberOf($member, $list) {
@ -191,11 +193,10 @@ class Blog extends Page implements PermissionProvider {
} }
public function canEdit($member = null) { public function canEdit($member = null) {
$member = $member ?: Member::currentUser(); $member = $member ?: Member::currentUser();
if(is_numeric($member)) $member = Member::get()->byID($member); if(is_numeric($member)) $member = Member::get()->byID($member);
// Allow editors to edit this page // Allow editors to edit this page
if($this->isEditor($member)) return true; if($this->isEditor($member)) return true;
@ -206,6 +207,7 @@ class Blog extends Page implements PermissionProvider {
* Determine if this user can edit the editors list * Determine if this user can edit the editors list
* *
* @param Member $member * @param Member $member
*
* @return boolean * @return boolean
*/ */
public function canEditEditors($member = null) { public function canEditEditors($member = null) {
@ -222,6 +224,7 @@ class Blog extends Page implements PermissionProvider {
* Determine if this user can edit writers list * Determine if this user can edit writers list
* *
* @param Member $member * @param Member $member
*
* @return boolean * @return boolean
*/ */
public function canEditWriters($member = null) { public function canEditWriters($member = null) {
@ -242,12 +245,13 @@ class Blog extends Page implements PermissionProvider {
* Determines if this user can edit the contributors list * Determines if this user can edit the contributors list
* *
* @param type $member * @param type $member
*
* @return boolean * @return boolean
*/ */
public function canEditContributors($member = null) { public function canEditContributors($member = null) {
$member = $member ?: Member::currentUser(); $member = $member ?: Member::currentUser();
if(is_numeric($member)) $member = Member::get()->byID($member); if(is_numeric($member)) $member = Member::get()->byID($member);
$extended = $this->extendedCan('canEditContributors', $member); $extended = $this->extendedCan('canEditContributors', $member);
if($extended !== null) return $extended; if($extended !== null) return $extended;
@ -273,7 +277,7 @@ class Blog extends Page implements PermissionProvider {
public function getSettingsFields() { public function getSettingsFields() {
$fields = parent::getSettingsFields(); $fields = parent::getSettingsFields();
$fields->addFieldToTab("Root.Settings", $fields->addFieldToTab("Root.Settings",
NumericField::create("PostsPerPage", _t("Blog.PostsPerPage", "Posts Per Page")) NumericField::create("PostsPerPage", _t("Blog.PostsPerPage", "Posts Per Page"))
); );
@ -328,11 +332,11 @@ class Blog extends Page implements PermissionProvider {
<br /> <br />
Update any BlogPost they have authored or have been assigned to Update any BlogPost they have authored or have been assigned to
'); ');
if(!$this->canEditContributors()) { if(!$this->canEditContributors()) {
$contributorField = $contributorField->performDisabledTransformation(); $contributorField = $contributorField->performDisabledTransformation();
} }
$fields->addFieldsToTab('Root.Users', array( $fields->addFieldsToTab('Root.Users', array(
$editorField, $editorField,
$writerField, $writerField,
@ -347,7 +351,7 @@ class Blog extends Page implements PermissionProvider {
* Return blog posts * Return blog posts
* *
* @return DataList of BlogPost objects * @return DataList of BlogPost objects
**/ **/
public function getBlogPosts() { public function getBlogPosts() {
$blogPosts = BlogPost::get()->filter("ParentID", $this->ID); $blogPosts = BlogPost::get()->filter("ParentID", $this->ID);
//Allow decorators to manipulate list //Allow decorators to manipulate list
@ -356,7 +360,6 @@ class Blog extends Page implements PermissionProvider {
} }
/** /**
* Returns blogs posts for a given date period. * Returns blogs posts for a given date period.
* *
@ -365,7 +368,7 @@ class Blog extends Page implements PermissionProvider {
* @param $day int * @param $day int
* *
* @return DataList * @return DataList
**/ **/
public function getArchivedBlogPosts($year, $month = null, $day = null) { public function getArchivedBlogPosts($year, $month = null, $day = null) {
$query = $this->getBlogPosts()->dataQuery(); $query = $this->getBlogPosts()->dataQuery();
@ -387,8 +390,9 @@ class Blog extends Page implements PermissionProvider {
/** /**
* Get a link to a Member profile. * Get a link to a Member profile.
* *
* @param urlSegment * @param urlSegment
*
* @return String * @return String
*/ */
public function ProfileLink($urlSegment) { public function ProfileLink($urlSegment) {
@ -406,7 +410,6 @@ class Blog extends Page implements PermissionProvider {
} }
/** /**
* This overwrites lumberjacks default gridfield config. * This overwrites lumberjacks default gridfield config.
* *
@ -499,7 +502,6 @@ class Blog extends Page implements PermissionProvider {
} }
/** /**
* Blog Controller * Blog Controller
* *
@ -507,7 +509,7 @@ class Blog extends Page implements PermissionProvider {
* @subpackage blog * @subpackage blog
* *
* @author Michael Strong <github@michaelstrong.co.uk> * @author Michael Strong <github@michaelstrong.co.uk>
**/ **/
class Blog_Controller extends Page_Controller { class Blog_Controller extends Page_Controller {
private static $allowed_actions = array( private static $allowed_actions = array(
@ -531,15 +533,14 @@ class Blog_Controller extends Page_Controller {
); );
/** /**
* The current Blog Post DataList query. * The current Blog Post DataList query.
* *
* @var DataList * @var DataList
**/ **/
protected $blogPosts; protected $blogPosts;
public function index() { public function index() {
$this->blogPosts = $this->getBlogPosts(); $this->blogPosts = $this->getBlogPosts();
return $this->render(); return $this->render();
@ -549,7 +550,7 @@ class Blog_Controller extends Page_Controller {
* Renders a Blog Member's profile. * Renders a Blog Member's profile.
* *
* @return SS_HTTPResponse * @return SS_HTTPResponse
**/ **/
public function profile() { public function profile() {
$profile = $this->getCurrentProfile(); $profile = $this->getCurrentProfile();
@ -564,9 +565,9 @@ class Blog_Controller extends Page_Controller {
/** /**
* Get the Member associated with the current URL segment. * Get the Member associated with the current URL segment.
* *
* @return Member|null * @return Member|null
**/ **/
public function getCurrentProfile() { public function getCurrentProfile() {
$urlSegment = $this->request->param('URLSegment'); $urlSegment = $this->request->param('URLSegment');
@ -581,9 +582,9 @@ class Blog_Controller extends Page_Controller {
/** /**
* Get posts related to the current Member profile * Get posts related to the current Member profile
* *
* @return DataList|null * @return DataList|null
**/ **/
public function getCurrentProfilePosts() { public function getCurrentProfilePosts() {
$profile = $this->getCurrentProfile(); $profile = $this->getCurrentProfile();
@ -598,7 +599,7 @@ class Blog_Controller extends Page_Controller {
* Renders an archive for a specificed date. This can be by year or year/month * Renders an archive for a specificed date. This can be by year or year/month
* *
* @return SS_HTTPResponse * @return SS_HTTPResponse
**/ **/
public function archive() { public function archive() {
$year = $this->getArchiveYear(); $year = $this->getArchiveYear();
$month = $this->getArchiveMonth(); $month = $this->getArchiveMonth();
@ -622,12 +623,11 @@ class Blog_Controller extends Page_Controller {
} }
/** /**
* Renders the blog posts for a given tag. * Renders the blog posts for a given tag.
* *
* @return SS_HTTPResponse * @return SS_HTTPResponse
**/ **/
public function tag() { public function tag() {
$tag = $this->getCurrentTag(); $tag = $this->getCurrentTag();
if($tag) { if($tag) {
@ -638,12 +638,11 @@ class Blog_Controller extends Page_Controller {
} }
/** /**
* Renders the blog posts for a given category * Renders the blog posts for a given category
* *
* @return SS_HTTPResponse * @return SS_HTTPResponse
**/ **/
public function category() { public function category() {
$category = $this->getCurrentCategory(); $category = $this->getCurrentCategory();
if($category) { if($category) {
@ -664,7 +663,7 @@ class Blog_Controller extends Page_Controller {
if($filter) { if($filter) {
$title = "{$title} - {$filter}"; $title = "{$title} - {$filter}";
} }
$this->extend('updateMetaTitle', $title); $this->extend('updateMetaTitle', $title);
return $title; return $title;
} }
@ -725,7 +724,7 @@ class Blog_Controller extends Page_Controller {
if($this->owner->getArchiveYear()) { if($this->owner->getArchiveYear()) {
if($this->owner->getArchiveDay()) { if($this->owner->getArchiveDay()) {
$date = $this->owner->getArchiveDate()->Nice(); $date = $this->owner->getArchiveDate()->Nice();
} elseif($this->owner->getArchiveMonth ()) { } elseif($this->owner->getArchiveMonth()) {
$date = $this->owner->getArchiveDate()->format("F, Y"); $date = $this->owner->getArchiveDate()->format("F, Y");
} else { } else {
$date = $this->owner->getArchiveDate()->format("Y"); $date = $this->owner->getArchiveDate()->format("Y");
@ -751,7 +750,7 @@ class Blog_Controller extends Page_Controller {
* Displays an RSS feed of blog posts * Displays an RSS feed of blog posts
* *
* @return string HTML * @return string HTML
**/ **/
public function rss() { public function rss() {
$rss = new RSSFeed($this->getBlogPosts(), $this->Link(), $this->MetaTitle, $this->MetaDescription); $rss = new RSSFeed($this->getBlogPosts(), $this->Link(), $this->MetaTitle, $this->MetaDescription);
$this->extend('updateRss', $rss); $this->extend('updateRss', $rss);
@ -759,12 +758,11 @@ class Blog_Controller extends Page_Controller {
} }
/** /**
* Returns a list of paginated blog posts based on the blogPost dataList * Returns a list of paginated blog posts based on the blogPost dataList
* *
* @return PaginatedList * @return PaginatedList
**/ **/
public function PaginatedList() { public function PaginatedList() {
$posts = new PaginatedList($this->blogPosts); $posts = new PaginatedList($this->blogPosts);
@ -783,12 +781,11 @@ class Blog_Controller extends Page_Controller {
} }
/** /**
* Tag Getter for use in templates. * Tag Getter for use in templates.
* *
* @return BlogTag|null * @return BlogTag|null
**/ **/
public function getCurrentTag() { public function getCurrentTag() {
$tag = $this->request->param("Tag"); $tag = $this->request->param("Tag");
if($tag) { if($tag) {
@ -800,12 +797,11 @@ class Blog_Controller extends Page_Controller {
} }
/** /**
* Category Getter for use in templates. * Category Getter for use in templates.
* *
* @return BlogCategory|null * @return BlogCategory|null
**/ **/
public function getCurrentCategory() { public function getCurrentCategory() {
$category = $this->request->param("Category"); $category = $this->request->param("Category");
if($category) { if($category) {
@ -817,12 +813,11 @@ class Blog_Controller extends Page_Controller {
} }
/** /**
* Fetches the archive year from the url * Fetches the archive year from the url
* *
* @return int|null * @return int|null
**/ **/
public function getArchiveYear() { public function getArchiveYear() {
$year = $this->request->param("Year"); $year = $this->request->param("Year");
if(preg_match("/^[0-9]{4}$/", $year)) { if(preg_match("/^[0-9]{4}$/", $year)) {
@ -832,12 +827,11 @@ class Blog_Controller extends Page_Controller {
} }
/** /**
* Fetches the archive money from the url. * Fetches the archive money from the url.
* *
* @return int|null * @return int|null
**/ **/
public function getArchiveMonth() { public function getArchiveMonth() {
$month = $this->request->param("Month"); $month = $this->request->param("Month");
if(preg_match("/^[0-9]{1,2}$/", $month)) { if(preg_match("/^[0-9]{1,2}$/", $month)) {
@ -852,12 +846,11 @@ class Blog_Controller extends Page_Controller {
} }
/** /**
* Fetches the archive day from the url * Fetches the archive day from the url
* *
* @return int|null * @return int|null
**/ **/
public function getArchiveDay() { public function getArchiveDay() {
$day = $this->request->param("Day"); $day = $this->request->param("Day");
if(preg_match("/^[0-9]{1,2}$/", $day)) { if(preg_match("/^[0-9]{1,2}$/", $day)) {
@ -871,12 +864,11 @@ class Blog_Controller extends Page_Controller {
} }
/** /**
* Returns the current archive date. * Returns the current archive date.
* *
* @return Date * @return Date
**/ **/
public function getArchiveDate() { public function getArchiveDate() {
$year = $this->getArchiveYear(); $year = $this->getArchiveYear();
$month = $this->getArchiveMonth(); $month = $this->getArchiveMonth();
@ -896,12 +888,11 @@ class Blog_Controller extends Page_Controller {
} }
/** /**
* Returns a link to the RSS feed. * Returns a link to the RSS feed.
* *
* @return string URL * @return string URL
**/ **/
public function getRSSLink() { public function getRSSLink() {
return $this->Link("rss"); return $this->Link("rss");
} }

View File

@ -7,24 +7,20 @@
/* /*
* Sprite maps & Icons * Sprite maps & Icons
*/ */
/* line 48, blog-icon/*.png */
.blog-icon-sprite, .gridfield-icon .blog-icon-timer { .blog-icon-sprite, .gridfield-icon .blog-icon-timer {
background-image: url('../images/blog-icon-s0a5ab5f851.png'); background-image: url('../images/blog-icon-s0a5ab5f851.png');
background-repeat: no-repeat; background-repeat: no-repeat;
} }
/* line 84, ../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/utilities/sprites/_base.scss */
.gridfield-icon .blog-icon-timer { .gridfield-icon .blog-icon-timer {
background-position: 0 0; background-position: 0 0;
} }
/* line 20, ../scss/cms.scss */
#FeaturedImage .middleColumn { #FeaturedImage .middleColumn {
clear: none; clear: none;
float: left; float: left;
} }
/* line 25, ../scss/cms.scss */
.blog-admin-sidebar { .blog-admin-sidebar {
width: 280px; width: 280px;
border-right: none; border-right: none;
@ -34,11 +30,9 @@
bottom: 0px; bottom: 0px;
height: 100%; height: 100%;
} }
/* line 34, ../scss/cms.scss */
.blog-admin-sidebar .cms-panel-toggle a { .blog-admin-sidebar .cms-panel-toggle a {
text-align: left; text-align: left;
} }
/* line 38, ../scss/cms.scss */
.blog-admin-sidebar ~ .blog-admin-outer { .blog-admin-sidebar ~ .blog-admin-outer {
width: 100%; width: 100%;
padding-right: 280px; padding-right: 280px;
@ -48,59 +42,47 @@
overflow-x: hidden; overflow-x: hidden;
box-sizing: border-box; box-sizing: border-box;
} }
/* line 47, ../scss/cms.scss */
.blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset { .blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset {
position: relative; position: relative;
overflow: auto; overflow: auto;
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
/* line 54, ../scss/cms.scss */
.blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset #Title label { .blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset #Title label {
float: none; float: none;
} }
/* line 57, ../scss/cms.scss */
.blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset #Title .middleColumn, .blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset #Title input { .blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset #Title .middleColumn, .blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset #Title input {
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;
margin-left: 0; margin-left: 0;
} }
/* line 68, ../scss/cms.scss */
.blog-admin-sidebar .cms-content-view > .field + .field { .blog-admin-sidebar .cms-content-view > .field + .field {
margin-top: 10px; margin-top: 10px;
} }
/* line 73, ../scss/cms.scss */
.blog-admin-sidebar .cms-content-view > .field.urlsegment .preview { .blog-admin-sidebar .cms-content-view > .field.urlsegment .preview {
padding-top: 0; padding-top: 0;
line-height: 25px; line-height: 25px;
} }
/* line 78, ../scss/cms.scss */
.blog-admin-sidebar .cms-content-view > .field.urlsegment .edit { .blog-admin-sidebar .cms-content-view > .field.urlsegment .edit {
float: right; float: right;
} }
/* line 85, ../scss/cms.scss */
.blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn > .date { .blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn > .date {
width: 60%; width: 60%;
} }
/* line 89, ../scss/cms.scss */
.blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn > .time { .blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn > .time {
width: 36%; width: 36%;
float: right; float: right;
} }
/* line 94, ../scss/cms.scss */
.blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn .middleColumn, .blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn input { .blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn .middleColumn, .blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn input {
width: 100%; width: 100%;
} }
/* line 103, ../scss/cms.scss */
.blog-admin-sidebar.collapsed ~ .blog-admin-outer { .blog-admin-sidebar.collapsed ~ .blog-admin-outer {
padding-right: 41px; padding-right: 41px;
} }
/* line 109, ../scss/cms.scss */
.blog-admin-sidebar.cms-content-tools .cms-panel-content { .blog-admin-sidebar.cms-content-tools .cms-panel-content {
width: auto; width: auto;
} }
/* line 115, ../scss/cms.scss */
.toggle-description { .toggle-description {
text-indent: -1000000px; text-indent: -1000000px;
display: inline-block; display: inline-block;
@ -110,14 +92,12 @@
margin-left: 4px; margin-left: 4px;
} }
/* line 124, ../scss/cms.scss */
.middleColumn.toggle-description-correct-middle { .middleColumn.toggle-description-correct-middle {
margin-left: 0; margin-left: 0;
float: left; float: left;
width: 416px; width: 416px;
} }
/* line 130, ../scss/cms.scss */
label.right.toggle-description-correct-right { label.right.toggle-description-correct-right {
display: inline-block; display: inline-block;
margin-left: 0; margin-left: 0;
@ -125,22 +105,26 @@ label.right.toggle-description-correct-right {
float: left; float: left;
} }
/* line 137, ../scss/cms.scss */
.description.toggle-description-correct-description { .description.toggle-description-correct-description {
width: 416px; width: 416px;
padding: 12px 0; padding: 12px 0;
} }
/* line 144, ../scss/cms.scss */
.custom-summary .ui-accordion-content .field { .custom-summary .ui-accordion-content .field {
margin: 0; margin: 0;
} }
/* line 148, ../scss/cms.scss */
.custom-summary .ui-accordion-content, .custom-summary .ui-accordion-content,
.custom-summary .ui-accordion-content .field { .custom-summary .ui-accordion-content .field {
padding: 0; padding: 0;
} }
/* line 153, ../scss/cms.scss */
.custom-summary .ui-icon-triangle-1-e { .custom-summary .ui-icon-triangle-1-e {
background-position: -16px -128px; background-position: -16px -128px;
} }
.cms table.ss-gridfield-table tr td.MergeAction {
width: 150px;
}
.cms table.ss-gridfield-table tr td.MergeAction select {
width: 75px;
}

44
js/merge-action.js Normal file
View File

@ -0,0 +1,44 @@
/**
* Register expandable help text functions with fields.
*/
(function ($) {
$.entwine('ss', function ($) {
$('.MergeAction').entwine({
'onadd': function() {
var $this = $(this);
$this.on('click', 'select', function() {
return false;
});
$this.children('button').each(function(i, button) {
var $button = $(button);
var $select = $button.prev('select');
$button.before('<input type="hidden" name="' + $button.attr('data-target') + '" value="' + $select.val() + '" />');
});
$this.on('change', 'select', function(e) {
var $target = $(e.target);
$target.next('input').val($target.val());
});
$this.children('button, select').hide();
$this.on('click', '.MergeActionReveal', function(e) {
var $target = $(e.target);
$target.parent().children('button, select').show();
$target.hide();
return false;
});
}
})
});
}(jQuery));

View File

@ -1,12 +1,10 @@
/** /**
* CMS Styles * CMS Styles
*/ */
/** /**
* Include Compass framework * Include Compass framework
*/ */
@import "compass"; @import "compass";
/* /*
* Sprite maps & Icons * Sprite maps & Icons
*/ */
@ -56,7 +54,7 @@
} }
.middleColumn, input { .middleColumn, input {
width: 100%; width: 100%;
max-width:100%; max-width: 100%;
margin-left: 0; margin-left: 0;
} }
} }
@ -88,7 +86,7 @@
> .time { > .time {
width: 36%; width: 36%;
float:right; float: right;
} }
.middleColumn, input { .middleColumn, input {
@ -140,7 +138,6 @@ label.right.toggle-description-correct-right {
} }
.custom-summary { .custom-summary {
.ui-accordion-content .field { .ui-accordion-content .field {
margin: 0; margin: 0;
} }
@ -153,5 +150,12 @@ label.right.toggle-description-correct-right {
.ui-icon-triangle-1-e { .ui-icon-triangle-1-e {
background-position: -16px -128px; background-position: -16px -128px;
} }
}
} .cms table.ss-gridfield-table tr td.MergeAction {
width: 150px;
}
.cms table.ss-gridfield-table tr td.MergeAction select {
width: 75px;
}