From ddde99fc2958f67d4ea3b36320118b90278c339e Mon Sep 17 00:00:00 2001
From: Robert Lange <robert.lange@uni-leipzig.de>
Date: Thu, 20 Jun 2019 17:25:01 +0200
Subject: [PATCH] refs #15235 [fid] refactor registrations forms

* add legend for required fields
* fix moving label by click on eula
* set checkbox by click on label
* add back buttons to policy and terms in lightbox
---
 themes/fid/scss/_customVariables.scss         |  2 +-
 themes/fid/scss/compiled.scss                 | 14 +++++++++----
 themes/fid/templates/fid/user/create.phtml    | 21 ++++++++++++-------
 themes/fid/templates/fid/user/init.phtml      | 11 ++++++++--
 themes/fid/templates/fid/user/policy-de.phtml |  3 +--
 themes/fid/templates/fid/user/policy-en.phtml |  3 +--
 themes/fid/templates/fid/user/policy.phtml    | 16 ++++++++++++++
 themes/fid/templates/fid/user/terms-de.phtml  |  3 +--
 themes/fid/templates/fid/user/terms-en.phtml  |  3 +--
 themes/fid/templates/fid/user/terms.phtml     | 16 ++++++++++++++
 10 files changed, 69 insertions(+), 23 deletions(-)

diff --git a/themes/fid/scss/_customVariables.scss b/themes/fid/scss/_customVariables.scss
index 793c90eb273..37d0cf219a0 100644
--- a/themes/fid/scss/_customVariables.scss
+++ b/themes/fid/scss/_customVariables.scss
@@ -7,4 +7,4 @@ $margin-right-width: 5px;
 $content-left-padding: $grid-gutter-width;
 $content-right-padding: $grid-gutter-width;
 $button-left-margin: $margin-left-width;
-$button-right-margin: $margin-right-width;
+$button-right-margin: $margin-right-width;
\ No newline at end of file
diff --git a/themes/fid/scss/compiled.scss b/themes/fid/scss/compiled.scss
index 43d14ac7f5f..00740387444 100644
--- a/themes/fid/scss/compiled.scss
+++ b/themes/fid/scss/compiled.scss
@@ -40,7 +40,13 @@
 form input:focus:required:invalid {
   box-shadow: 0 0 2px 1px rgba(255,0,0,0.9);
 }
-//
-//form input:invalid {
-//  box-shadow: none;
-//}
\ No newline at end of file
+
+.registration {
+  input[type="checkbox"] {
+    display: inline-flex;
+    margin-right: $margin-right-width;
+    padding-left: $margin-right-width;
+  }
+}
+
+
diff --git a/themes/fid/templates/fid/user/create.phtml b/themes/fid/templates/fid/user/create.phtml
index 64be7935051..31120952765 100644
--- a/themes/fid/templates/fid/user/create.phtml
+++ b/themes/fid/templates/fid/user/create.phtml
@@ -57,7 +57,7 @@ $formElementErrors->setTranslator($translator);
 $form = $this->form;
 $form->setAttribute('method', 'post');
 $form->setAttribute('action', $this->url('fid/user/create'));
-$form->setAttribute('class', 'form-horizontal');
+$form->setAttribute('class', 'form-horizontal registration');
 $form->prepare();
 
 $this->headTitle($this->translate('Profile Form'));
@@ -65,6 +65,11 @@ $this->headTitle($this->translate("fid::user_create_form_title"));
 ?>
 
 <h2><?= $this->translate("fid::user_create_form_title") ?></h2>
+
+<div class="subito-pg">
+    * <?=$this->transEsc("This field is required")?>
+</div>
+
 <?= $this->flashmessages() ?>
 <?= $this->form()->openTag($form) ?>
 <br/>
@@ -220,22 +225,22 @@ $elemJobTitle->setAttributes(['class' => 'form-control']);
 <?php
 /** @var Checkbox $elemEulaAccepted */
 $elemEulaAccepted = $form->get('eulaAccepted');
+$elemEulaAccepted->setAttribute('id', $elemEulaAccepted->getAttribute('name') ?? 'eulaAccepted');
 $elemEulaAccepted->setAttributes(['class' => 'inline']);
 $elemEulaAccepted->setLabelAttributes(['class' => 'inline']);
 ?>
-<div class="form-group">
+<br />
+<div class="no-margin-l">
     <?= $this->formElement($elemEulaAccepted) ?>
     <?= $this->formLabel()->openTag($elemEulaAccepted) ?>
     <?= $this->translate("fid::policy_text") ?>
-    <? $url = $this->url('fid/user/policy') ?>
-    <a data-lightbox href="<?= $url ?>">
+    <?php $url = $this->url('fid/user/policy') ?>
+    <a target="_blank" href="<?= $url ?>">
         <?= $this->translate("fid::policy") ?>
     </a>
     <?= $this->translate("fid::terms_text") ?>
-    <? $url = $this->url('fid/user/terms') ?>
-    <a data-lightbox href="<?= $url ?>">
-        <?= $this->translate("fid::terms") ?>
-    </a>.
+    <?php $url = $this->url('fid/user/terms') ?>
+    <a target="_blank" href="<?= $url ?>"><?= $this->translate("fid::terms") ?>.</a>
     <?= $this->formLabel()->closeTag($elemEulaAccepted) ?>
     <?= $this->formElementErrors($elemEulaAccepted) ?>
 </div>
diff --git a/themes/fid/templates/fid/user/init.phtml b/themes/fid/templates/fid/user/init.phtml
index 00b634df289..1cc338a2685 100644
--- a/themes/fid/templates/fid/user/init.phtml
+++ b/themes/fid/templates/fid/user/init.phtml
@@ -47,12 +47,18 @@ $formElementErrors->setTranslator($translator);
 $form = $this->form;
 $form->setAttribute('method', 'post');
 $form->setAttribute('action', $this->url('fid/user/init'));
+$form->setAttribute('class', 'registration');
 $form->prepare();
 
 $this->headTitle($this->translate("fid::user_init_form_title"));
 ?>
 
 <h2><?= $this->translate("fid::user_init_form_title") ?></h2>
+
+<div class="subito-pg">
+    * <?=$this->transEsc("This field is required")?>
+</div>
+
 <?= $this->flashmessages() ?>
 <?= $this->form()->openTag($form) ?>
 <br/>
@@ -112,18 +118,19 @@ $elemLastname->setAttributes(['class' => 'form-control']);
 <?php
 /** @var Element\Checkbox $elemEulaAccepted */
 $elemEulaAccepted = $form->get('eulaAccepted');
+$elemEulaAccepted->setAttribute('id', $elemEulaAccepted->getAttribute('name') ?? 'eulaAccepted');
 ?>
 <div class="form-group">
     <?= $this->formElement($elemEulaAccepted) ?>
     <?= $this->formLabel()->openTag($elemEulaAccepted) ?>
     <?= $this->translate("fid::policy_text") ?>
     <? $url = $this->url('fid/user/policy') ?>
-    <a data-lightbox href="<?= $url ?>">
+    <a target="_blank" href="<?= $url ?>">
         <?= $this->translate("fid::policy") ?>
     </a>
     <?= $this->translate("fid::terms_text") ?>
     <? $url = $this->url('fid/user/terms') ?>
-    <a data-lightbox href="<?= $url ?>">
+    <a target="_blank" href="<?= $url ?>">
         <?= $this->translate("fid::terms") ?></a>.
     <?= $this->formLabel()->closeTag($elemEulaAccepted) ?>
     <?= $this->formElementErrors($elemEulaAccepted) ?>
diff --git a/themes/fid/templates/fid/user/policy-de.phtml b/themes/fid/templates/fid/user/policy-de.phtml
index 42bd73758a7..db180bbe743 100644
--- a/themes/fid/templates/fid/user/policy-de.phtml
+++ b/themes/fid/templates/fid/user/policy-de.phtml
@@ -1,5 +1,4 @@
-<div class="adlr-policies">
-  <br />
+<div class="fid-policies">
   <h2><strong>Datenschutzerkl&auml;rung</strong></h2>
   <ol>
     <li><strong>Name und Anschrift des Verantwortlichen</strong></li>
diff --git a/themes/fid/templates/fid/user/policy-en.phtml b/themes/fid/templates/fid/user/policy-en.phtml
index 7869bf7c766..62ad2fc2499 100644
--- a/themes/fid/templates/fid/user/policy-en.phtml
+++ b/themes/fid/templates/fid/user/policy-en.phtml
@@ -1,5 +1,4 @@
-<div class="adlr-policies">
-  <br />
+<div class="fid-policies">
   <h2><strong>Privacy Policy</strong></h2>
   <p>Please note: The English version of our privacy policy is for informational purposes only. The
     German version shall be legally binding only.</p>
diff --git a/themes/fid/templates/fid/user/policy.phtml b/themes/fid/templates/fid/user/policy.phtml
index 806aedc38d6..bb3e1fb5ed4 100644
--- a/themes/fid/templates/fid/user/policy.phtml
+++ b/themes/fid/templates/fid/user/policy.phtml
@@ -1,9 +1,25 @@
 <!-- fid - policy begin -->
 <? $lang = $this->layout()->userLang; ?>
+<?php if ($this->layout()->getTemplate() == 'layout/lightbox'): ?>
+    <div class="form-group">
+        <a class="back-to-login btn btn-link" href="<?=$this->url('myresearch-account') ?>">
+            <i class="fa fa-chevron-left" aria-hidden="true"></i>
+            <?=$this->transEsc('Back')?>
+        </a>
+    </div>
+<? endif; ?>
 <? $fileExists = file_exists(dirname(__FILE__) . '/policy-'.$lang.'.phtml'); ?>
 <? if ($fileExists): ?>
     <?=$this->render('fid/user/policy-'.$lang.'.phtml')?>
 <? else: ?>
     <?=$this->render('fid/user/policy-en.phtml')?>
 <? endif; ?>
+<?php if ($this->layout()->getTemplate() == 'layout/lightbox'): ?>
+    <div class="form-group">
+        <a class="back-to-login btn btn-link" href="<?=$this->url('myresearch-account') ?>">
+            <i class="fa fa-chevron-left" aria-hidden="true"></i>
+            <?=$this->transEsc('Back')?>
+        </a>
+    </div>
+<? endif; ?>
 <!-- fid - policy end -->
diff --git a/themes/fid/templates/fid/user/terms-de.phtml b/themes/fid/templates/fid/user/terms-de.phtml
index 1959fb6dcda..be888e3c750 100644
--- a/themes/fid/templates/fid/user/terms-de.phtml
+++ b/themes/fid/templates/fid/user/terms-de.phtml
@@ -1,5 +1,4 @@
-<div class="adlr-policies">
-<br />
+<div class="fid-policies">
 <p><i>adlr.link</i>, der Fachinformationsdienst f&uuml;r Medien- und Kommunikationswissenschaften wird von der Universit&auml;tsbibliothek Leipzig betrieben und von der Deutschen Forschungsgemeinschaft (DFG) gef&ouml;rdert.</p>
 <p>Der Dienst richtet sich entsprechend den Förderrichtlinien der DFG vorrangig an WissenschaftlerInnen der Kommunikations-, Medien- und Filmwissenschaften sowie angrenzender Fachgebiete in Deutschland für den schnellen und direkten Zugriff auf Spezialliteratur und forschungsrelevante Informationen unabhängig vom Standort der Tätigkeit.</p>
 <p>Mit der Nutzung der Dienste von <i>adlr.link</i> erkl&auml;ren Sie sich mit den Nutzungsbedingungen und der Datenschutzerkl&auml;rung einverstanden.</p>
diff --git a/themes/fid/templates/fid/user/terms-en.phtml b/themes/fid/templates/fid/user/terms-en.phtml
index ad8f39a759b..4e707ed2509 100644
--- a/themes/fid/templates/fid/user/terms-en.phtml
+++ b/themes/fid/templates/fid/user/terms-en.phtml
@@ -1,5 +1,4 @@
-<div class="adlr-policies">
-<br />
+<div class="fid-policies">
 <p><i>adlr.link</i> is operated by Leipzig University Library and funded by the Deutsche Forschungsgemeinschaft (DFG).</p>
 <p>According to DFG funding guidelines, the service is primarily aimed at academics in the communication, media and film studies as well as related fields of study in Germany for immediate and direct access to specific literature and research-relevant information.</p>
 <p>By using the services of <i>adlr.link</i>, you agree to our terms of use and privacy policy. Please note: The English version of our terms of use is for informational purposes only. The German version shall be legally binding only.</p>
diff --git a/themes/fid/templates/fid/user/terms.phtml b/themes/fid/templates/fid/user/terms.phtml
index c51cba2bee2..25489e36528 100644
--- a/themes/fid/templates/fid/user/terms.phtml
+++ b/themes/fid/templates/fid/user/terms.phtml
@@ -1,9 +1,25 @@
 <!-- fid - terms begin -->
 <? $lang = $this->layout()->userLang; ?>
 <? $fileExists = file_exists(dirname(__FILE__) . '/terms-'.$lang.'.phtml'); ?>
+<?php if ($this->layout()->getTemplate() == 'layout/lightbox'): ?>
+    <div class="form-group">
+        <a class="back-to-login btn btn-link" href="<?=$this->url('myresearch-account') ?>">
+            <i class="fa fa-chevron-left" aria-hidden="true"></i>
+            <?=$this->transEsc('Back')?>
+        </a>
+    </div>
+<? endif; ?>
 <? if ($fileExists): ?>
     <?=$this->render('fid/user/terms-'.$lang.'.phtml')?>
 <? else: ?>
     <?=$this->render('fid/user/terms-en.phtml')?>
 <? endif; ?>
+<?php if ($this->layout()->getTemplate() == 'layout/lightbox'): ?>
+    <div class="form-group">
+        <a class="back-to-login btn btn-link" href="<?=$this->url('myresearch-account') ?>">
+            <i class="fa fa-chevron-left" aria-hidden="true"></i>
+            <?=$this->transEsc('Back')?>
+        </a>
+    </div>
+<? endif; ?>
 <!-- fid - terms end -->
-- 
GitLab