From 947a78cde33138640c9a670afb32ef85b71338f5 Mon Sep 17 00:00:00 2001 From: Matthieu Aubry <mattab@users.noreply.github.com> Date: Tue, 27 Sep 2016 10:41:55 +1300 Subject: [PATCH] Various minor tweaks to 3.x (#10566) * Remove code block height as it looks better to let the browser set height automatically (ie. no scroll bar) * Remove deprecated code * UI tests: nicer code block * select on focus the tracking code --- core/Date.php | 36 ------------------ .../stylesheets/jsTrackingGenerator.css | 4 -- .../templates/_displayJavascriptCode.twig | 2 +- ...grationTest_admin_manage_tracking_code.png | Bin 131 -> 131 bytes 4 files changed, 1 insertion(+), 41 deletions(-) diff --git a/core/Date.php b/core/Date.php index be099e792a..ad492eb6ea 100644 --- a/core/Date.php +++ b/core/Date.php @@ -621,8 +621,6 @@ class Date */ public function getLocalized($template) { - $template = $this->replaceLegacyPlaceholders($template); - $dateTimeFormatProvider = StaticContainer::get('Piwik\Intl\Data\Provider\DateTimeFormatProvider'); $template = $dateTimeFormatProvider->getFormatPattern($template); @@ -643,40 +641,6 @@ class Date return $out; } - /** - * Replaces legacy placeholders - * - * @deprecated should be removed in Piwik 3.0.0 or later - * - * - **%day%**: replaced with the day of the month without leading zeros, eg, **1** or **20**. - * - **%shortMonth%**: the short month in the current language, eg, **Jan**, **Feb**. - * - **%longMonth%**: the whole month name in the current language, eg, **January**, **February**. - * - **%shortDay%**: the short day name in the current language, eg, **Mon**, **Tue**. - * - **%longDay%**: the long day name in the current language, eg, **Monday**, **Tuesday**. - * - **%longYear%**: the four digit year, eg, **2007**, **2013**. - * - **%shortYear%**: the two digit year, eg, **07**, **13**. - * - **%time%**: the time of day, eg, **07:35:00**, or **15:45:00**. - */ - protected function replaceLegacyPlaceholders($template) - { - if (strpos($template, '%') === false) { - return $template; - } - - $mapping = array( - '%day%' => 'd', - '%shortMonth%' => 'MMM', - '%longMonth%' => 'MMMM', - '%shortDay%' => 'EEE', - '%longDay%' => 'EEEE', - '%longYear%' => 'y', - '%shortYear%' => 'yy', - '%time%' => 'HH:mm:ss' - ); - - return str_replace(array_keys($mapping), array_values($mapping), $template); - } - protected function formatToken($token) { $dayOfWeek = $this->toString('N'); diff --git a/plugins/CoreAdminHome/stylesheets/jsTrackingGenerator.css b/plugins/CoreAdminHome/stylesheets/jsTrackingGenerator.css index 0c591087b0..b7dee89bdb 100644 --- a/plugins/CoreAdminHome/stylesheets/jsTrackingGenerator.css +++ b/plugins/CoreAdminHome/stylesheets/jsTrackingGenerator.css @@ -1,7 +1,3 @@ -#javascript-output-section .codeblock { - height: 312px; -} - #image-link-output-section .codeblock { height: 92px; } diff --git a/plugins/SitesManager/templates/_displayJavascriptCode.twig b/plugins/SitesManager/templates/_displayJavascriptCode.twig index b523ec28e7..c80d286609 100644 --- a/plugins/SitesManager/templates/_displayJavascriptCode.twig +++ b/plugins/SitesManager/templates/_displayJavascriptCode.twig @@ -9,7 +9,7 @@ <p>{{ 'CoreAdminHome_JSTracking_CodeNoteBeforeClosingHead'|translate("</head>")|raw }}</p> - <pre>{{ jsTag|raw }}</pre> + <pre piwik-select-on-focus>{{ jsTag|raw }}</pre> <p>{{ 'CoreAdminHome_JSTrackingIntro5'|translate('<a rel="noreferrer" target="_blank" href="http://piwik.org/docs/javascript-tracking/">','</a>')|raw }}</p> diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_manage_tracking_code.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_manage_tracking_code.png index 1eb5c44a08eb65bf31e337677190c0d2607fbf36..f50da961c2a1a6d0558246edb4d2c0e3430889fa 100644 GIT binary patch delta 84 zcmV~$u@QhE3<c1mWeP`tkc9jp93n)xv$nHk0Y~<|op$>4q*fQC!c?tKb?#BX9y+j` ew28wZUCgawTtpV|iLRwa36lKW?>t&z63#!gHx=&y delta 84 zcmWN<!3}^Q3<c15WeP`tLi@`Q4nZwVJbUxX0*<VCZ*6OP<!Hgw1(~6U;Rf|yx>cIS f=bU25xd^oWhC>My)>~mgXqcz_dgfkp6GHj`$VwJs -- GitLab