mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Added role help
This commit is contained in:
parent
d58b376bf1
commit
330401683a
@ -79,6 +79,10 @@ class Blog extends Page implements PermissionProvider {
|
|||||||
private static $description = 'Adds a blog to your website.';
|
private static $description = 'Adds a blog to your website.';
|
||||||
|
|
||||||
public function getCMSFields() {
|
public function getCMSFields() {
|
||||||
|
Requirements::css(BLOGGER_DIR . '/css/cms.css');
|
||||||
|
|
||||||
|
Requirements::javascript(BLOGGER_DIR . '/js/expandable-help-text.js');
|
||||||
|
|
||||||
$self =& $this;
|
$self =& $this;
|
||||||
$this->beforeUpdateCMSFields(function($fields) use ($self) {
|
$this->beforeUpdateCMSFields(function($fields) use ($self) {
|
||||||
|
|
||||||
@ -260,7 +264,19 @@ class Blog extends Page implements PermissionProvider {
|
|||||||
// Editors
|
// Editors
|
||||||
$editorField = ListboxField::create('Editors', 'Editors', $members)
|
$editorField = ListboxField::create('Editors', 'Editors', $members)
|
||||||
->setMultiple(true)
|
->setMultiple(true)
|
||||||
->setDescription('Editors are able to manage this blog and its posts');
|
->setRightTitle('<a class="toggle-description">help</a>')
|
||||||
|
->setDescription('
|
||||||
|
An editor has control over specific Blogs, and all posts included within it. Short of being able to assign other editors to a blog, they are able to handle most changes assigned to their section.<br />
|
||||||
|
<br />
|
||||||
|
Editors have these permissions:<br />
|
||||||
|
<br />
|
||||||
|
Update or publish any BlogPost in their Blog<br />
|
||||||
|
Update or publish their Blog<br />
|
||||||
|
Assign/unassign writers to their Blog<br />
|
||||||
|
Assign/unassign contributors to their Blog<br />
|
||||||
|
Assign/unassign any member as an author of a particular BlogPost
|
||||||
|
');
|
||||||
|
|
||||||
if(!$this->canEditEditors()) {
|
if(!$this->canEditEditors()) {
|
||||||
$editorField = $editorField->performDisabledTransformation();
|
$editorField = $editorField->performDisabledTransformation();
|
||||||
}
|
}
|
||||||
@ -268,7 +284,17 @@ class Blog extends Page implements PermissionProvider {
|
|||||||
// Writers
|
// Writers
|
||||||
$writerField = ListboxField::create('Writers', 'Writers', $members)
|
$writerField = ListboxField::create('Writers', 'Writers', $members)
|
||||||
->setMultiple(true)
|
->setMultiple(true)
|
||||||
->setDescription('Writers are able to write and publish posts');
|
->setRightTitle('<a class="toggle-description">help</a>')
|
||||||
|
->setDescription('
|
||||||
|
A writer has control over specific BlogPosts. They are able to handle many changes to the BlogPost they are assigned to.<br />
|
||||||
|
<br />
|
||||||
|
Writers have these permissions:<br />
|
||||||
|
<br />
|
||||||
|
Update or publish any BlogPost to which they are assigned<br />
|
||||||
|
Assign/unassign contributors to their Blog<br />
|
||||||
|
Assign/unassign any member as an author of a particular BlogPost
|
||||||
|
');
|
||||||
|
|
||||||
if(!$this->canEditWriters()) {
|
if(!$this->canEditWriters()) {
|
||||||
$writerField = $writerField->performDisabledTransformation();
|
$writerField = $writerField->performDisabledTransformation();
|
||||||
}
|
}
|
||||||
@ -276,7 +302,16 @@ class Blog extends Page implements PermissionProvider {
|
|||||||
// Contributors
|
// Contributors
|
||||||
$contributorField = ListboxField::create('Contributors', 'Contributors', $members)
|
$contributorField = ListboxField::create('Contributors', 'Contributors', $members)
|
||||||
->setMultiple(true)
|
->setMultiple(true)
|
||||||
->setDescription('Contributors are able to write, but not publish, posts');
|
->setRightTitle('<a class="toggle-description">help</a>')
|
||||||
|
->setDescription('
|
||||||
|
A contributor has control over specific BlogPosts. They are able to contribute but not publish or remove BlogPosts.<br />
|
||||||
|
<br />
|
||||||
|
Contributors have these permissions:<br />
|
||||||
|
<br />
|
||||||
|
Update any BlogPost to which they are assigned<br />
|
||||||
|
Assign/unassign any member as an author of a particular BlogPost
|
||||||
|
');
|
||||||
|
|
||||||
if(!$this->canEditContributors()) {
|
if(!$this->canEditContributors()) {
|
||||||
$contributorField = $contributorField->performDisabledTransformation();
|
$contributorField = $contributorField->performDisabledTransformation();
|
||||||
}
|
}
|
||||||
|
69
css/cms.css
69
css/cms.css
@ -1,28 +1,30 @@
|
|||||||
/**
|
/**
|
||||||
* CMS Styles
|
* CMS Styles
|
||||||
**/
|
*/
|
||||||
/**
|
/**
|
||||||
* Include Compass framework */
|
* Include Compass framework
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
* Sprite maps & Icons */
|
* Sprite maps & Icons
|
||||||
|
*/
|
||||||
/* line 48, blog-icon/*.png */
|
/* 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, ../../../../home/vagrant/.rvm/gems/ruby-2.1.5/gems/compass-core-1.0.1/stylesheets/compass/utilities/sprites/_base.scss */
|
/* line 84, ../../../../../../../usr/local/lib/ruby/gems/2.2.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 18, ../scss/cms.scss */
|
/* line 20, ../scss/cms.scss */
|
||||||
#FeaturedImage .middleColumn {
|
#FeaturedImage .middleColumn {
|
||||||
clear: none;
|
clear: none;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 23, ../scss/cms.scss */
|
/* line 25, ../scss/cms.scss */
|
||||||
.blog-admin-sidebar {
|
.blog-admin-sidebar {
|
||||||
width: 280px;
|
width: 280px;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
@ -32,11 +34,11 @@
|
|||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
/* line 32, ../scss/cms.scss */
|
/* 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 36, ../scss/cms.scss */
|
/* 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;
|
||||||
@ -46,54 +48,83 @@
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
/* line 45, ../scss/cms.scss */
|
/* 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 52, ../scss/cms.scss */
|
/* 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 55, ../scss/cms.scss */
|
/* 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 66, ../scss/cms.scss */
|
/* 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 71, ../scss/cms.scss */
|
/* 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 76, ../scss/cms.scss */
|
/* 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 83, ../scss/cms.scss */
|
/* 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 87, ../scss/cms.scss */
|
/* 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 92, ../scss/cms.scss */
|
/* 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 101, ../scss/cms.scss */
|
/* 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 107, ../scss/cms.scss */
|
/* 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 {
|
||||||
|
text-indent: -1000000px;
|
||||||
|
display: inline-block;
|
||||||
|
background: url("../images/information.png") no-repeat center center;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* line 124, ../scss/cms.scss */
|
||||||
|
.toggle-description-correct-middle {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
float: left !important;
|
||||||
|
width: 416px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* line 130, ../scss/cms.scss */
|
||||||
|
.toggle-description-correct-right {
|
||||||
|
display: inline-block !important;
|
||||||
|
margin-left: 0 !important;
|
||||||
|
clear: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* line 136, ../scss/cms.scss */
|
||||||
|
.toggle-description-correct-description {
|
||||||
|
width: 416px !important;
|
||||||
|
}
|
||||||
|
BIN
images/information.png
Executable file
BIN
images/information.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 778 B |
49
js/expandable-help-text.js
Normal file
49
js/expandable-help-text.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* Register expandable help text functions with fields.
|
||||||
|
*/
|
||||||
|
(function ($) {
|
||||||
|
|
||||||
|
$.entwine('ss', function ($) {
|
||||||
|
|
||||||
|
$('.toggle-description').entwine({
|
||||||
|
'onadd': function () {
|
||||||
|
var $this = $(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent multiple events being added.
|
||||||
|
*/
|
||||||
|
if ($this.hasClass('toggle-description-enabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this.addClass('toggle-description-enabled');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle next description when button is clicked.
|
||||||
|
*/
|
||||||
|
var shown = false;
|
||||||
|
|
||||||
|
$this.on('click', function() {
|
||||||
|
$this.parent().next('.description')[shown ? 'hide' : 'show']();
|
||||||
|
|
||||||
|
$this.toggleClass('toggle-description-shown');
|
||||||
|
|
||||||
|
shown = !shown;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide next description by default.
|
||||||
|
*/
|
||||||
|
$this.parent().next('.description').hide();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add classes to correct inherited layout issues in a small context.
|
||||||
|
*/
|
||||||
|
$this.parent().addClass('toggle-description-correct-right');
|
||||||
|
$this.parent().prev('.middleColumn').addClass('toggle-description-correct-middle');
|
||||||
|
$this.parent().next('.description').addClass('toggle-description-correct-description');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
})(jQuery);
|
@ -1,13 +1,15 @@
|
|||||||
/**
|
/**
|
||||||
* CMS Styles
|
* CMS Styles
|
||||||
**/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Include Compass framework */
|
* Include Compass framework
|
||||||
|
*/
|
||||||
@import "compass";
|
@import "compass";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sprite maps & Icons */
|
* Sprite maps & Icons
|
||||||
|
*/
|
||||||
@import "compass/utilities/sprites/base";
|
@import "compass/utilities/sprites/base";
|
||||||
@import "blog-icon/*.png";
|
@import "blog-icon/*.png";
|
||||||
|
|
||||||
@ -109,3 +111,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toggle-description {
|
||||||
|
text-indent: -1000000px;
|
||||||
|
display: inline-block;
|
||||||
|
background: url("../images/information.png") no-repeat center center;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-description-correct-middle {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
float: left !important;
|
||||||
|
width: 416px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-description-correct-right {
|
||||||
|
display: inline-block !important;
|
||||||
|
margin-left: 0 !important;
|
||||||
|
clear: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-description-correct-description {
|
||||||
|
width: 416px !important;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user