From e217d42090d4745b2a81dfc67c7f3430eb86e8d3 Mon Sep 17 00:00:00 2001 From: Kirk Mayo Date: Tue, 18 Dec 2012 15:04:14 +1300 Subject: [PATCH 01/21] MINOR:added padding to ui-dialog-title so that it doesn't sit flush with the edge of the dialog box --- admin/css/screen.css | 2 +- admin/scss/_uitheme.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/css/screen.css b/admin/css/screen.css index b43726bb8..b6f4adec6 100644 --- a/admin/css/screen.css +++ b/admin/css/screen.css @@ -126,7 +126,7 @@ body, html { font-size: 12px; line-height: 16px; font-family: Arial, sans-serif; .ui-widget-content, .ui-widget { color: #444444; font-size: 12px; font-family: Arial, sans-serif; border: 0; } .ui-widget-header { background-color: #b0bec7; padding: 8px 8px 6px 8px; border-bottom: 2px solid #8399a7; background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2RkZTNlNyIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzkyYTViMiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background-size: 100%; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dde3e7), color-stop(100%, #92a5b2)); background-image: -webkit-linear-gradient(#dde3e7, #92a5b2); background-image: -moz-linear-gradient(#dde3e7, #92a5b2); background-image: -o-linear-gradient(#dde3e7, #92a5b2); background-image: linear-gradient(#dde3e7, #92a5b2); border-bottom: 3px solid #5c7382; padding: 8px; -webkit-border-radius: 0; -moz-border-radius: 0; -ms-border-radius: 0; -o-border-radius: 0; border-radius: 0; } -.ui-widget-header .ui-dialog-title { padding: 6px 0; text-shadow: #ced7dc 1px 1px 0; } +.ui-widget-header .ui-dialog-title { padding: 6px 10px; text-shadow: #ced7dc 1px 1px 0; } .ui-widget-header a.ui-dialog-titlebar-close { position: absolute; top: -8px; right: -15px; width: 30px; height: 30px; z-index: 100000; } .ui-widget-header a.ui-state-hover { border-color: transparent; background: transparent; } .ui-widget-header a.ui-state-hover .ui-icon-closethick { background: url('../images/sprites-32x32-sf6890c994e.png') 0 -216px no-repeat; } diff --git a/admin/scss/_uitheme.scss b/admin/scss/_uitheme.scss index 3c2e8f6f2..797387839 100644 --- a/admin/scss/_uitheme.scss +++ b/admin/scss/_uitheme.scss @@ -30,7 +30,7 @@ @include border-radius(0); & .ui-dialog-title { - padding: 6px 0; + padding: 6px 10px; text-shadow: lighten($color-base, 10%) 1px 1px 0; } From b68cd6610c0ce6135c8a1e124c967297773fcb5e Mon Sep 17 00:00:00 2001 From: Arno Poot Date: Fri, 26 Jul 2013 16:01:24 +0200 Subject: [PATCH 02/21] Updated fieldgroup class and example code --- forms/FieldGroup.php | 33 ++++++++++++++++++---------- templates/forms/FieldGroup_holder.ss | 4 ++-- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/forms/FieldGroup.php b/forms/FieldGroup.php index 9cd0c3921..4b0fbbdcc 100644 --- a/forms/FieldGroup.php +++ b/forms/FieldGroup.php @@ -9,14 +9,14 @@ * Usage * * - * new FieldGroup( - * new FieldGroup( - * new HeaderField('FieldGroup 1'), - * new TextField('Firstname') + * FieldGroup::create( + * FieldGroup::create( + * HeaderField::create('FieldGroup 1'), + * TextField::create('Firstname') * ), - * new FieldGroup( - * new HeaderField('FieldGroup 2'), - * new TextField('Surname') + * FieldGroup::create( + * HeaderField::create('FieldGroup 2'), + * TextField::create('Surname') * ) * ) * @@ -28,10 +28,10 @@ * $fields = parent::getCMSFields(); * * $fields->addFieldToTab( - * 'Root.Content', - * new FieldGroup( - * new TimeField("StartTime","What's the start time?"), - * new TimeField("EndTime","What's the end time?") + * 'Root.Main', + * FieldGroup::create( + * TimeField::create("StartTime","What's the start time?"), + * TimeField::create("EndTime","What's the end time?") * ), * 'Content' * ); @@ -40,6 +40,17 @@ * * } * + * + * Setting a title to a FieldGroup + * + * + * $fields->addFieldToTab("Root.Main", + * FieldGroup::create( + * TimeField::create('StartTime','What's the start time?'), + * TimeField::create('EndTime', 'What's the end time?') + * )->setTitle('Time') + * ); + * * * @package forms * @subpackage fields-structural diff --git a/templates/forms/FieldGroup_holder.ss b/templates/forms/FieldGroup_holder.ss index 95ab1a153..37811c28f 100644 --- a/templates/forms/FieldGroup_holder.ss +++ b/templates/forms/FieldGroup_holder.ss @@ -1,7 +1,7 @@ -
id="$Name"<% end_if %> class="field $Type $extraClass"> +
id="$Name"<% end_if %> class="field $Type"> <% if $Title %><% end_if %> -
+
<% loop $FieldList %>
$SmallFieldHolder From e71adf6b6b4a0e960b315258d8bba351671c7805 Mon Sep 17 00:00:00 2001 From: ARNHOE Date: Fri, 26 Jul 2013 20:25:27 +0200 Subject: [PATCH 03/21] Added chosen.js support to dropdown in fieldgroup --- admin/javascript/LeftAndMain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index 66899d64b..b9678f5d1 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -906,7 +906,7 @@ jQuery.noConflict(); * we can fix the height cropping. */ - $('.cms .field.dropdown select, .cms .field select[multiple]').entwine({ + $('.cms .field.dropdown select, .cms .field select[multiple], .fieldholder-small select.dropdown').entwine({ onmatch: function() { if(this.is('.no-chzn')) { this._super(); From 769b7f2af5c273489a57c0b83ae52c08ebe9497f Mon Sep 17 00:00:00 2001 From: Michael Andrewartha Date: Tue, 30 Jul 2013 15:02:26 +1200 Subject: [PATCH 04/21] Fixing expanding/collapse CMS menu targeting wrong element If a user clicks the log out button (for example) and the menu is collapsed, the menu expands and then you have to press log out again --- admin/javascript/LeftAndMain.Panel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/javascript/LeftAndMain.Panel.js b/admin/javascript/LeftAndMain.Panel.js index c772d1a02..645ecdd38 100644 --- a/admin/javascript/LeftAndMain.Panel.js +++ b/admin/javascript/LeftAndMain.Panel.js @@ -111,7 +111,7 @@ } }); - $('.cms-panel.collapsed').entwine({ + $('.cms-panel.collapsed .cms-panel-toggle').entwine({ onclick: function(e) { this.expandPanel(); e.preventDefault(); From 37e032df869719e5987ec8fdd87833ea64a3246a Mon Sep 17 00:00:00 2001 From: Tom Densham Date: Thu, 3 Oct 2013 15:26:31 +0100 Subject: [PATCH 05/21] API: Change CreditCardField to use AttributeHTML --- forms/CreditCardField.php | 25 ++++++++++++++++++------- templates/forms/CreditCardField.ss | 11 +++++++---- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/forms/CreditCardField.php b/forms/CreditCardField.php index e30b3687a..aa29d6422 100644 --- a/forms/CreditCardField.php +++ b/forms/CreditCardField.php @@ -9,21 +9,32 @@ * @subpackage fields-formattedinput */ class CreditCardField extends TextField { + + /** + * Add default attributes for use on all inputs. + * + * @return array List of attributes + */ + public function getAttributes() { + return array_merge( + parent::getAttributes(), + array( + 'autocomplete' => 'off', + 'maxlength' => 4, + 'size' => 4 + ) + ); + } public function Field($properties = array()) { $parts = $this->value; if(!is_array($parts)) $parts = explode("\n", chunk_split($parts,4,"\n")); $parts = array_pad($parts, 4, ""); - // TODO Mark as disabled/readonly $properties['ValueOne'] = $parts[0]; $properties['ValueTwo'] = $parts[1]; $properties['ValueThree'] = $parts[2]; $properties['ValueFour'] = $parts[3]; - $properties['TabIndexOne'] = $this->getTabIndexHTML(0); - $properties['TabIndexTwo'] = $this->getTabIndexHTML(1); - $properties['TabIndexThree'] = $this->getTabIndexHTML(2); - $properties['TabIndexFour'] = $this->getTabIndexHTML(3); return parent::Field($properties); } @@ -34,14 +45,14 @@ class CreditCardField extends TextField { * @param int $increment Increase current tabindex by this value * @return string */ - protected function getTabIndexHTML($increment = 0) { + public function getTabIndexHTML($increment = 0) { // we can't add a tabindex if there hasn't been one set yet. if($this->getAttribute('tabindex') === null) return false; $tabIndex = (int)$this->getAttribute('tabindex') + (int)$increment; return (is_numeric($tabIndex)) ? ' tabindex = "' . $tabIndex . '"' : ''; } - + public function dataValue() { if(is_array($this->value)) return implode("", $this->value); else return $this->value; diff --git a/templates/forms/CreditCardField.ss b/templates/forms/CreditCardField.ss index 588a15f5b..9876d238a 100644 --- a/templates/forms/CreditCardField.ss +++ b/templates/forms/CreditCardField.ss @@ -1,6 +1,9 @@ - - - - - - - + + - + + - + + - + \ No newline at end of file From 03b2e9dc74db8d0c21a0df35bcfc818fa19a2844 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 19 Dec 2013 19:43:46 +0100 Subject: [PATCH 06/21] "alt" and "title" attrs for images from URLs (fixes #2723) --- forms/HtmlEditorField.php | 4 ++-- javascript/HtmlEditorField.js | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index e5fdff072..409f68396 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -594,13 +594,13 @@ class HtmlEditorField_Toolbar extends RequestHandler { $urlField->dontEscape = true; if($file->Type == 'photo') { - $filePreview->FieldList()->insertBefore(new TextField( + $fields->insertBefore(new TextField( 'AltText', _t('HtmlEditorField.IMAGEALTTEXT', 'Alternative text (alt) - shown if image cannot be displayed'), $file->Title, 80 ), 'CaptionText'); - $filePreview->FieldList()->insertBefore(new TextField( + $fields->insertBefore(new TextField( 'Title', _t('HtmlEditorField.IMAGETITLE', 'Title text (tooltip) - for additional information about the image') ), 'CaptionText'); diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js index fed30bfc9..d0b34b30e 100644 --- a/javascript/HtmlEditorField.js +++ b/javascript/HtmlEditorField.js @@ -1226,7 +1226,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; 'src' : this.find('.thumbnail-preview').attr('src'), 'width' : width ? parseInt(width, 10) : null, 'height' : height ? parseInt(height, 10) : null, - 'class' : this.find(':input[name=CSSClass]').val() + 'class' : this.find(':input[name=CSSClass]').val(), + 'alt' : this.find(':input[name=AltText]').val(), + 'title' : this.find(':input[name=Title]').val() }; }, getExtraData: function() { @@ -1260,6 +1262,8 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; return $('
').append(el).html(); // Little hack to get outerHTML string }, updateFromNode: function(node) { + this.find(':input[name=AltText]').val(node.attr('alt')); + this.find(':input[name=Title]').val(node.attr('title')); this.find(':input[name=Width]').val(node.width()); this.find(':input[name=Height]').val(node.height()); this.find(':input[name=Title]').val(node.attr('title')); From 5c595146a0f055db281ab5f8071b0d00314f48d5 Mon Sep 17 00:00:00 2001 From: Simon Erkelens Date: Thu, 19 Dec 2013 20:37:52 +0100 Subject: [PATCH 07/21] MINOR Documentation slightly improved for js inclusion Although I'm not the best documentor. --- docs/en/reference/requirements.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/en/reference/requirements.md b/docs/en/reference/requirements.md index f6a6fa61e..5bd406545 100644 --- a/docs/en/reference/requirements.md +++ b/docs/en/reference/requirements.md @@ -139,11 +139,15 @@ to change inclusion-order, other than using *Requirements::clear* and rebuilding requirements. Caution: Inclusion order is both relevant for CSS and Javascript files in terms of dependencies, inheritance and overlays - please be careful when messing with the order of Requirements. -NOTE: -By default, SilverStripe includes all Javascript files at the bottom of the page body. If this causes problems for you, +### Javascript placement + +By default, SilverStripe includes all Javascript files at the bottom of the page body, unless there's another script already loaded, then, it's prepended to the first `