Skip to content

Commit

Permalink
Fixed issue #18693: Using checkbox question for yes/no loses data whe…
Browse files Browse the repository at this point in the history
…n data entry view (#3109)

* Fixed issue #18693: Using checkbox question for yes/no loses data when data entry view

* Fixed issue #18693: Using checkbox question for yes/no loses data when data entry view

* Fixed issue #18693: Using checkbox question for yes/no loses data when data entry view

* Fixed issue #18693: Using checkbox question for yes/no loses data when data entry view

* Fixed issue #18693: Using checkbox question for yes/no loses data when data entry view

* Fixed issue #18693: Using checkbox question for yes/no loses data when data entry view

* Fixed issue #18693: Using checkbox question for yes/no loses data when data entry view

* Fixed issue #18693: Using checkbox question for yes/no loses data when data entry view

* Fixed issue #18693: Using checkbox question for yes/no loses data when data entry view

* Fixed issue #18693: Using checkbox question for yes/no loses data when data entry view

- Fix bug when last question has subquestions ( === false)
- Don't throw exception when Unseen is checked and a value is provided

---------

Co-authored-by: lapiudevgit <devgit@lapiu.biz>
  • Loading branch information
gabrieljenik and lapiudevgit committed Jun 13, 2023
1 parent 35ce00f commit aeb2f4d
Show file tree
Hide file tree
Showing 10 changed files with 886 additions and 482 deletions.
582 changes: 337 additions & 245 deletions application/controllers/admin/DataEntry.php

Large diffs are not rendered by default.

303 changes: 187 additions & 116 deletions assets/packages/adminbasics/build/adminbasics.css
Expand Up @@ -4357,6 +4357,77 @@ html[dir=rtl] th {
display: none;
}

/** Styles for Data Entry screen */
#responsedetail .checkbox input[type=checkbox] {
margin-left: 0;
}
#responsedetail .checkbox label {
padding-left: 0px;
}
#responsedetail .answer-item {
display: flex;
gap: 1em;
margin-bottom: 1em;
}
#responsedetail .checkbox.unseen-checkbox {
margin-top: 0;
min-width: 6em;
}
#responsedetail .checkbox:not(.unseen-checkbox) {
margin-top: 0;
}
#responsedetail tr.multiple-opt-comments input[type=text] {
width: 100%;
}
#responsedetail tr.multiple-opt-comments .checkbox {
margin-bottom: 0;
}
#responsedetail tr.multiple-opt-comments .answer-wrapper {
display: flex;
flex-wrap: wrap;
gap: 0.5em;
}
#responsedetail tr.array-5-pt .answer-wrapper,
#responsedetail tr.array-10-pt .answer-wrapper,
#responsedetail tr.array-yes-uncertain-no .answer-wrapper,
#responsedetail tr.array-increase-same-decrease .answer-wrapper,
#responsedetail tr.array-flexible-row .answer-wrapper,
#responsedetail tr.array-flexible-column .answer-wrapper,
#responsedetail tr.array-flexible-dual-scale .answer-wrapper {
display: flex;
gap: 1em;
}
#responsedetail tr.array-5-pt .answer-wrapper > span,
#responsedetail tr.array-10-pt .answer-wrapper > span,
#responsedetail tr.array-yes-uncertain-no .answer-wrapper > span,
#responsedetail tr.array-increase-same-decrease .answer-wrapper > span,
#responsedetail tr.array-flexible-row .answer-wrapper > span,
#responsedetail tr.array-flexible-column .answer-wrapper > span,
#responsedetail tr.array-flexible-dual-scale .answer-wrapper > span {
flex: 1;
}
#responsedetail tr.array-5-pt .answer-wrapper > span:first-of-type,
#responsedetail tr.array-10-pt .answer-wrapper > span:first-of-type,
#responsedetail tr.array-yes-uncertain-no .answer-wrapper > span:first-of-type,
#responsedetail tr.array-increase-same-decrease .answer-wrapper > span:first-of-type,
#responsedetail tr.array-flexible-row .answer-wrapper > span:first-of-type,
#responsedetail tr.array-flexible-column .answer-wrapper > span:first-of-type,
#responsedetail tr.array-flexible-dual-scale .answer-wrapper > span:first-of-type {
text-align: end;
}
#responsedetail tr.array-multi-flexi .answer-wrapper,
#responsedetail tr.array-multi-flexi-text .answer-wrapper {
display: flex;
gap: 1em;
}
#responsedetail tr.array-multi-flexi .answer-wrapper > span,
#responsedetail tr.array-multi-flexi-text .answer-wrapper > span {
flex: 1;
}
#responsedetail .answer-wrapper {
flex-grow: 1;
}

/** Make modals full width */
@media screen and (min-width: 768px) {
.dialog-fullwidth {
Expand All @@ -4365,6 +4436,113 @@ html[dir=rtl] th {
margin-right: 1rem;
}
}
.draggable-container {
min-height: 300px;
}

#newcreated,
#tokenattribute,
#csvattribute,
#centralattribute {
margin-left: 0.75%;
margin-right: 0.75%;
margin-bottom: 20px;
}

#tokenattribute {
margin-left: 1.5%;
}

#centralattribute {
margin-right: 1.5%;
}

#centralattribute .centralatt {
padding-bottom: 15px;
}

#newcreated .attribute-item input {
display: block;
margin: 2px auto;
width: 80%;
}

#centralattribute div.centralatt div.token-attribute {
margin-top: -5px;
min-height: 20px;
}

#newcreated,
#tokenattribute {
height: 100%;
}

.heading {
height: auto;
padding-top: 7px;
font-weight: bold;
}

div.mappable-attribute-wrapper {
width: 80%;
margin: 6px auto;
padding: 6px;
}

div.attribute-item, .already-mapped-attribute {
width: 80%;
margin: 6px auto;
padding: 4px;
text-align: center;
}

#centralattribute .explanation {
width: 90%;
margin: 0 auto;
text-align: left;
}

#centralattribute .explanation-row {
display: table-row;
}

#centralattribute .explanation input,
#centralattribute .explanation label {
display: table-cell;
padding-top: 4px;
padding-bottom: 4px;
}

#centralattribute .explanation label {
padding-left: 8px;
}

.attribute-item.draggable {
cursor: move;
}

div.mappable-attribute-wrapper.target-hover {
padding-bottom: 27px;
}

div.mappable-attribute-wrapper.paired.target-hover {
padding-bottom: 4px;
}

div.mappable-attribute-wrapper.paired.ui-state-disabled {
opacity: 1;
filter: alpha(opacity=100);
}

.draggable-container .attribute-column .ui-draggable-dragging {
z-index: 100;
}

/* Existing attribute column in CSV CPDB import */
.centralatt {
min-height: 100px;
}

.jcarousel-wrapper {
margin: 20px auto;
position: relative;
Expand Down Expand Up @@ -4486,111 +4664,20 @@ html[dir=rtl] th {
min-height: 100px;
}

.draggable-container {
min-height: 300px;
}

#newcreated,
#tokenattribute,
#csvattribute,
#centralattribute {
margin-left: 0.75%;
margin-right: 0.75%;
margin-bottom: 20px;
}

#tokenattribute {
margin-left: 1.5%;
}

#centralattribute {
margin-right: 1.5%;
}

#centralattribute .centralatt {
padding-bottom: 15px;
}

#newcreated .attribute-item input {
display: block;
margin: 2px auto;
width: 80%;
}

#centralattribute div.centralatt div.token-attribute {
margin-top: -5px;
min-height: 20px;
}

#newcreated,
#tokenattribute {
height: 100%;
}

.heading {
height: auto;
padding-top: 7px;
font-weight: bold;
}

div.mappable-attribute-wrapper {
width: 80%;
margin: 6px auto;
padding: 6px;
#responses-column-filter-modal .checkbox label {
vertical-align: text-bottom;
white-space: nowrap;
overflow-x: hidden;
}

div.attribute-item, .already-mapped-attribute {
width: 80%;
margin: 6px auto;
padding: 4px;
text-align: center;
.responses-multiselect-checkboxes {
overflow-y: scroll;
height: 60vh;
}

#centralattribute .explanation {
width: 90%;
margin: 0 auto;
.responses-column-filter-modal-checkbox-buttons {
text-align: left;
}

#centralattribute .explanation-row {
display: table-row;
}

#centralattribute .explanation input,
#centralattribute .explanation label {
display: table-cell;
padding-top: 4px;
padding-bottom: 4px;
}

#centralattribute .explanation label {
padding-left: 8px;
}

.attribute-item.draggable {
cursor: move;
}

div.mappable-attribute-wrapper.target-hover {
padding-bottom: 27px;
}

div.mappable-attribute-wrapper.paired.target-hover {
padding-bottom: 4px;
}

div.mappable-attribute-wrapper.paired.ui-state-disabled {
opacity: 1;
filter: alpha(opacity=100);
}

.draggable-container .attribute-column .ui-draggable-dragging {
z-index: 100;
}

/* Existing attribute column in CSV CPDB import */
.centralatt {
min-height: 100px;
padding-bottom: 15px;
}

#selectable .ui-selecting {
Expand Down Expand Up @@ -4657,22 +4744,6 @@ div.mappable-attribute-wrapper.paired.ui-state-disabled {
margin: 8px;
}

#responses-column-filter-modal .checkbox label {
vertical-align: text-bottom;
white-space: nowrap;
overflow-x: hidden;
}

.responses-multiselect-checkboxes {
overflow-y: scroll;
height: 60vh;
}

.responses-column-filter-modal-checkbox-buttons {
text-align: left;
padding-bottom: 15px;
}

.translate > table {
table-layout: fixed;
}
Expand Down
19 changes: 18 additions & 1 deletion assets/packages/adminbasics/build/adminbasics.js
Expand Up @@ -31073,6 +31073,13 @@
},
stopDisplayLoadingState = function stopDisplayLoadingState() {
LS.EventBus.$emit('loadingFinished'); // $('.lsLoadingStateIndicator').each((i,item) => {$(item).remove();});
},
bindInvalidFormHandler = function bindInvalidFormHandler($form) {
var $submittableElements = $form.find('button, input, select, textarea');
$submittableElements.off('invalid.save').on('invalid.save', function () {
stopDisplayLoadingState();
$submittableElements.off('invalid.save');
});
},
//###########PRIVATE
checks = function checks() {
Expand Down Expand Up @@ -31108,13 +31115,23 @@
}
} catch (e) {
console.ls.log('Seems no CKEDITOR4 is loaded');
} // If the form has the 'data-trigger-validation' attribute set, trigger the standard form
// validation and quit if it fails.


if ($form.attr('data-trigger-validation')) {
if (!$form[0].reportValidity()) {
return;
}
}

if ($form.data('isvuecomponent') == true) {
LS.EventBus.$emit('componentFormSubmit', button);
} else {
$form.find('[type="submit"]:not(.ck)').first().trigger('click');
// Attach handler to detect validation errors on the form and re-enable the button
bindInvalidFormHandler($form);
displayLoadingState(this);
$form.find('[type="submit"]:not(.ck)').first().trigger('click');
}
},
on: 'click'
Expand Down
2 changes: 1 addition & 1 deletion assets/packages/adminbasics/build/adminbasics.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/packages/adminbasics/build/adminbasics.min.js

Large diffs are not rendered by default.

0 comments on commit aeb2f4d

Please sign in to comment.