Add display of multi-select options in survey preview

This commit is contained in:
gconsidine 2017-03-30 17:15:16 -04:00
parent 5f5a91a72c
commit 89c01475f5
3 changed files with 8 additions and 5 deletions

View File

@ -665,6 +665,10 @@ angular.module('Utilities', ['RestServices', 'Utilities'])
// Don't toggle the dropdown when a multiselect option is
// being removed
if (multiple) {
if (params.disabledOptions) {
$(element).on('select2:selecting', e => e.preventDefault());
}
$(element).on('select2:opening', (e) => {
var unselecting = $(e.target).data('select2-unselecting');
if (unselecting === true) {

View File

@ -2,7 +2,6 @@
import {templateUrl} from '../../../shared/template-url/template-url.factory';
function link($timeout, CreateSelect2, scope, element, attrs, ngModel) {
$timeout(function() {
// select2-ify the dropdown. If the preview flag is passed here
@ -13,12 +12,13 @@ function link($timeout, CreateSelect2, scope, element, attrs, ngModel) {
// and we don't actually need the dropdown portion. Note that the custom
// dropdown adapter is used to get the dropdown contents to show up in
// a modal.
CreateSelect2({
element: element.find('select'),
multiple: scope.isMultipleSelect(),
customDropdownAdapter: scope.preview ? false : true
customDropdownAdapter: scope.preview ? false : true,
disabledOptions: true
});
});
}

View File

@ -11,8 +11,7 @@
choices="choices"
ng-required="isRequired === 'true'"
ng-model="defaultValue"
ng-disabled="isDisabled === 'true'"
preview="preview">
ng-disabled="isDisabled === 'false'">
</multiple-choice>
</div>
<div ng-if="question.type === 'password'" class="input_area input-group">