Merge branch '4.3' into 4.4

This commit is contained in:
Robbie Averill 2017-08-21 15:33:20 +12:00
commit 792d040652
11 changed files with 65 additions and 61 deletions

View File

@ -4,6 +4,8 @@ sudo: false
language: php language: php
dist: precise
matrix: matrix:
include: include:
- php: 5.3 - php: 5.3

View File

@ -261,12 +261,9 @@ class UserDefinedForm_EmailRecipient extends DataObject
->addExtraClass('toggle-html-only'), ->addExtraClass('toggle-html-only'),
TextareaField::create('EmailBody', _t('UserDefinedForm.EMAILBODY', 'Body')) TextareaField::create('EmailBody', _t('UserDefinedForm.EMAILBODY', 'Body'))
->addExtraClass('toggle-plain-only'), ->addExtraClass('toggle-plain-only'),
LiteralField::create( LiteralField::create('EmailPreview', $preview)
'EmailPreview',
'<div id="EmailPreview" class="field toggle-html-only">' . $preview . '</div>'
)
)); ));
$fields->fieldByName('Root.EmailContent')->setTitle(_t('UserDefinedForm_EmailRecipient.EMAILCONTENTTAB', 'Email Content')); $fields->fieldByName('Root.EmailContent')->setTitle(_t('UserDefinedForm_EmailRecipient.EMAILCONTENTTAB', 'Email Content'));
// Custom rules for sending this field // Custom rules for sending this field
@ -291,7 +288,7 @@ class UserDefinedForm_EmailRecipient extends DataObject
), ),
$grid $grid
)); ));
$fields->fieldByName('Root.CustomRules')->setTitle(_t('UserDefinedForm_EmailRecipient.CUSTOMRULESTAB', 'Custom Rules')); $fields->fieldByName('Root.CustomRules')->setTitle(_t('UserDefinedForm_EmailRecipient.CUSTOMRULESTAB', 'Custom Rules'));
$this->extend('updateCMSFields', $fields); $this->extend('updateCMSFields', $fields);
@ -421,7 +418,10 @@ class UserDefinedForm_EmailRecipient extends DataObject
*/ */
public function getEmailBodyContent() public function getEmailBodyContent()
{ {
return $this->SendPlain ? $this->EmailBody : $this->EmailBodyHtml; if ($this->SendPlain) {
return DBField::create_field('HTMLText', $this->EmailBody)->NoHTML();
}
return DBField::create_field('HTMLText', $this->EmailBodyHtml)->RAW();
} }
/** /**

View File

@ -55,7 +55,7 @@ class SubmittedFileField extends SubmittedFormField
{ {
if ($file = $this->UploadedFile()) { if ($file = $this->UploadedFile()) {
if (trim($file->getFilename(), '/') != trim(ASSETS_DIR, '/')) { if (trim($file->getFilename(), '/') != trim(ASSETS_DIR, '/')) {
return $this->UploadedFile()->URL; return $this->UploadedFile()->AbsoluteLink();
} }
} }
} }

View File

@ -81,9 +81,14 @@ class SubmittedForm extends DataObject
$self->Values()->sort('Created', 'ASC') $self->Values()->sort('Created', 'ASC')
); );
$exportColumns = array(
'Title' => 'Title',
'ExportValue' => 'Value'
);
$config = new GridFieldConfig(); $config = new GridFieldConfig();
$config->addComponent(new GridFieldDataColumns()); $config->addComponent(new GridFieldDataColumns());
$config->addComponent(new GridFieldExportButton()); $config->addComponent(new GridFieldExportButton('after', $exportColumns));
$config->addComponent(new GridFieldPrintButton()); $config->addComponent(new GridFieldPrintButton());
$values->setConfig($config); $values->setConfig($config);

View File

@ -32,7 +32,7 @@
"require": { "require": {
"silverstripe/framework": "~3.2", "silverstripe/framework": "~3.2",
"silverstripe/cms": "~3.2", "silverstripe/cms": "~3.2",
"silverstripe-australia/gridfieldextensions": "~1.1", "symbiote/silverstripe-gridfieldextensions": "~1.1",
"silverstripe/segment-field": "^1.0" "silverstripe/segment-field": "^1.0"
}, },
"suggest": { "suggest": {

View File

@ -1,14 +1,6 @@
/** /**
* Animations * Animations
*/ */
@keyframes rowSlide {
0% {
top: 20%;
}
100% {
top: 80%;
}
}
@keyframes flashBackground { @keyframes flashBackground {
0% { 0% {
background-color: white; background-color: white;
@ -42,10 +34,6 @@
.cms .uf-field-editor table.ss-gridfield-table .ss-gridfield-item .handle { .cms .uf-field-editor table.ss-gridfield-table .ss-gridfield-item .handle {
min-height: 46px; min-height: 46px;
} }
.cms .uf-field-editor table.ss-gridfield-table .ss-gridfield-item.newField {
position: fixed;
animation: rowSlide .5s ease forwards;
}
.cms .uf-field-editor table.ss-gridfield-table .ss-gridfield-item.flashBackground { .cms .uf-field-editor table.ss-gridfield-table .ss-gridfield-item.flashBackground {
animation: flashBackground 2s linear; animation: flashBackground 2s linear;
} }

View File

@ -8,8 +8,8 @@
$(".uf-field-editor tbody").entwine({ $(".uf-field-editor tbody").entwine({
onmatch: function() { onmatch: function() {
var i, var i,
thisLevel, thisLevel,
depth = 0, depth = 0,
$buttonrow = $('.uf-field-editor .ss-gridfield-buttonrow').addClass('stickyButtons'), $buttonrow = $('.uf-field-editor .ss-gridfield-buttonrow').addClass('stickyButtons'),
navHeight = $('.cms-content-header.north').height() + parseInt($('.stickyButtons').css('padding-top'), 10), navHeight = $('.cms-content-header.north').height() + parseInt($('.stickyButtons').css('padding-top'), 10),
@ -17,7 +17,7 @@
self = this; self = this;
this._super(); this._super();
// Loop through all rows and set necessary styles // Loop through all rows and set necessary styles
this.find('.ss-gridfield-item').each(function() { this.find('.ss-gridfield-item').each(function() {
switch($(this).data('class')) { switch($(this).data('class')) {
@ -37,7 +37,7 @@
thisLevel = depth; thisLevel = depth;
} }
} }
$(this).toggleClass('inFieldGroup', thisLevel > 0); $(this).toggleClass('inFieldGroup', thisLevel > 0);
for(i = 1; i <= 5; i++) { for(i = 1; i <= 5; i++) {
$(this).toggleClass('inFieldGroup-level-'+i, thisLevel >= i); $(this).toggleClass('inFieldGroup-level-'+i, thisLevel >= i);
@ -76,7 +76,7 @@
var self = this; var self = this;
this._super(); this._super();
// When the 'Add field' button is clicked set a one time listener. // When the 'Add field' button is clicked set a one time listener.
// When the GridField is reloaded focus on the newly added field. // When the GridField is reloaded focus on the newly added field.
this.on('addnewinline', function () { this.on('addnewinline', function () {
@ -92,19 +92,11 @@
$newField.find('.col-Title input').focus(); $newField.find('.col-Title input').focus();
} }
// animate the row positioning (add the first class) $newField.addClass('flashBackground');
if (document.createElement('div').style.animationName !== void 0) { $(".cms-content-fields").scrollTop($(".cms-content-fields")[0].scrollHeight);
$newField.addClass('newField'); if($groupEnd) {
$groupEnd.css('visibility', 'visible');
} }
// Once the animation has completed
setTimeout(function () {
$newField.removeClass('newField').addClass('flashBackground');
$(".cms-content-fields").scrollTop($(".cms-content-fields")[0].scrollHeight);
if($groupEnd) {
$groupEnd.css('visibility', 'visible');
}
}, 500);
}); });
}); });
}, },

View File

@ -5,12 +5,11 @@
(function ($) { (function ($) {
$(document).ready(function () { $(document).ready(function () {
var sendPlain = $('input[name="SendPlain"]');
var recipient = { var recipient = {
// Some fields are only visible when HTML email are being sent. // Some fields are only visible when HTML email are being sent.
updateFormatSpecificFields: function () { updateFormatSpecificFields: function () {
var sendPlainChecked = $('#SendPlain') var sendPlainChecked = sendPlain.is(':checked');
.find('input[type="checkbox"]')
.is(':checked');
$(".field.toggle-html-only")[sendPlainChecked ? 'hide' : 'show'](); $(".field.toggle-html-only")[sendPlainChecked ? 'hide' : 'show']();
$(".field.toggle-plain-only")[sendPlainChecked ? 'show' : 'hide'](); $(".field.toggle-plain-only")[sendPlainChecked ? 'show' : 'hide']();
@ -27,7 +26,7 @@
} }
}); });
$('#SendPlain').entwine({ sendPlain.entwine({
onchange: function () { onchange: function () {
recipient.updateFormatSpecificFields(); recipient.updateFormatSpecificFields();
} }

View File

@ -2,11 +2,6 @@
* Animations * Animations
*/ */
@keyframes rowSlide {
0% {top: 20%;}
100% {top: 80%;}
}
@keyframes flashBackground { @keyframes flashBackground {
0% {background-color: white;} 0% {background-color: white;}
10% {background-color: #dcfedd;} 10% {background-color: #dcfedd;}
@ -30,11 +25,11 @@
&, &:hover { &, &:hover {
background: white; background: white;
} }
td { td {
border-right-width: 0; border-right-width: 0;
border-top: 1px solid #EEE; border-top: 1px solid #EEE;
&:last-child { &:last-child {
border-right-width: 1px; border-right-width: 1px;
} }
@ -44,11 +39,6 @@
min-height: 46px; min-height: 46px;
} }
&.newField {
position: fixed;
animation: rowSlide .5s ease forwards;
}
&.flashBackground { &.flashBackground {
animation: flashBackground 2s linear; animation: flashBackground 2s linear;
} }
@ -62,24 +52,24 @@
&, &:hover { &, &:hover {
background: #f2f9fd; background: #f2f9fd;
} }
td { td {
border-bottom: 0; border-bottom: 0;
border-top: 1px solid #eee; border-top: 1px solid #eee;
} }
.col-reorder, .handle { .col-reorder, .handle {
background: #BEE0F8; background: #BEE0F8;
border-top: 0; border-top: 0;
} }
&.inFieldGroup-level-2 { &.inFieldGroup-level-2 {
.col-reorder, .handle { .col-reorder, .handle {
background: #99CEF4; background: #99CEF4;
border-top: 0; border-top: 0;
} }
} }
&.inFieldGroup-level-3 { &.inFieldGroup-level-3 {
.col-reorder, .handle { .col-reorder, .handle {
background: #89BEF4; background: #89BEF4;
@ -116,7 +106,7 @@
td { td {
border-top: 1px solid #a8d7f5; border-top: 1px solid #a8d7f5;
} }
label { label {
font-weight: bold; font-weight: bold;
color: #444; color: #444;
@ -135,7 +125,7 @@
.col-buttons .action{ .col-buttons .action{
display: none; display: none;
} }
label { label {
color: #777; color: #777;
} }

View File

@ -0,0 +1,24 @@
<?php
class UserDefinedForm_EmailRecipientTest extends SapphireTest
{
protected static $fixture_file = 'UserDefinedForm_EmailRecipientTest.yml';
public function testShortcodesAreRenderedInEmailPreviewContent()
{
$page = $this->objFromFixture('SiteTree', 'about_us');
$recipient = UserDefinedForm_EmailRecipient::create();
$recipient->SendPlain = false;
$recipient->EmailBodyHtml = '<p>Some email content. About us: [sitetree_link,id=' . $page->ID . '].</p>';
$result = $recipient->getEmailBodyContent();
$this->assertContains('/about-us/', $result);
$recipient->SendPlain = true;
$recipient->EmailBody = 'Some email content. About us: [sitetree_link,id=' . $page->ID . '].';
$result = $recipient->getEmailBodyContent();
$this->assertContains('/about-us/', $result);
}
}

View File

@ -0,0 +1,4 @@
SiteTree:
about_us:
Title: About Us
URLSegment: about-us