</div>
<div class="input-group-addon"><b>[% l('Working location') %]</b></div>
<div class="input-group-addon">
- <eg-org-selector sticky-setting="eg.org.offline_location" selected="org"></eg-org-selector>
+ <eg-org-selector sticky-setting="eg.org.offline_location" selected="org"
+ alphabetized-orgs="true"></eg-org-selector>
</div>
<div class="input-group-addon">
<button
// optional name of settings key for persisting
// the last selected org unit
- stickySetting : '@'
+ stickySetting : '@',
+
+ // if set to true, remove indenting and alphabetize org list
+ alphabetizedOrgs : '@'
},
templateUrl : './share/t_org_select',
var secretEmptyKey = '_INTERNAL_';
function formatName(org) {
- return " ".repeat(org.ou_type().depth()) + org.shortname();
+ if ($scope.alphabetizedOrgs == "true") {
+ return " " + org.shortname();
+ } else {
+ return " ".repeat(org.ou_type().depth()) + org.shortname();
+ }
}
// avoid linking the full fleshed tree to the scope by
}
).then(
function() {
-
$scope.selecteName = '';
-
$scope.shortNames = egCore.org.list()
.filter(function(org) {
return !(
}).map(function(org) {
return formatName(org);
});
-
+ if ($scope.alphabetizedOrgs == "true" && $scope.shortNames) {
+ $scope.shortNames.sort(function(a, b){
+ if(a < b) { return -1; }
+ if(a > b) { return 1; }
+ return 0;
+ })
+ }
+
// Apply default values
if ($scope.stickySetting) {