Skip to content

Commit 30859cd

Browse files
committed
chore(build)
1 parent 9ab7329 commit 30859cd

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ Phantom*/**/*
2525

2626
tscArguments
2727
test_out/*
28-
PhantomJS_1.9.8_(Linux_0.0.0)/test_out/unit.xml
29-
PhantomJS_1.9.8_(Mac_OS_X_0.0.0)/test_out/unit.xml
28+
**/test_out
3029

3130
lib-cov
3231
*.seed

dist/forms-angular.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,8 @@ var fng;
624624
var allInputsVars = formMarkupHelper.allInputsVars(scope, fieldInfo, options, modelString, idString, nameString);
625625
var common = allInputsVars.common;
626626
var value;
627-
var requiredStr = (isRequired || fieldInfo.required) ? ' required' : '';
627+
isRequired = isRequired || fieldInfo.required;
628+
var requiredStr = isRequired ? ' required' : '';
628629
var enumInstruction;
629630
switch (fieldInfo.type) {
630631
case 'select':
@@ -635,7 +636,14 @@ var fng;
635636
common += (fieldInfo.readonly ? 'disabled ' : '');
636637
common += fieldInfo.add ? (' ' + fieldInfo.add + ' ') : '';
637638
value = '<select ' + common + 'class="' + allInputsVars.formControl.trim() + allInputsVars.compactClass + allInputsVars.sizeClassBS2 + '" ' + requiredStr + '>';
638-
if (!isRequired) {
639+
if (isRequired) {
640+
/*
641+
Tell the user to select a value
642+
This becomes disabled in updateRecordWithLookupValues (setting disabled now causes $pristine to be unset, which conflicts with the condition in updateRecordWithLookupValues)
643+
*/
644+
value += '<option class="disableMe" value="">Select a value</option>';
645+
}
646+
else {
639647
value += '<option></option>';
640648
}
641649
if (angular.isArray(fieldInfo.options)) {
@@ -2709,6 +2717,9 @@ var fng;
27092717
if (newVal) {
27102718
setData($scope.record, schemaElement.name, undefined, newVal);
27112719
}
2720+
if (schemaElement.required) {
2721+
angular.element('#' + schemaElement.id + ' .disableMe').prop('disabled', true);
2722+
}
27122723
}
27132724
};
27142725
// Split a field name into the next level and all following levels
@@ -2781,11 +2792,14 @@ var fng;
27812792
}
27822793
var simpleArrayNeedsX = function (aSchema) {
27832794
var result = false;
2784-
if (!aSchema.directive) {
2795+
if (aSchema.needsX) {
2796+
result = true;
2797+
}
2798+
else if (!aSchema.directive) {
27852799
if (aSchema.type === 'text') {
27862800
result = true;
27872801
}
2788-
else if (aSchema.needsX || ((aSchema.type === 'select') && !aSchema.ids)) {
2802+
else if (aSchema.type === 'select' && !aSchema.ids) {
27892803
result = true;
27902804
}
27912805
}

0 commit comments

Comments
 (0)