From 3b09e9abc1f255a3d14c7db98b49894bbab02096 Mon Sep 17 00:00:00 2001 From: Stefan Giehl <stefan@piwik.org> Date: Mon, 26 Sep 2016 21:58:17 +0200 Subject: [PATCH] Materialize login form errors (#10565) * fixes #10563 - materialize login form errors * updates expected screenshots * cleanup css --- plugins/Login/javascripts/login.js | 3 ++- plugins/Login/stylesheets/login.less | 12 +----------- plugins/Login/templates/_formErrors.twig | 4 +++- plugins/Login/templates/login.twig | 4 +++- .../expected-screenshots/Login_login_fail.png | Bin 130 -> 130 bytes .../Login_password_reset_error.png | Bin 130 -> 130 bytes 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/plugins/Login/javascripts/login.js b/plugins/Login/javascripts/login.js index 573a3225b4..981f02b643 100755 --- a/plugins/Login/javascripts/login.js +++ b/plugins/Login/javascripts/login.js @@ -60,7 +60,7 @@ var ajaxDone = function (response) { $('.loadingPiwik').hide(); - var isSuccess = response.indexOf('message_error') === -1, + var isSuccess = response.indexOf('piwik-notification') === -1, fadeOutIds = '.resetForm .message_container'; if (isSuccess) { fadeOutIds += ',#reset_form,#reset_form_nav'; @@ -72,6 +72,7 @@ } $('.resetForm .message_container').html(response).fadeIn(300); + piwikHelper.compileAngularComponents('.resetForm .message_container'); }); }; diff --git a/plugins/Login/stylesheets/login.less b/plugins/Login/stylesheets/login.less index c3acd40afd..2d9e34f39f 100644 --- a/plugins/Login/stylesheets/login.less +++ b/plugins/Login/stylesheets/login.less @@ -76,21 +76,11 @@ /* MESSAGE ***********************/ - .message_error, .message { margin: 0 auto; - border: 1px solid; + border: 1px solid #e6db55; padding: 12px; - } - - .message_error { - background-color: #ffebe8; - border-color: #c00; - } - - .message { background-color: #ffffe0; - border-color: #e6db55; } /* NAVIGATION diff --git a/plugins/Login/templates/_formErrors.twig b/plugins/Login/templates/_formErrors.twig index 2eaf82c2ab..acfdf1e583 100644 --- a/plugins/Login/templates/_formErrors.twig +++ b/plugins/Login/templates/_formErrors.twig @@ -1,6 +1,8 @@ {% if formErrors is defined and formErrors is not empty %} - <div class="message_error"> + <div piwik-notification + noclear="true" + context="error"> {% for data in formErrors %} <strong>{{ 'General_Error'|translate }}</strong>: {{ data|raw }} <br/> diff --git a/plugins/Login/templates/login.twig b/plugins/Login/templates/login.twig index 27f14d420e..6a124465a1 100644 --- a/plugins/Login/templates/login.twig +++ b/plugins/Login/templates/login.twig @@ -72,7 +72,9 @@ {{ include('@Login/_formErrors.twig', {formErrors: form_data.errors } ) }} {% if AccessErrorString %} - <div class="message_error"> + <div piwik-notification + noclear="true" + context="error"> <strong>{{ 'General_Error'|translate }}</strong>: {{ AccessErrorString|raw }}<br/> </div> {% endif %} diff --git a/tests/UI/expected-screenshots/Login_login_fail.png b/tests/UI/expected-screenshots/Login_login_fail.png index 2cc18891826e19b5fe7d0a2eef7ee369f798a1a3..1a38acc1069a5e8093238dd6e2fdcb32741703fd 100644 GIT binary patch delta 83 zcmWN_u@S%^2mrvdb&8CDf}lHO2~fC8oi3#lWaQ+_-)X0pPcea3!=!fRuCONI3|=KL fv<!3ozo?Nx6YnschEQ!Z+&vKTeLa34U~TyW(3KX! delta 83 zcmV~$yAgmO3;@uhWeP_C@-f-LB|;MJtnDnBz>$4#mt8)-v@P%vQ#^stNtZilH(?dF eMTtNI>EtjlgAnC#$(Y;?$wqzdHxFp7YyAP-Ocwb7 diff --git a/tests/UI/expected-screenshots/Login_password_reset_error.png b/tests/UI/expected-screenshots/Login_password_reset_error.png index bb69b9fdb4cbdfaabe330c97855aaa7139493201..8f0cd15d6ea28d64203e4aa1566340812288b9ac 100644 GIT binary patch delta 80 zcmV~$!3}^g2nEpe+9@326N119j?n^5JbUxl2^`t?cH8aq%PfQ_zyfGwV7V2h&1J(= bMaxu!IfYIDflQWIkTHGq=YH#8C0PFfdYl!y delta 80 zcmWN{yAgme2msKt%@mHnCtw)CF%aa=+Ric)II_O_&1EjH?cyOhG>XXqBRB<;H$;iS cU~w1`XNH&mi!jPdJE-x1-tOx;S5`!9ACuA*)&Kwi -- GitLab