Merge pull request #479 from creative-commoners/pulls/2/fix-help-links

FIX Blog user settings help links displayed incorrectly
This commit is contained in:
Robbie Averill 2017-09-26 09:28:32 +13:00 committed by GitHub
commit b1acc1d359
5 changed files with 91 additions and 57 deletions

25
config.rb Normal file
View File

@ -0,0 +1,25 @@
require 'compass/import-once/activate'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :nested
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass

View File

@ -74,16 +74,18 @@
background: url("../images/information.png") no-repeat center center; background: url("../images/information.png") no-repeat center center;
width: 20px; width: 20px;
height: 20px; height: 20px;
margin-left: 4px; } margin-left: 4px;
cursor: pointer; }
.middleColumn.toggle-description-correct-middle { .middleColumn.toggle-description-correct-middle {
margin-left: 0; margin-left: 0;
float: left; float: left;
width: 416px; } width: 416px; }
label.right.toggle-description-correct-right { .tab-content .field p.toggle-description-correct-right {
display: inline-block; display: inline-block;
margin-left: 0; margin-left: 0;
padding-left: 0;
clear: none; clear: none;
float: left; } float: left; }
@ -93,11 +95,9 @@ label.right.toggle-description-correct-right {
.custom-summary .ui-accordion-content .field { .custom-summary .ui-accordion-content .field {
margin: 0; } margin: 0; }
.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; }
.custom-summary .ui-icon-triangle-1-e { .custom-summary .ui-icon-triangle-1-e {
background-position: -16px -128px; } background-position: -16px -128px; }
@ -116,10 +116,8 @@ label.right.toggle-description-correct-right {
.blog-cms-categorisation .MergeActionReveal { .blog-cms-categorisation .MergeActionReveal {
margin-left: 10px; } margin-left: 10px; }
.blog-cms-categorisation .toolbar--content { .blog-cms-categorisation .toolbar--content {
margin-top: 0; } margin-top: 0; }
.blog-cms-categorisation .MergeActionReveal:after { .blog-cms-categorisation .MergeActionReveal:after {
content: ''; content: '';
background: url("../images/move-icon.png"); background: url("../images/move-icon.png");
@ -127,6 +125,5 @@ label.right.toggle-description-correct-right {
height: 16px; height: 16px;
width: 16px; width: 16px;
margin-left: 4px; } margin-left: 4px; }
.blog-cms-categorisation button.action { .blog-cms-categorisation button.action {
margin-left: 5px; } margin-left: 5px; }

View File

@ -38,19 +38,18 @@
* Toggle next description when button is clicked. * Toggle next description when button is clicked.
*/ */
var shown = false; var shown = false;
var $helpInfo = $this.closest('.field').find('.form-text');
$this.on('click', function () { $this.on('click', function () {
$this.parent().next('.description')[shown ? 'hide' : 'show'](); $helpInfo[shown ? 'hide' : 'show']();
$this.toggleClass('toggle-description-shown'); $this.toggleClass('toggle-description-shown');
shown = !shown; shown = !shown;
}); });
/** /**
* Hide next description by default. * Hide next description by default.
*/ */
$this.parent().next('.description').hide(); $helpInfo.hide();
/** /**
* Add classes to correct inherited layout issues in a small context. * Add classes to correct inherited layout issues in a small context.

View File

@ -128,6 +128,7 @@
width: 20px; width: 20px;
height: 20px; height: 20px;
margin-left: 4px; margin-left: 4px;
cursor:pointer;
} }
.middleColumn.toggle-description-correct-middle { .middleColumn.toggle-description-correct-middle {
@ -136,9 +137,10 @@
width: 416px; width: 416px;
} }
label.right.toggle-description-correct-right { .tab-content .field p.toggle-description-correct-right {
display: inline-block; display: inline-block;
margin-left: 0; margin-left: 0;
padding-left: 0;
clear: none; clear: none;
float: left; float: left;
} }

View File

@ -3,26 +3,18 @@
namespace SilverStripe\Blog\Model; namespace SilverStripe\Blog\Model;
use Page; use Page;
use PageController;
use SilverStripe\Blog\Admin\GridFieldCategorisationConfig; use SilverStripe\Blog\Admin\GridFieldCategorisationConfig;
use SilverStripe\Blog\Forms\GridField\GridFieldConfig_BlogPost; use SilverStripe\Blog\Forms\GridField\GridFieldConfig_BlogPost;
use SilverStripe\Blog\Model\BlogCategory;
use SilverStripe\Blog\Model\BlogFilter;
use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\Blog\Model\BlogTag;
use SilverStripe\CMS\Controllers\RootURLController; use SilverStripe\CMS\Controllers\RootURLController;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Control\RSS\RSSFeed;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Core\Manifest\ModuleLoader; use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\ListboxField; use SilverStripe\Forms\ListboxField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\NumericField; use SilverStripe\Forms\NumericField;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\PaginatedList;
use SilverStripe\ORM\UnsavedRelationList; use SilverStripe\ORM\UnsavedRelationList;
use SilverStripe\Security\Group; use SilverStripe\Security\Group;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
@ -142,9 +134,7 @@ class Blog extends Page implements PermissionProvider
*/ */
public function getCMSFields() public function getCMSFields()
{ {
$module = ModuleLoader::getModule('silverstripe/blog'); $this->addCMSRequirements();
Requirements::css($module->getRelativeResourcePath('css/cms.css'));
Requirements::javascript($module->getRelativeResourcePath('js/cms.js'));
$this->beforeUpdateCMSFields(function ($fields) { $this->beforeUpdateCMSFields(function ($fields) {
if (!$this->canEdit()) { if (!$this->canEdit()) {
@ -194,6 +184,15 @@ class Blog extends Page implements PermissionProvider
return parent::getCMSFields(); return parent::getCMSFields();
} }
/**
* Adds CMS related css and js overrides
*/
protected function addCMSRequirements()
{
$module = ModuleLoader::getModule('silverstripe/blog');
Requirements::css($module->getRelativeResourcePath('css/cms.css'));
Requirements::javascript($module->getRelativeResourcePath('js/cms.js'));
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -347,6 +346,7 @@ class Blog extends Page implements PermissionProvider
*/ */
public function getSettingsFields() public function getSettingsFields()
{ {
$this->addCMSRequirements();
$fields = parent::getSettingsFields(); $fields = parent::getSettingsFields();
$fields->addFieldToTab( $fields->addFieldToTab(
@ -355,37 +355,43 @@ class Blog extends Page implements PermissionProvider
); );
$members = $this->getCandidateUsers()->map()->toArray(); $members = $this->getCandidateUsers()->map()->toArray();
$toggleButton = LiteralField::create('ToggleButton', '<a class="toggle-description"></a>');
$editorField = ListboxField::create('Editors', 'Editors', $members) $editorField = ListboxField::create('Editors', 'Editors', $members)
// ->setMultiple(true) ->setRightTitle($toggleButton)
->setRightTitle('<a class="toggle-description">help</a>') ->setDescription(
->setDescription(' _t(
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 to their assigned blog.<br /> __CLASS__ . '.UsersEditorsFieldDescription',
<br /> 'An editor has control over specific Blogs, and all posts included within it.
Editors have these permissions:<br /> Short of being able to assign other editors to a blog, they are able to handle most changes to
<br /> their assigned blog. <br /><br />
Update or publish any BlogPost in their Blog<br /> Editors have these permissions:<br />
Update or publish their Blog<br /> <br />
Assign/unassign writers to their Blog<br /> Update or publish any BlogPost in their Blog<br />
Assign/unassign contributors to their Blog<br /> Update or publish their Blog<br />
Assign/unassign any member as an author of a particular BlogPost 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();
} }
$writerField = ListboxField::create('Writers', 'Writers', $members) $writerField = ListboxField::create('Writers', 'Writers', $members)
// ->setMultiple(true) ->setRightTitle($toggleButton)
->setRightTitle('<a class="toggle-description">help</a>') ->setDescription(
->setDescription(' _t(
A writer has full control over creating, editing and publishing BlogPosts they have authored or have been assigned to. Writers are unable to edit BlogPosts to which they are not assigned.<br /> __CLASS__ . '.UsersWritersFieldDescription',
<br /> 'A writer has full control over creating, editing and publishing BlogPosts they have authored
Writers have these permissions:<br /> or have been assigned to. Writers are unable to edit BlogPosts to which they are not assigned.
<br /> <br /><br />
Update or publish any BlogPost they have authored or have been assigned to<br /> Writers have these permissions:<br />
Assign/unassign any member as an author of a particular BlogPost they have authored or have been assigned to <br />
'); Update or publish any BlogPost they have authored or have been assigned to<br />
Assign/unassign any member as an author of a particular BlogPost they have authored or have been
assigned to'
)
);
if (!$this->canEditWriters()) { if (!$this->canEditWriters()) {
$writerField = $writerField->performDisabledTransformation(); $writerField = $writerField->performDisabledTransformation();
@ -393,14 +399,19 @@ class Blog extends Page implements PermissionProvider
$contributorField = ListboxField::create('Contributors', 'Contributors', $members) $contributorField = ListboxField::create('Contributors', 'Contributors', $members)
// ->setMultiple(true) // ->setMultiple(true)
->setRightTitle('<a class="toggle-description">help</a>') ->setRightTitle($toggleButton)
->setDescription(' ->setDescription(
Contributors have the ability to create or edit BlogPosts, but are unable to publish without authorisation of an editor. They are also unable to assign other contributing authors to any of their BlogPosts.<br /> _t(
<br /> __CLASS__ . '.UsersContributorsFieldDescription',
Contributors have these permissions:<br /> 'Contributors have the ability to create or edit BlogPosts, but are unable to publish without
<br /> authorisation of an editor. They are also unable to assign other contributing authors to any of
Update any BlogPost they have authored or have been assigned to their BlogPosts.<br />
'); <br />
Contributors have these permissions:<br />
<br />
Update any BlogPost they have authored or have been assigned to'
)
);
if (!$this->canEditContributors()) { if (!$this->canEditContributors()) {
$contributorField = $contributorField->performDisabledTransformation(); $contributorField = $contributorField->performDisabledTransformation();