From 51e4e147469178f093645d88242f594df2558650 Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Mon, 4 Dec 2023 15:12:00 +0000 Subject: [PATCH] standalone: clean up styling on login/reset password --- css/civicrm.css | 17 ++ ext/standaloneusers/ang/crmResetPassword.js | 1 + .../crmResetPassword/crmResetPassword.html | 55 ++-- ext/standaloneusers/css/standalone.css | 52 ++++ ext/standaloneusers/standaloneusers.php | 10 + .../CRM/Standaloneusers/Page/Login.tpl | 114 +++----- .../Standaloneusers/Page/ResetPassword.tpl | 17 +- .../CRM/Standaloneusers/Page/_contentFoot.tpl | 3 - .../CRM/Standaloneusers/Page/_contentHead.tpl | 272 ------------------ templates/CRM/common/standalone.tpl | 9 +- 10 files changed, 164 insertions(+), 386 deletions(-) create mode 100644 ext/standaloneusers/css/standalone.css delete mode 100644 ext/standaloneusers/templates/CRM/Standaloneusers/Page/_contentFoot.tpl delete mode 100644 ext/standaloneusers/templates/CRM/Standaloneusers/Page/_contentHead.tpl diff --git a/css/civicrm.css b/css/civicrm.css index 65b934fbf3..430a55fd90 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -3962,3 +3962,20 @@ span.crm-status-icon { .dedupe-rules-dialog label > * { margin-left: 30px; } + +/* Standalone-only styles. A minimal set to make it usable out-of-the-box. */ +html.crm-standalone body { + --sa-font-family: sans-serif; + --roundness: 3px; + --error-colour: #a00; + --warning-colour: #fbb862; + --success-colour: #86c66c; + --label-colour: #464354; + --background-colour: rgb(242,242,237); + --box-padding: 1.6rem; + --box-background: #fff; + margin: 0; + padding: 0; + font-family: var(--sa-font-family); + background-color: var(--background-colour); +} diff --git a/ext/standaloneusers/ang/crmResetPassword.js b/ext/standaloneusers/ang/crmResetPassword.js index 2d5db04fd4..017c6c6ff2 100644 --- a/ext/standaloneusers/ang/crmResetPassword.js +++ b/ext/standaloneusers/ang/crmResetPassword.js @@ -62,6 +62,7 @@ return; } if (ctrl.newPassword != ctrl.newPasswordAgain) { + updateAngular('formSubmitted', false); alert(ts("Passwords do not match")); return; } diff --git a/ext/standaloneusers/ang/crmResetPassword/crmResetPassword.html b/ext/standaloneusers/ang/crmResetPassword/crmResetPassword.html index 88a9ae8a6c..f7e692d0a6 100644 --- a/ext/standaloneusers/ang/crmResetPassword/crmResetPassword.html +++ b/ext/standaloneusers/ang/crmResetPassword/crmResetPassword.html @@ -1,21 +1,25 @@
-

Request Password Reset Link

- - +

Request Password Reset Link

- +
+ + +
+ +
-
+ +

{{ts('Thanks. If your username/email matched an active account, we will email you with a special link to provide a new password.')}}

{{ts('The link must be used within an hour, and can only be used once.')}}

@@ -24,32 +28,33 @@
-
-
- Reset Password + +
+ + -
- -
- +
+ + - + {{ts('Passwords do not match')}} - -
- - +
+ +
diff --git a/ext/standaloneusers/css/standalone.css b/ext/standaloneusers/css/standalone.css new file mode 100644 index 0000000000..9093579fe7 --- /dev/null +++ b/ext/standaloneusers/css/standalone.css @@ -0,0 +1,52 @@ +html.crm-standalone body>.crm-container { + padding: 1px 3vw 1rem; +} + +html.crm-standalone nav.breadcrumb>ol { + padding-inline-start: 0; +} + +.standalone-auth-form { + display: grid; + place-content: center; + width: 100%; + height: 100vh; +} +.standalone-auth-box { + box-sizing: border-box; + width: clamp(280px, 68vw, 45rem); + margin: 0; + background-color: white; + border: none; + border-radius: 3px; + padding: 1rem 3vw;; +} +.standalone-auth-form img.crm-logo { + width: 100%; + max-width: 400px; + margin: 0 auto 2rem; + display: block; +} +.standalone-auth-form .input-wrapper { + margin-bottom: 1rem; +} +.standalone-auth-form label { + display: block; +} +.standalone-auth-form input { + box-sizing: border-box; + width: 100%; +} +.standalone-auth-form .login-or-forgot { + display: grid; + gap: 1rem; + grid-template-columns: 1fr 1fr; +} +.standalone-auth-form .login-or-forgot>a { + grid-column: 1; +} +.standalone-auth-form .login-or-forgot>button { + grid-column: 2; + place-self: end; + margin-right: 0; /* override civicrm.css's 6px */ +} diff --git a/ext/standaloneusers/standaloneusers.php b/ext/standaloneusers/standaloneusers.php index fda5e61e72..a463b09f8d 100644 --- a/ext/standaloneusers/standaloneusers.php +++ b/ext/standaloneusers/standaloneusers.php @@ -10,6 +10,16 @@ require_once 'standaloneusers.civix.php'; use CRM_Standaloneusers_ExtensionUtil as E; // phpcs:enable + +function standaloneusers_civicrm_alterBundle(CRM_Core_Resources_Bundle $bundle) { + if ($bundle->name !== 'coreResources') { + return; + } + // This adds a few styles that only need apply to standalone, mainly + // providing a default style for login/password reset type pages. + $bundle->addStyleFile('standaloneusers', 'css/standalone.css'); +} + /** * Hide the inherit CMS language on the Settings - Localization form. * diff --git a/ext/standaloneusers/templates/CRM/Standaloneusers/Page/Login.tpl b/ext/standaloneusers/templates/CRM/Standaloneusers/Page/Login.tpl index 573bc4a776..ac40561086 100644 --- a/ext/standaloneusers/templates/CRM/Standaloneusers/Page/Login.tpl +++ b/ext/standaloneusers/templates/CRM/Standaloneusers/Page/Login.tpl @@ -1,94 +1,66 @@ -{include file='CRM/Standaloneusers/Page/_contentHead.tpl'} - - +
+
- {if $justLoggedOut} -
{ts}You have been logged out.{/ts}
- {/if} - {if $anonAccessDenied} -
{ts}You do not have permission to access that, you may need to login.{/ts}
- {/if} + + {if $justLoggedOut}
{ts}You have been logged out.{/ts}
{/if} + {if $anonAccessDenied}
{ts}You do not have permission to access that, you may + need to login.{/ts}
{/if}
- +
-
+
-
+ - {include file='CRM/Standaloneusers/Page/_contentFoot.tpl'} +
+
+ {literal} {/literal} diff --git a/ext/standaloneusers/templates/CRM/Standaloneusers/Page/ResetPassword.tpl b/ext/standaloneusers/templates/CRM/Standaloneusers/Page/ResetPassword.tpl index 702641abe9..243d852fe6 100644 --- a/ext/standaloneusers/templates/CRM/Standaloneusers/Page/ResetPassword.tpl +++ b/ext/standaloneusers/templates/CRM/Standaloneusers/Page/ResetPassword.tpl @@ -1,7 +1,10 @@ -{include file='CRM/Standaloneusers/Page/_contentHead.tpl'} - - - -{include file='CRM/Standaloneusers/Page/_contentFoot.tpl'} +
+
+ + + + +
+
diff --git a/ext/standaloneusers/templates/CRM/Standaloneusers/Page/_contentFoot.tpl b/ext/standaloneusers/templates/CRM/Standaloneusers/Page/_contentFoot.tpl deleted file mode 100644 index 4a1592de2a..0000000000 --- a/ext/standaloneusers/templates/CRM/Standaloneusers/Page/_contentFoot.tpl +++ /dev/null @@ -1,3 +0,0 @@ -
-
- diff --git a/ext/standaloneusers/templates/CRM/Standaloneusers/Page/_contentHead.tpl b/ext/standaloneusers/templates/CRM/Standaloneusers/Page/_contentHead.tpl deleted file mode 100644 index 742cbcb61f..0000000000 --- a/ext/standaloneusers/templates/CRM/Standaloneusers/Page/_contentHead.tpl +++ /dev/null @@ -1,272 +0,0 @@ - - -
-
- logo for CiviCRM, with an intersecting blue and green triangle - diff --git a/templates/CRM/common/standalone.tpl b/templates/CRM/common/standalone.tpl index 4dbbafd942..75f7382abd 100644 --- a/templates/CRM/common/standalone.tpl +++ b/templates/CRM/common/standalone.tpl @@ -1,5 +1,5 @@ - + @@ -21,13 +21,6 @@ {/if} {if isset($docTitle)}{$docTitle}{else}CiviCRM{/if} - - {if $config->debug} -- 2.25.1