Add "interactive" URL param

pull/108/head
Candid Dauth 2017-12-23 15:19:39 +01:00
rodzic c805d54e51
commit b62c61694e
5 zmienionych plików z 13 dodań i 6 usunięć

Wyświetl plik

@ -19,6 +19,7 @@ You can control the display of different components by using the following query
* `search`: Show the search bar (default: `true`) * `search`: Show the search bar (default: `true`)
* `autofocus`: Autofocus the search field (default: `false`) * `autofocus`: Autofocus the search field (default: `false`)
* `legend`: Show the legend if available (default: `true`) * `legend`: Show the legend if available (default: `true`)
* `interactive`: Show certain items (“Create collaborative map”, “Open file”) in the toolbox (default: `false`)
Example: Example:
@ -103,7 +104,7 @@ of components by adding them to the element:
```html ```html
<facilmap fm-server-url="https://facilmap.org/" fm-map-id="mymap"> <facilmap fm-server-url="https://facilmap.org/" fm-map-id="mymap">
<fm-toolbox></fm-toolbox> <fm-toolbox interactive="true"></fm-toolbox>
<fm-search autofocus="true"></fm-search> <fm-search autofocus="true"></fm-search>
<fm-legend></fm-legend> <fm-legend></fm-legend>
</facilmap> </facilmap>

Wyświetl plik

@ -3,7 +3,7 @@
<nav class="navbar navbar-default" ng-class="{'hidden-xs': !showXs}"> <nav class="navbar navbar-default" ng-class="{'hidden-xs': !showXs}">
<div class="container-fluid fm-toolbox-content"> <div class="container-fluid fm-toolbox-content">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li role="presentation" ng-if="!client.padId"> <li role="presentation" ng-if="!client.padId && interactive">
<a href="javascript:" ng-click="startPad()">Start collaborative map</a> <a href="javascript:" ng-click="startPad()">Start collaborative map</a>
</li> </li>
<li role="presentation" uib-dropdown keyboard-nav="true" ng-if="!client.readonly && client.padId"> <li role="presentation" uib-dropdown keyboard-nav="true" ng-if="!client.readonly && client.padId">
@ -42,7 +42,7 @@
<a href="javascript:" id="toolbox-tools-dropdown" uib-dropdown-toggle role="button">Tools <span class="caret"></span></a> <a href="javascript:" id="toolbox-tools-dropdown" uib-dropdown-toggle role="button">Tools <span class="caret"></span></a>
<ul uib-dropdown-menu aria-labelledby="toolbox-layers-dropdown" class="dropdown-menu-right"> <ul uib-dropdown-menu aria-labelledby="toolbox-layers-dropdown" class="dropdown-menu-right">
<!--<li ng-if="!client.readonly"><a href="javascript:" ng-click="openDialog('copy-pad-dialog')">Copy pad</a></li>--> <!--<li ng-if="!client.readonly"><a href="javascript:" ng-click="openDialog('copy-pad-dialog')">Copy pad</a></li>-->
<li ng-if="hasImportUi"><a href="javascript:" ng-click="importFile()">Open file</a></li> <li ng-if="hasImportUi && interactive"><a href="javascript:" ng-click="importFile()">Open file</a></li>
<li ng-if="client.padId"><a href="{{client.padData.id}}/geojson" uib-tooltip="GeoJSON files store all map information and can thus be used for map backups and be re-imported without any loss." tooltip-placement="left">Export as GeoJSON</a></li> <li ng-if="client.padId"><a href="{{client.padData.id}}/geojson" uib-tooltip="GeoJSON files store all map information and can thus be used for map backups and be re-imported without any loss." tooltip-placement="left">Export as GeoJSON</a></li>
<li ng-if="client.padId"><a href="{{client.padData.id}}/gpx?useTracks=1" uib-tooltip="GPX files can be opened with most navigation software. In track mode, any calculated routes are saved in the file." tooltip-placement="left">Export as GPX (tracks)</a></li> <li ng-if="client.padId"><a href="{{client.padData.id}}/gpx?useTracks=1" uib-tooltip="GPX files can be opened with most navigation software. In track mode, any calculated routes are saved in the file." tooltip-placement="left">Export as GPX (tracks)</a></li>
<li ng-if="client.padId"><a href="{{client.padData.id}}/gpx?useTracks=0" uib-tooltip="GPX files can be opened with most navigation software. In route mode, only the start/end/via points are saved in the file, and the navigation software needs to recalculate the routes." tooltip-placement="left">Export as GPX (routes)</a></li> <li ng-if="client.padId"><a href="{{client.padData.id}}/gpx?useTracks=0" uib-tooltip="GPX files can be opened with most navigation software. In route mode, only the start/end/via points are saved in the file, and the navigation software needs to recalculate the routes." tooltip-placement="left">Export as GPX (routes)</a></li>

Wyświetl plik

@ -7,8 +7,13 @@ fm.app.directive("fmToolbox", function($compile, fmFilter, fmAbout) {
require: "^facilmap", require: "^facilmap",
template: require("./toolbox.html"), template: require("./toolbox.html"),
replace: true, replace: true,
scope: {}, scope: {
interactive: "<interactive"
},
link: function(scope, element, attrs, map) { link: function(scope, element, attrs, map) {
if(scope.interactive == null)
scope.interactive = true;
scope.client = map.client; scope.client = map.client;
scope.links = {}; scope.links = {};

Wyświetl plik

@ -32,7 +32,7 @@
<noscript><p><strong>FacilMap requires JavaScript to work.</strong></p></noscript> <noscript><p><strong>FacilMap requires JavaScript to work.</strong></p></noscript>
<div id="loading" ng-if="false">Loading...</div> <div id="loading" ng-if="false">Loading...</div>
<facilmap id="map" fm-server-url="/" fm-map-id="{{padId}}" fm-hash> <facilmap id="map" fm-server-url="/" fm-map-id="{{padId}}" fm-hash>
<fm-toolbox ng-if="toolbox"></fm-toolbox> <fm-toolbox ng-if="toolbox" interactive="interactive"></fm-toolbox>
<fm-search ng-if="search" autofocus="autofocus"></fm-search> <fm-search ng-if="search" autofocus="autofocus"></fm-search>
<fm-legend ng-if="legend"></fm-legend> <fm-legend ng-if="legend"></fm-legend>
</facilmap> </facilmap>

Wyświetl plik

@ -11,7 +11,8 @@ fm.app.controller("PadCtrl", function($scope, $timeout, $element, fmUtils) {
toolbox: toBoolean(queryParams.toolbox, true), toolbox: toBoolean(queryParams.toolbox, true),
search: toBoolean(queryParams.search, true), search: toBoolean(queryParams.search, true),
autofocus: toBoolean(queryParams.autofocus, parent === window), autofocus: toBoolean(queryParams.autofocus, parent === window),
legend: toBoolean(queryParams.legend, true) legend: toBoolean(queryParams.legend, true),
interactive: toBoolean(queryParams.interactive, parent === window)
}); });
if(!location.hash || location.hash == "#") { if(!location.hash || location.hash == "#") {