Skip to content

Commit

Permalink
#342 usability
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberroland committed Nov 15, 2024
1 parent 37bb3af commit fd665fe
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lam/HISTORY
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
December 2024 9.0
- Unix users: allow to create group with same name via account profile (#332)
- Group of (unique) names, organisational roles: added member/owner count to PDF fields
- Usability improvements (350)
- Usability improvements (342, 350)
- LAM Pro:
-> Request access: added comment field for owners/approvers (339)
-> Custom scripts: support custom label for module (329)
Expand Down
19 changes: 9 additions & 10 deletions lam/lib/modules.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ class accountContainer {
}
}
echo '<div id="passwordMessageArea"></div>';
echo "<table border=0 width=\"100%\" style=\"border-collapse: collapse;\">\n";
echo "<table class=\"lam-account-edit-table\">\n";
echo "<tr><td style=\"padding: 5px 0px 0px 0px;\">\n";
$this->printCommonControls();
echo "</td></tr>\n";
Expand Down Expand Up @@ -1415,16 +1415,15 @@ class accountContainer {
$accountProfilePersistenceManager = new AccountProfilePersistenceManager();
$profilelist = $accountProfilePersistenceManager->getAccountProfileNames($this->type->getId(), $_SESSION['config']->getName());
if (sizeof($profilelist) > 0) {
$profilesSelect = new htmlSelect('accountContainerSelectLoadProfile', $profilelist, [$this->lastLoadedProfile]);
$profilesSelect->setCSSClasses(['auto-width']);
$profilesSelect->setAccessibilityLabel(_('Profile name'));
$rightGroup->addElement($profilesSelect);
$profileButton = new htmlButton('accountContainerLoadProfile', _('Load profile'));
if (!$this->isNewAccount) {
$profileButton->setType('submit');
$profileButton->setOnClick('confirmLoadProfile(\'' . _('This may overwrite existing values with profile data. Continue?') . '\','
. ' \'' . _('Ok') . '\', \'' . _('Cancel') . '\', event);');
$profileButton = new htmlButton('accountContainerLoadProfileButton', _('Load profile'));
$profileButton->setOnClick('confirmLoadProfile(\'' . _('Load profile') . '\', \'' . _('This may overwrite existing values with profile data. Continue?') . '\','
. ' \'' . _('Ok') . '\', \'' . _('Cancel') . '\', event); return false;');
$profileButton->addDataAttribute('lastprofile', $this->lastLoadedProfile);
$profileListOptions = [];
foreach ($profilelist as $profileName) {
$profileListOptions[$profileName] = $profileName;
}
$profileButton->addDataAttribute('profiles', json_encode($profileListOptions));
$rightGroup->addElement($profileButton);
$rightGroup->addElement(new htmlSpacer('1px', null));
$rightGroup->addElement(new htmlHelpLink('401'));
Expand Down
12 changes: 12 additions & 0 deletions lam/style/100_lam-responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ div.account-types-popup div.columns:last-child {
float: left;
}

table.lam-account-edit-table {
border-collapse: collapse;
width: 100%;
border-width: 0;
margin-right: auto;
margin-left: auto;
}

/* mobile */
@media only screen and (max-width: 40.0625em) {

Expand Down Expand Up @@ -422,6 +430,10 @@ div.account-types-popup div.columns:last-child {
padding-bottom: 2rem;
}

table.lam-account-edit-table {
max-width: 90rem;
}

}

/* desktop */
Expand Down
6 changes: 5 additions & 1 deletion lam/style/500_layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ button.lam-account-type img {

div.lam-vertical-tab-content {
border-width: 0;
padding: 0em 1em 1em 1em;
padding: 1rem 2rem 1rem 1rem;
float: left;
}

Expand Down Expand Up @@ -985,6 +985,10 @@ div.swal2-html-container {
overflow: auto;
}

#swal2-select {
width: unset;
}

.modal {
position: fixed;
left: 0;
Expand Down
38 changes: 25 additions & 13 deletions lam/templates/lib/500_lam.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,28 +284,40 @@ function appendDialogInputsToFormAndSubmit(dialogDiv, formName) {
* Shows a simple confirmation dialog.
* If the user presses Cancel then the current action is stopped (event.preventDefault()).
*
* @param title dialog title
* @param text dialog text
* @param okText text for OK button
* @param cancelText text for cancel button
* @param e event
*/
function confirmLoadProfile(text, okText, cancelText, e) {
Swal.fire({
async function confirmLoadProfile(title, text, okText, cancelText, e) {
const button = document.getElementById('btn_accountContainerLoadProfileButton');
const lastProfile = button.dataset.lastprofile;
const profiles = JSON.parse(button.dataset.profiles);
const {value: selectedProfile} = await Swal.fire({
confirmButtonText: okText,
cancelButtonText: cancelText,
showCancelButton: true,
title: title,
text: text,
}).then(result => {
if (result.isConfirmed) {
const form = document.forms["inputForm"];
let buttonValue = document.createElement("input");
buttonValue.type = "hidden";
buttonValue.name = "accountContainerLoadProfile";
buttonValue.value = "yes";
form.appendChild(buttonValue);
form.submit();
}
});
input: 'select',
inputValue: lastProfile,
inputOptions: profiles
});
if (selectedProfile) {
const form = document.forms["inputForm"];
let buttonValue = document.createElement("input");
buttonValue.type = "hidden";
buttonValue.name = "accountContainerLoadProfile";
buttonValue.value = "yes";
form.appendChild(buttonValue);
let selectValue = document.createElement('input');
selectValue.type = 'hidden';
selectValue.name = 'accountContainerSelectLoadProfile';
selectValue.value = selectedProfile;
form.appendChild(selectValue);
form.submit();
};
if (e.preventDefault) {
e.preventDefault();
}
Expand Down

0 comments on commit fd665fe

Please sign in to comment.