mirror of
https://github.com/ansible/awx.git
synced 2026-02-25 06:56:00 -03:30
Add display of multi-select options in survey preview
This commit is contained in:
@@ -665,6 +665,10 @@ angular.module('Utilities', ['RestServices', 'Utilities'])
|
|||||||
// Don't toggle the dropdown when a multiselect option is
|
// Don't toggle the dropdown when a multiselect option is
|
||||||
// being removed
|
// being removed
|
||||||
if (multiple) {
|
if (multiple) {
|
||||||
|
if (params.disabledOptions) {
|
||||||
|
$(element).on('select2:selecting', e => e.preventDefault());
|
||||||
|
}
|
||||||
|
|
||||||
$(element).on('select2:opening', (e) => {
|
$(element).on('select2:opening', (e) => {
|
||||||
var unselecting = $(e.target).data('select2-unselecting');
|
var unselecting = $(e.target).data('select2-unselecting');
|
||||||
if (unselecting === true) {
|
if (unselecting === true) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import {templateUrl} from '../../../shared/template-url/template-url.factory';
|
import {templateUrl} from '../../../shared/template-url/template-url.factory';
|
||||||
|
|
||||||
function link($timeout, CreateSelect2, scope, element, attrs, ngModel) {
|
function link($timeout, CreateSelect2, scope, element, attrs, ngModel) {
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
|
|
||||||
// select2-ify the dropdown. If the preview flag is passed here
|
// 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
|
// 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
|
// dropdown adapter is used to get the dropdown contents to show up in
|
||||||
// a modal.
|
// a modal.
|
||||||
|
|
||||||
CreateSelect2({
|
CreateSelect2({
|
||||||
element: element.find('select'),
|
element: element.find('select'),
|
||||||
multiple: scope.isMultipleSelect(),
|
multiple: scope.isMultipleSelect(),
|
||||||
customDropdownAdapter: scope.preview ? false : true
|
customDropdownAdapter: scope.preview ? false : true,
|
||||||
|
disabledOptions: true
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,7 @@
|
|||||||
choices="choices"
|
choices="choices"
|
||||||
ng-required="isRequired === 'true'"
|
ng-required="isRequired === 'true'"
|
||||||
ng-model="defaultValue"
|
ng-model="defaultValue"
|
||||||
ng-disabled="isDisabled === 'true'"
|
ng-disabled="isDisabled === 'false'">
|
||||||
preview="preview">
|
|
||||||
</multiple-choice>
|
</multiple-choice>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="question.type === 'password'" class="input_area input-group">
|
<div ng-if="question.type === 'password'" class="input_area input-group">
|
||||||
|
|||||||
Reference in New Issue
Block a user