diff options
author | Stefan Giehl <stefan@piwik.org> | 2018-07-03 01:38:35 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-07-03 01:38:35 +0300 |
commit | 1a37b8487f6ce7effc5088301909743bd15a19ee (patch) | |
tree | f0fc678423a2a80fea2ae915bc96d4a98dc07839 | |
parent | 1f2753aa2af2ae98b7bb5dfc6b15546c705b7bbc (diff) |
Make it possible to use line breaks in placeholders (#13125)
* Make it possible to use line breaks in placeholders
for safari those line breaks will be replaced with 200 white spaces, as line breaks aren't supported there
* use example.com and example.org as placeholders
5 files changed, 14 insertions, 5 deletions
diff --git a/plugins/CoreHome/angularjs/common/directives/attributes.js b/plugins/CoreHome/angularjs/common/directives/attributes.js index 825ed22b96..4c59d71cc2 100644 --- a/plugins/CoreHome/angularjs/common/directives/attributes.js +++ b/plugins/CoreHome/angularjs/common/directives/attributes.js @@ -35,6 +35,13 @@ if (angular.isObject(value)) { value = JSON.stringify(value); } + + // replace line breaks in placeholder with big amount of spaces for safari, + // as line breaks are not support there + if (key === 'placeholder' && /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) { + value = value.replace(/(?:\r\n|\r|\n)/g, (new Array(200)).join(' ')); + } + if (key === 'disabled') { element.prop(key, value); } else { diff --git a/plugins/SitesManager/tests/System/expected/test_SitesManager__SitesManager.getSiteSettings.xml b/plugins/SitesManager/tests/System/expected/test_SitesManager__SitesManager.getSiteSettings.xml index 3b43c61803..35b7307c03 100644 --- a/plugins/SitesManager/tests/System/expected/test_SitesManager__SitesManager.getSiteSettings.xml +++ b/plugins/SitesManager/tests/System/expected/test_SitesManager__SitesManager.getSiteSettings.xml @@ -17,7 +17,8 @@ <uiControlAttributes> <cols>25</cols> <rows>3</rows> - <placeholder>https://siteUrl.com/ https://siteUrl2.com/</placeholder> + <placeholder>http://example.com/ +https://www.example.org/</placeholder> </uiControlAttributes> <availableValues /> <description /> diff --git a/plugins/WebsiteMeasurable/Settings/Urls.php b/plugins/WebsiteMeasurable/Settings/Urls.php index 29b9e3bdfb..5b63440be0 100644 --- a/plugins/WebsiteMeasurable/Settings/Urls.php +++ b/plugins/WebsiteMeasurable/Settings/Urls.php @@ -41,7 +41,7 @@ class Urls extends \Piwik\Settings\Measurable\MeasurableProperty $config->uiControlAttributes = array( 'cols' => '25', 'rows' => '3', - 'placeholder' => "https://siteUrl.com/ https://siteUrl2.com/", + 'placeholder' => "http://example.com/\nhttps://www.example.org/", ); $self = $this; diff --git a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getAvailableMeasurableTypes.xml b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getAvailableMeasurableTypes.xml index 9ef44c8710..b7081fb4fa 100644 --- a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getAvailableMeasurableTypes.xml +++ b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getAvailableMeasurableTypes.xml @@ -22,7 +22,8 @@ <uiControlAttributes> <cols>25</cols> <rows>3</rows> - <placeholder>https://siteUrl.com/ https://siteUrl2.com/</placeholder> + <placeholder>http://example.com/ +https://www.example.org/</placeholder> </uiControlAttributes> <availableValues /> <description /> diff --git a/tests/UI/expected-screenshots/MeasurableManager_add_measurable_view.png b/tests/UI/expected-screenshots/MeasurableManager_add_measurable_view.png index a86fceac5b..5835bfc161 100644 --- a/tests/UI/expected-screenshots/MeasurableManager_add_measurable_view.png +++ b/tests/UI/expected-screenshots/MeasurableManager_add_measurable_view.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e790ab2766030f1b8fa28f8d70db8529fa3c49c34c884c1efd9cfcd2bdc296b6 -size 433684 +oid sha256:5d1e604ea6b71778e00693466cee77a6864a432f4cd9f36f14f3d777d31b3092 +size 433946 |