-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close GH-235: fix bool attr bugs [#111443058 Delivers].
- Loading branch information
1 parent
50db28f
commit 253047a
Showing
3 changed files
with
31 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,36 @@ | ||
angular.module("designModule") | ||
/** | ||
* Directive used for automatic attribute editor creation | ||
*/ | ||
.directive("guiBoolean", ["$designService", function ($designService) { | ||
return { | ||
restrict: "E", | ||
templateUrl: $designService.getTemplate("design/gui/editor/select.html"), | ||
|
||
scope: { | ||
"attribute": "=editorScope", | ||
"item": "=item" | ||
}, | ||
.directive("guiBoolean", ["$designService", function($designService) { | ||
return { | ||
restrict: "E", | ||
templateUrl: $designService.getTemplate("design/gui/editor/select.html"), | ||
|
||
controller: function ($scope) { | ||
scope: { | ||
"attribute": "=editorScope", | ||
"item": "=item" | ||
}, | ||
|
||
var init; | ||
controller: function($scope) { | ||
$scope.options = [{ | ||
Id: false, | ||
Name: "false" | ||
}, { | ||
Id: true, | ||
Name: "true" | ||
}]; | ||
|
||
init = function () { | ||
if (typeof $scope.attribute === "undefined" || | ||
typeof $scope.item === "undefined") { | ||
return false; | ||
} | ||
$scope.$watch("item", init); | ||
$scope.$watch("attribute", init); | ||
|
||
if (typeof $scope.item[$scope.attribute.Attribute] === "boolean") { | ||
$scope.options = [ | ||
{ | ||
Desc: "", | ||
Extra: null, | ||
Id: false, | ||
Image: "", | ||
Name: "false" | ||
}, | ||
{ | ||
Desc: "", | ||
Extra: null, | ||
Id: true, | ||
Image: "", | ||
Name: "true" | ||
} | ||
]; | ||
} else { | ||
$scope.options = [ | ||
{ | ||
Desc: "", | ||
Extra: null, | ||
Id: "false", | ||
Image: "", | ||
Name: "false" | ||
}, | ||
{ | ||
Desc: "", | ||
Extra: null, | ||
Id: "true", | ||
Image: "", | ||
Name: "true" | ||
} | ||
]; | ||
} | ||
}; | ||
|
||
$scope.$watch("item", init); | ||
$scope.$watch("attribute", init); | ||
function init() { | ||
if (typeof $scope.attribute === "undefined" || | ||
typeof $scope.item === "undefined" | ||
) { | ||
return false; | ||
} | ||
}; | ||
}]); | ||
} | ||
|
||
} | ||
}; | ||
}]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters