kopia lustrzana https://github.com/FacilMap/facilmap
Add the possibility to import views and types (#10)
rodzic
939973603b
commit
f7a20ec7a8
|
@ -24,16 +24,27 @@
|
||||||
<li ng-repeat="view in searchResults.views" class="list-group-item">
|
<li ng-repeat="view in searchResults.views" class="list-group-item">
|
||||||
<a href="javascript:" ng-click="showView(view)">{{view.name}}</a>
|
<a href="javascript:" ng-click="showView(view)">{{view.name}}</a>
|
||||||
<span class="result-type">(View)</span>
|
<span class="result-type">(View)</span>
|
||||||
|
<a href="javascript:" ng-if="!viewExists(view)" ng-click="addView(view)" class="pull-right" uib-tooltip="Add this view to the map" tooltip-append-to-body="true"><span class="glyphicon glyphicon-plus"></span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<h3 ng-if="searchResults.views.length > 0">Markers/Lines</h3>
|
<h3 ng-if="searchResults.views.length > 0 || (searchResults.types | fmPropertyCount) > 0">Markers/Lines</h3>
|
||||||
<ul class="list-group" ng-if="searchResults.features.length > 0">
|
<ul class="list-group" ng-if="searchResults.features.length > 0">
|
||||||
<li ng-repeat="result in searchResults.features" class="list-group-item" ng-class="{active: activeResult === result}">
|
<li ng-repeat="result in searchResults.features" class="list-group-item" ng-class="{active: activeResult === result}">
|
||||||
<a href="javascript:" ng-click="showResult(result)">{{result.display_name}}</a>
|
<a href="javascript:" ng-click="showResult(result)">{{result.display_name}}</a>
|
||||||
<span class="result-type" ng-if="result.type">({{result.type}})</span>
|
<span class="result-type" ng-if="result.type">({{result.type}})</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div ng-if="(searchResults.types | fmPropertyCount) > 0">
|
||||||
|
<h3>Types</h3>
|
||||||
|
<ul class="list-group">
|
||||||
|
<li ng-repeat="type in searchResults.types" class="list-group-item">
|
||||||
|
{{type.name}}
|
||||||
|
<span class="result-type">(Type)</span>
|
||||||
|
<a href="javascript:" ng-if="!typeExists(type)" ng-click="addType(type)" class="pull-right" uib-tooltip="Add this type to the map" tooltip-append-to-body="true"><span class="glyphicon glyphicon-plus"></span></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="fm-search-buttons" ng-show="searchResults.features.length > 0">
|
<div class="fm-search-buttons" ng-show="searchResults.features.length > 0">
|
||||||
|
|
|
@ -130,6 +130,30 @@ fm.app.factory("fmMapSearch", function($rootScope, $compile, fmUtils, $timeout,
|
||||||
map.displayView(view);
|
map.displayView(view);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
scope.viewExists = function(view) {
|
||||||
|
for(let viewId in map.socket.views) {
|
||||||
|
if(["name", "baseLayer", "layers", "top", "bottom", "left", "right", "filter"].filter((idx) => !ng.equals(view[idx], map.socket.views[viewId][idx])).length == 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
scope.addView = function(view) {
|
||||||
|
map.socket.addView(view);
|
||||||
|
};
|
||||||
|
|
||||||
|
scope.typeExists = function(type) {
|
||||||
|
for(let typeId in map.socket.types) {
|
||||||
|
if(["name", "type", "defaultColour", "colourFixed", "defaultSize", "sizeFixed", "defaultSymbol", "symbolFixed", "defaultWidth", "widthFixed", "defaultMode", "modeFixed", "fields"].filter((idx) => !ng.equals(type[idx], map.socket.types[typeId][idx])).length == 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
scope.addType = function(type) {
|
||||||
|
map.socket.addType(type);
|
||||||
|
};
|
||||||
|
|
||||||
scope.addResultToMap = function(result, type, noEdit) {
|
scope.addResultToMap = function(result, type, noEdit) {
|
||||||
importUi.addResultToMap(result, type, !noEdit);
|
importUi.addResultToMap(result, type, !noEdit);
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue