Handle special characters in build or comparison name. Closes #101

This commit is contained in:
Colin McLeod
2015-10-06 19:56:08 -07:00
parent 9ee12e4167
commit a49f7ec594
2 changed files with 13 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ angular.module('app').directive('shipyardHeader', ['lodash', '$window', '$rootSc
scope.ships = ships;
scope.allBuilds = Persist.builds;
scope.buildsList = Object.keys(scope.allBuilds).sort();
scope.allComparisons = Persist.comparisons;
scope.allComparisons = Object.keys(Persist.comparisons).sort();
scope.bs = Persist.state;
var win = angular.element($window); // Angularized window object for event triggering
@@ -57,6 +57,10 @@ angular.module('app').directive('shipyardHeader', ['lodash', '$window', '$rootSc
});
};
scope.cleanedBuildList = function(shipId) {
return Object.keys(scope.allBuilds[shipId]);
};
scope.openMenu = function(e, menu) {
e.stopPropagation();
if (menu == scope.openedMenu) {
@@ -68,6 +72,11 @@ angular.module('app').directive('shipyardHeader', ['lodash', '$window', '$rootSc
scope.openedMenu = null;
return;
}
if (menu == 'comp') {
scope.allComparisons = Object.keys(Persist.comparisons).sort();
}
scope.openedMenu = menu;
};

View File

@@ -22,8 +22,8 @@
<div class="dbl" >
<div><ul ng-repeat="shipId in buildsList">
{{ships[shipId].properties.name}}
<li ng-repeat="(name, build) in allBuilds[shipId]">
<a ui-sref-active="active" class="name" ui-sref="outfit({shipId:shipId, code:build, bn:name})" ng-bind="name"></a>
<li ng-repeat="(i, name) in cleanedBuildList(shipId)">
<a ui-sref-active="active" class="name" ui-sref="outfit({shipId:shipId, code:allBuilds[shipId][name], bn:name})" ng-bind="name"></a>
</li>
</ul></div>
</div>
@@ -36,7 +36,7 @@
</div>
<div class="menu-list" ng-if="openedMenu=='comp'" ng-click="$event.stopPropagation();" style="white-space: nowrap;">
<span class="cap" ng-if="!bs.hasComparisons" translate="none created"></span>
<a ng-repeat="(name, comp) in allComparisons" ui-sref-active="active" class="block name" ui-sref="compare({name:name})" ng-bind="name"></a>
<a ng-repeat="(i, name) in allComparisons" ui-sref-active="active" class="block name" ui-sref="compare({name:name})" ng-bind="name"></a>
<hr />
<a ui-sref="compare({name: 'all'})" class="block cap" translate="compare all"></a>
<a ui-sref="compare({name: null})" class="block cap" translate="create new"></a>