From aaf2e659a694ab4007ecea6178b8db0ad481f43a Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Wed, 9 Sep 2020 17:42:44 +1200 Subject: Update donations widget (#16405) * Update donations widget * fix some tests * fix some tests * update css * fix test * improve wording * fix tests --- plugins/CoreAdminHome/CoreAdminHome.php | 1 - plugins/CoreHome/CoreHome.php | 1 - plugins/CoreHome/javascripts/donate.js | 142 --------------------- plugins/CoreHome/lang/en.json | 6 +- plugins/CoreHome/stylesheets/_donate.less | 2 +- plugins/CoreHome/stylesheets/layout.less | 8 ++ plugins/CoreHome/templates/_donate.twig | 43 ++----- plugins/CoreUpdater/Controller.php | 1 - plugins/CoreUpdater/stylesheets/updateLayout.css | 6 +- .../expected-screenshots/CoreUpdaterDb_updated.png | 4 +- .../DashboardManager_removed.png | 4 +- .../UI/expected-screenshots/Dashboard_removed.png | 4 +- plugins/Feedback/templates/index.twig | 2 +- plugins/Morpheus/images/paypal_subscribe.png | Bin 2636 -> 0 bytes plugins/Morpheus/images/smileyprog_0.png | Bin 4045 -> 0 bytes plugins/Morpheus/images/smileyprog_1.png | Bin 4268 -> 0 bytes plugins/Morpheus/images/smileyprog_2.png | Bin 4292 -> 0 bytes plugins/Morpheus/images/smileyprog_3.png | Bin 4589 -> 0 bytes plugins/Morpheus/images/smileyprog_4.png | Bin 4733 -> 0 bytes 19 files changed, 37 insertions(+), 187 deletions(-) delete mode 100644 plugins/CoreHome/javascripts/donate.js delete mode 100644 plugins/Morpheus/images/paypal_subscribe.png delete mode 100644 plugins/Morpheus/images/smileyprog_0.png delete mode 100644 plugins/Morpheus/images/smileyprog_1.png delete mode 100644 plugins/Morpheus/images/smileyprog_2.png delete mode 100644 plugins/Morpheus/images/smileyprog_3.png delete mode 100644 plugins/Morpheus/images/smileyprog_4.png (limited to 'plugins') diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php index 2d5fcb9673..c8c4a0dcef 100644 --- a/plugins/CoreAdminHome/CoreAdminHome.php +++ b/plugins/CoreAdminHome/CoreAdminHome.php @@ -71,7 +71,6 @@ class CoreAdminHome extends \Piwik\Plugin $jsFiles[] = "plugins/Morpheus/javascripts/piwikHelper.js"; $jsFiles[] = "plugins/Morpheus/javascripts/ajaxHelper.js"; $jsFiles[] = "plugins/CoreHome/javascripts/broadcast.js"; - $jsFiles[] = "plugins/CoreHome/javascripts/donate.js"; $jsFiles[] = "plugins/CoreAdminHome/javascripts/protocolCheck.js"; } diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index c181e3f290..a2db0401d5 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -177,7 +177,6 @@ class CoreHome extends \Piwik\Plugin $jsFiles[] = "plugins/CoreHome/javascripts/sparkline.js"; $jsFiles[] = "plugins/CoreHome/javascripts/corehome.js"; $jsFiles[] = "plugins/CoreHome/javascripts/top_controls.js"; - $jsFiles[] = "plugins/CoreHome/javascripts/donate.js"; $jsFiles[] = "libs/jqplot/jqplot-custom.min.js"; $jsFiles[] = "plugins/CoreHome/javascripts/color_manager.js"; $jsFiles[] = "plugins/CoreHome/javascripts/notification.js"; diff --git a/plugins/CoreHome/javascripts/donate.js b/plugins/CoreHome/javascripts/donate.js deleted file mode 100644 index c0ab5ddfc2..0000000000 --- a/plugins/CoreHome/javascripts/donate.js +++ /dev/null @@ -1,142 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * @link https://matomo.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ -(function ($) { - - $(document).ready(function () { - - var donateAmounts = [0, 30, 60, 90, 120]; - - // returns the space between each donation amount in the donation slider - var getTickWidth = function (slider) { - var effectiveSliderWidth = $('.slider-range', slider).width() - $('.slider-position', slider).width(); - return effectiveSliderWidth / (donateAmounts.length - 1); - }; - - // returns the position index on a slider based on a x coordinate value - var getPositionFromPageCoord = function (slider, pageX) { - return Math.round((pageX - $('.slider-range', slider).offset().left) / getTickWidth(slider)); - }; - - // set's the correct amount text & smiley face image based on the position of the slider - var setSmileyFaceAndAmount = function (slider, pos) { - // set text yearly amount - $('.slider-donate-amount', slider).text('$' + donateAmounts[pos] + '/' + _pk_translate('Intl_Year_Short')); - - // set the right smiley face - $('.slider-smiley-face').attr('src', 'plugins/Morpheus/images/smileyprog_' + pos + '.png'); - - // set the hidden option input for paypal - var option = Math.max(1, pos); - $('.piwik-donate-call input[name=os0]').val("Option " + option); - }; - - // move's a slider's position to a specific spot - var moveSliderPosition = function (slider, to) { - // make sure 'to' is valid - if (to < 0) { - to = 0; - } - else if (to >= donateAmounts.length) { - to = donateAmounts.length - 1; - } - - // set the slider position - var left = to * getTickWidth(slider); - if (left == 0) { - left = -1; // at position 0 we move one pixel left to cover up some of slider bar - } - - $('.slider-position', slider).css({ - left: left + 'px' - }); - - // reset the smiley face & amount based on the new position - setSmileyFaceAndAmount(slider, to); - }; - - // when a slider is clicked, set the amount & smiley face appropriately - $('body').on('click', '.piwik-donate-slider>.slider-range', function (e) { - var slider = $(this).parent(), - currentPageX = $('.slider-position', this).offset().left, - currentPos = getPositionFromPageCoord(slider, currentPageX), - pos = getPositionFromPageCoord(slider, e.pageX); - - // if the closest position is the current one, use the other position since - // the user obviously wants to move the slider. - if (currentPos == pos) { - // if click is to right, go forward one, else backwards one - if (e.pageX > currentPageX) { - ++pos; - } - else { - --pos; - } - } - - moveSliderPosition(slider, pos); - }); - - // when the smiley icon is clicked, move the position up one to demonstrate how to use the slider - $('body').on('click', '.piwik-donate-slider .slider-smiley-face,.piwik-donate-slider .slider-donate-amount', - function (e) { - var slider = $(this).closest('.piwik-donate-slider'), - currentPageX = $('.slider-position', slider).offset().left, - currentPos = getPositionFromPageCoord(slider, currentPageX); - - moveSliderPosition(slider, currentPos + 1); - } - ); - - // stores the current slider being dragged - var draggingSlider = false; - - // start dragging on mousedown for a slider's position bar - $('body').on('mousedown', '.piwik-donate-slider .slider-position', function () { - draggingSlider = $(this).parent().parent(); - }); - - // move the slider position if currently dragging when the mouse moves anywhere over the entire page - $('body').on('mousemove', function (e) { - if (draggingSlider) { - var slider = draggingSlider.find('.slider-range'), - sliderPos = slider.find('.slider-position'), - left = e.pageX - slider.offset().left; - - // only move slider if the mouse x-coord is still on the slider (w/ some padding for borders) - if (left <= slider.width() - sliderPos.width() + 2 - && left >= -2) { - sliderPos.css({left: left + 'px'}); - - var closestPos = Math.round(left / getTickWidth(draggingSlider)); - setSmileyFaceAndAmount(draggingSlider, closestPos); - } - } - }); - - // stop dragging and normalize a slider's position on mouseup over the entire page - $('body').on('mouseup', function () { - if (draggingSlider) { - var sliderPos = $('.slider-position', draggingSlider), - slider = sliderPos.parent(); - - if (sliderPos.length) { - // move the slider to the nearest donation amount position - var pos = getPositionFromPageCoord(draggingSlider, sliderPos.offset().left); - moveSliderPosition(draggingSlider, pos); - } - - draggingSlider = false; // stop dragging - } - }); - - // event for programmatically changing the position - $('body').on('piwik:changePosition', '.piwik-donate-slider', function (e, data) { - moveSliderPosition(this, data.position); - }); - }); - -}(jQuery)); diff --git a/plugins/CoreHome/lang/en.json b/plugins/CoreHome/lang/en.json index 06cb3f9c76..a3612f6e42 100644 --- a/plugins/CoreHome/lang/en.json +++ b/plugins/CoreHome/lang/en.json @@ -20,7 +20,6 @@ "DonateCall1": "Matomo will always cost you nothing to use, but that doesn't mean it costs us nothing to make.", "DonateCall2": "Matomo needs your continued support to grow and thrive.", "DonateCall3": "If you feel that Matomo has added significant value to your business or endeavour, %1$splease consider donating%2$s or %3$spurchasing a premium feature%4$s. Every penny will help.", - "DonateFormInstructions": "Click on the slider to select an amount, then click subscribe to donate.", "EndShortcut": "End", "EnterZenMode": "Enter Zen mode (hide the menus)", "ExitZenMode": "Exit Zen mode (show the menus)", @@ -32,7 +31,7 @@ "ShowExportUrl": "Show Export URL", "HideExportUrl": "Hide Export URL", "HomeShortcut": "Home", - "HowMuchIsPiwikWorth": "How much is Matomo worth to you?", + "SupportUsOn": "Support us on", "IncludeRowsWithLowPopulation": "Rows with low population are hidden %s Show all rows", "InjectedHostEmailBody": "Hello, I tried to access Matomo today and encountered the unknown hostname warning.", "InjectedHostEmailSubject": "Matomo was accessed with an unknown hostname: %s", @@ -45,7 +44,8 @@ "VisitTypeReturning": "Returning", "VisitTypeReturningCustomer": "Returning Customer", "MainNavigation": "Main navigation", - "MakeOneTimeDonation": "Make a one time donation, instead.", + "YourDonationWillHelp": "Your donation will directly help fund new features and improvements for this open-source analytics platform. This means the community will always benefit from a tool that protects privacy and lets you stay in control of your data.", + "ThanksFromAllOfUs": "Thank you from all of us at Matomo!", "Menu": "Menu", "NoPrivilegesAskPiwikAdmin": "You are logged in as '%1$s' but it seems you don't have any permission set in Matomo. %2$s Ask your Matomo administrator (click to email)%3$s to give you 'view' access to a website.", "OnlyForSuperUserAccess": "This widget is displayed in the default dashboard only to users having Super User access.", diff --git a/plugins/CoreHome/stylesheets/_donate.less b/plugins/CoreHome/stylesheets/_donate.less index be304efbff..f3765a23c5 100644 --- a/plugins/CoreHome/stylesheets/_donate.less +++ b/plugins/CoreHome/stylesheets/_donate.less @@ -10,7 +10,7 @@ font-size: 1.2em; font-weight: bold; display: block; - margin: 0 1em 0 0; + margin: 1em 1em 0.5em 0; } .piwik-donate-slider { diff --git a/plugins/CoreHome/stylesheets/layout.less b/plugins/CoreHome/stylesheets/layout.less index d4e116a9db..67967f20ca 100644 --- a/plugins/CoreHome/stylesheets/layout.less +++ b/plugins/CoreHome/stylesheets/layout.less @@ -3,6 +3,14 @@ margin-bottom: 0; } +ul.browser-default { + list-style-type: disc; + li { + margin-left: 20px; + list-style-type: disc; + } +} + nav { background-color: @theme-color-header-background !important; diff --git a/plugins/CoreHome/templates/_donate.twig b/plugins/CoreHome/templates/_donate.twig index 99e713ec82..06d7a4d836 100644 --- a/plugins/CoreHome/templates/_donate.twig +++ b/plugins/CoreHome/templates/_donate.twig @@ -9,39 +9,22 @@ {% endif %} - {{ 'CoreHome_HowMuchIsPiwikWorth'|translate }} + {{ 'CoreHome_SupportUsOn'|translate }} - + -
-
-
-
-
-
-
$30/{{ 'Intl_Year_Short'|translate }}
+

+ {{ 'CoreHome_YourDonationWillHelp'|translate }} +

+ {{ 'CoreHome_ThanksFromAllOfUs'|translate }} +

- -
- - -
- - - - - - - - - -
{% if footerMessage is defined %}
{{ footerMessage }} diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php index b6d13c7c3c..e3df561e2c 100644 --- a/plugins/CoreUpdater/Controller.php +++ b/plugins/CoreUpdater/Controller.php @@ -97,7 +97,6 @@ class Controller extends \Piwik\Plugin\Controller 'node_modules/materialize-css/dist/js/materialize.min.js', "plugins/CoreHome/javascripts/materialize-bc.js", 'plugins/Morpheus/javascripts/piwikHelper.js', - 'plugins/CoreHome/javascripts/donate.js', 'plugins/CoreUpdater/javascripts/updateLayout.js', 'node_modules/angular/angular.min.js', 'node_modules/angular-sanitize/angular-sanitize.min.js', diff --git a/plugins/CoreUpdater/stylesheets/updateLayout.css b/plugins/CoreUpdater/stylesheets/updateLayout.css index 040ab3f290..e90c33d37e 100644 --- a/plugins/CoreUpdater/stylesheets/updateLayout.css +++ b/plugins/CoreUpdater/stylesheets/updateLayout.css @@ -2,7 +2,11 @@ margin: 0; padding: 0; } - +#donate-form-container .piwik-donate-call #piwik-worth, +#donate-form-container .piwik-donate-call li, +#donate-form-container .piwik-donate-call ul { + display: inline;font-size:14px; +} .topBarElem { font-family: arial, sans-serif !important; font-size: 13px; diff --git a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_updated.png b/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_updated.png index 2817aef897..c0486b0ddf 100644 --- a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_updated.png +++ b/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_updated.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:06c5db4eb9bfad47b3c84f35100d542b4116a1dcf8cb81f2aef3afb704685fd9 -size 77361 +oid sha256:54250cb246a4d53bce07ae13c935a2ef8cac06dadfebff14181d5ced2ecb3a3a +size 83276 diff --git a/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png b/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png index f352da529a..1dec02d9e3 100644 --- a/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png +++ b/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a542bf726e1ba28102e30719d2761584becc47b36d244042633f5379a89f7ef -size 472762 +oid sha256:222c6ca087789bd646ac2784b4c90e34d942e090e07075a88d4549d6ad680532 +size 479617 diff --git a/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_removed.png b/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_removed.png index d310aadbdc..7d434ff42b 100644 --- a/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_removed.png +++ b/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_removed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4bf08ddd651f96d20f4dbf7db1cba26069133afccc147b7bc498a537b4e0f770 -size 732787 +oid sha256:69a31e21d8494521e94f108d909848e174956b6e8d9f9807318808dff5484eec +size 741881 diff --git a/plugins/Feedback/templates/index.twig b/plugins/Feedback/templates/index.twig index c8099a0209..5f34596644 100644 --- a/plugins/Feedback/templates/index.twig +++ b/plugins/Feedback/templates/index.twig @@ -16,7 +16,7 @@ "", "", "", - "", + "", "", "", "" diff --git a/plugins/Morpheus/images/paypal_subscribe.png b/plugins/Morpheus/images/paypal_subscribe.png deleted file mode 100644 index 975c136f64..0000000000 Binary files a/plugins/Morpheus/images/paypal_subscribe.png and /dev/null differ diff --git a/plugins/Morpheus/images/smileyprog_0.png b/plugins/Morpheus/images/smileyprog_0.png deleted file mode 100644 index 8a4627eea3..0000000000 Binary files a/plugins/Morpheus/images/smileyprog_0.png and /dev/null differ diff --git a/plugins/Morpheus/images/smileyprog_1.png b/plugins/Morpheus/images/smileyprog_1.png deleted file mode 100644 index 5b16b257ae..0000000000 Binary files a/plugins/Morpheus/images/smileyprog_1.png and /dev/null differ diff --git a/plugins/Morpheus/images/smileyprog_2.png b/plugins/Morpheus/images/smileyprog_2.png deleted file mode 100644 index 55537fb732..0000000000 Binary files a/plugins/Morpheus/images/smileyprog_2.png and /dev/null differ diff --git a/plugins/Morpheus/images/smileyprog_3.png b/plugins/Morpheus/images/smileyprog_3.png deleted file mode 100644 index 3410a344be..0000000000 Binary files a/plugins/Morpheus/images/smileyprog_3.png and /dev/null differ diff --git a/plugins/Morpheus/images/smileyprog_4.png b/plugins/Morpheus/images/smileyprog_4.png deleted file mode 100644 index 0facd94f85..0000000000 Binary files a/plugins/Morpheus/images/smileyprog_4.png and /dev/null differ -- cgit v1.2.3