fix focus for inplace ui.select when no options present

pull/2618/head
Mihail Maxacov 10 years ago
parent e4b086829e
commit bb3d93c886
  1. 22
      frontend/app/ui_components/inplace-editor-dispatcher.js

@ -73,16 +73,10 @@ module.exports = function($sce, $http, $timeout, AutoCompleteHelper, TextileServ
} }
function setOptions($scope) { function setOptions($scope) {
if ($scope.attribute == 'version.name') { if ($scope.embedded) {
$scope.hasEmptyOption = true; $scope.$broadcast('focusSelect2');
}
var href = $scope
.entity.form.embedded.schema
.props[getAttribute($scope)]._links.allowedValues.href;
if (href) {
setLinkedOptions($scope);
} else { } else {
setEmbeddedOptions($scope) setLinkedOptions($scope);
} }
} }
@ -102,7 +96,9 @@ module.exports = function($sce, $http, $timeout, AutoCompleteHelper, TextileServ
} else { } else {
$scope.options = options; $scope.options = options;
} }
$scope.$broadcast('focusSelect2'); } else {
$scope.isEditing = false;
$scope.isEditable = false;
} }
} }
@ -213,11 +209,13 @@ module.exports = function($sce, $http, $timeout, AutoCompleteHelper, TextileServ
data._links[getAttribute($scope)] = { href: $scope.dataObject.value || null }; data._links[getAttribute($scope)] = { href: $scope.dataObject.value || null };
}, },
setReadValue: function($scope) { setReadValue: function($scope) {
if ($scope.attribute == 'version.name') {
$scope.hasEmptyOption = true;
}
if ($scope.embedded) { if ($scope.embedded) {
$scope.isUserLink = false;
$scope.readValue = getReadAttributeValue($scope); $scope.readValue = getReadAttributeValue($scope);
setEmbeddedOptions($scope);
} else { } else {
$scope.isUserLink = !!$scope.entity.embedded[$scope.attribute];
$scope.readValue = $scope.entity.embedded[$scope.attribute]; $scope.readValue = $scope.entity.embedded[$scope.attribute];
} }
}, },

Loading…
Cancel
Save