3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00
Commit graph

1753 commits

Author SHA1 Message Date
Michael Stenta 434b473e14 Move toolbar-toggle map resize event listener JS to farm_ui_theme. 2021-09-06 11:00:51 -04:00
Michael Stenta 99eb69434a Install Gin via farm_ui_theme_install() instead of config/install. 2021-09-06 11:00:51 -04:00
Michael Stenta 453063f64b Install all blocks to Claro theme by default. 2021-09-06 11:00:51 -04:00
Michael Stenta e4c35aca19 Set $defaultTheme to stark in all WebDrivcerTestBase tests. 2021-09-06 11:00:51 -04:00
Michael Stenta b49441efe4 Set $defaultTheme to stark for all descendants of FarmBrowserTestBase. 2021-09-06 10:46:20 -04:00
Michael Stenta 118b448170 Decouple FarmMap render element and JS instantiation #436 2021-09-06 07:04:33 -04:00
Symbioquine c92fe90985 Refactor most of farm_map.js into factory method #436
**Why?** Allow JS in contrib modules to take advantage of
now decoupled map instantiation code to create canonically
extensible/styled maps where the life-cycle of those maps
is controlled by the contrib module JS code.

For example, a contrib module's controller can return;

```php
return [
  'map-prototype' => [
    '#type' => 'farm_map',
    '#attributes' => [
        'id' => 'example-tool-map-prototype',
        'data-map-instantiator' => 'example-tool',
    ],
  ],
];
```

Then create map instances from custom JS like this;

```js
const mapPrototypeElement = document.getElementById('example-tool-map-prototype');

const mapElement = mapPrototypeElement.cloneNode();
mapElement.removeAttribute('id');

myParentContainer.appendChild(mapElement);

const mapInstance = Drupal.behaviors.farm_map.createMapInstance(mapElement, mapElement, 'example-tool-map-prototype', {});
```
2021-09-03 15:20:26 -04:00
Symbioquine 6ce9ec2480 Reduce coupling between map element id and other logic #436
**Why?** There were a bunch of places where farmOS implicitly depends
on the id of the map element to look up settings and access the map
element after the map is instantiated.

This change makes it so there is only one place in the JS that depends
on the map id to dereference the drupalSettings and assign them under
`instance.farmMapSettings` so behaviors can access them.
2021-09-03 15:20:26 -04:00
Symbioquine 9c94dab9db Decouple FarmMap render element styling and JS instantiation #436
**Why?** It should be possible to leverage the farm_map
module's extension mechanism and default styling without
necessarily giving it full control over when the map
instance gets created.

Currently, the FarmMap render element uses the 'farm-map'
CSS class to inform the JS code in `farm_map.js` that it should
instantiate the map. This is problematic since that CSS class
is also used for styling and there's a bunch of code in the
FarmMap render element and in `farm_map.js` which should
be common to pretty much all farmOS maps.

To fix that, this change introduces a new [data attribute] which
is used instead of the CSS class to signal the JS code in `farm_map.js`
that it should actually instantiate the map.

[data attribute]: https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
2021-09-03 15:20:26 -04:00
Michael Stenta 8f9123b975 Set popup behavior weight to -100.
...so that behaviors that use instance.popup.on()
(including asset_type_layers) don't need to worry
about setting their weight heavier.
2021-09-03 15:19:03 -04:00
Michael Stenta fcf32771bd Only show popups for features that have a name.
This fixes the annoying issue where a mostly-blank popup
appears while drawing shapes in Geofield widget.
2021-09-03 15:16:33 -04:00
Michael Stenta 475610fa0d Remove test-runner and Disable XDebug with XDEBUG_MODE: off #441 2021-09-03 12:59:10 -04:00
Michael Stenta 2bc77bb4b2 Remove test-runner service. 2021-09-02 14:44:51 -04:00
Michael Stenta 36fb1809fc Run tests in www service instead of test-runner. 2021-09-02 14:44:26 -04:00
Michael Stenta e8702df7ac Disable XDebug in testing services. 2021-09-02 14:30:19 -04:00
Michael Stenta 37d10f738a Add @see link to Issue #3230970: Generalize KML importer to create any asset type 2021-09-01 23:21:37 -04:00
Michael Stenta 6128fa1ae1 Merge branch '2.x-geofield-import-files' into 2.x 2021-09-01 23:07:18 -04:00
paul121 70ad63479d Allow geojson and gpx file extensions. 2021-09-01 22:47:08 -04:00
Michael Stenta 71db605a98 Merge geometries from multiple uploaded files together. 2021-09-01 22:47:08 -04:00
Michael Stenta 2b7408e87c Support KMZ files in GeofieldWidget "Import geometry from uploaded files". 2021-09-01 22:47:08 -04:00
Michael Stenta a01cc1a930 Change "Find using files field" to "Import geometry from uploaded files". 2021-09-01 22:47:08 -04:00
Michael Stenta e2a1c112e4 Ensure field wrapper DOM ID is unique with Html::getUniqueId(). 2021-09-01 22:47:08 -04:00
paul121 edc107d74a Add warning messages. 2021-09-01 22:47:08 -04:00
paul121 c123e3d2b4 Disable the find using files field button until a file is uploaded. 2021-09-01 22:47:08 -04:00
paul121 299ff56ee0 Allow log and asset geometry to be populated from the file field. 2021-09-01 22:47:08 -04:00
paul121 ca13997d69 Add setting to farm_map_geofield field widget to support populating geometry from a form file field. 2021-09-01 22:47:08 -04:00
Michael Stenta 261e957b1b Do not reduce geometries after they have been combined with combineWkt().
Reducing changes a GeometryCollection of Polygons into a
MultiPolygon, which is not our intention in most cases.
If code needs a reduced geometry it can call the reduceWkt()
method intentionally.
2021-09-01 22:46:37 -04:00
Michael Stenta 41d3eac174 Move WktTrait to farm_geo module. 2021-09-01 22:46:37 -04:00
Michael Stenta 38ff51726b Always prefer "dist" install of farmOS-map.
The "source" install does not include built JS and CSS files,
so all maps break with it.
2021-09-01 22:20:31 -04:00
Michael Stenta 6b87e639af Use tilde ^ instead of greater than > for farmOS-map version.
There is no version greater than 2.0.0-alpha.0.
2021-09-01 21:59:33 -04:00
Michael Stenta 8c0d20d138 Remove unused $defaultFileScheme from KmlImporter. 2021-09-01 16:59:12 -04:00
Michael Stenta b5de7cf2e5 Merge branch '2.x-kml' into 2.x 2021-09-01 15:29:52 -04:00
Michael Stenta 950d666e56 Support KMZ files in KML importer. 2021-09-01 15:27:02 -04:00
Michael Stenta ec24339bd3 Change KML content type to application/vnd.google-earth.kml+xml. 2021-09-01 15:27:02 -04:00
Michael Stenta 84e2e64f48 Add KML importer help text. 2021-09-01 15:27:02 -04:00
Michael Stenta e293ca80bf Hide KML importer output until submission. 2021-09-01 15:27:02 -04:00
Michael Stenta 45acc539a3 Add menu link for KML importer and depend on farm_import. 2021-09-01 15:27:02 -04:00
Michael Stenta 414b9e27ed Change KML importer route to farm.import.kml. 2021-09-01 15:27:02 -04:00
Michael Stenta 5f81d46338 Add a /import page controller that displays all sub-menu items. 2021-09-01 15:27:02 -04:00
Michael Stenta 6487f394f0 Create a placeholder farm_import module.
This can be the future home of import-related support code.
CSV importers can be built here, or in sub-modules of this.
The KML importer can move here, and future importers for
GeoJSON and other formats may also be added.
2021-09-01 15:27:02 -04:00
Michael Stenta 3ea781aa42 Change KML importer form router path to import/kml. 2021-09-01 15:27:02 -04:00
Michael Stenta 64ba44c694 Move farm_kml_import module to farm_import_kml. 2021-09-01 15:27:02 -04:00
Michael Stenta 1afff89207 Add farm_kml and farm_kml_import modules to farm_modules(). 2021-09-01 15:27:02 -04:00
Michael Stenta 2303d9c14a Expand ContentEntityGeometryNormalizer docblock. 2021-09-01 15:27:02 -04:00
Michael Stenta 08cb0edda8 The farm_kml_import module depends on farm_kml. 2021-09-01 15:27:02 -04:00
Michael Stenta d37d801002 Rename ContentEntityNormalizer to ContentEntityGeometryNormalizer. 2021-09-01 15:27:02 -04:00
Michael Stenta c0989179be Move GeometryWrapper and ContentEntityNormalizer to farm_geo module. 2021-09-01 15:27:02 -04:00
Michael Stenta 38e8b9fcf3 Start a new farm_geo module for geospatial features that other modules can use. 2021-09-01 15:27:02 -04:00
Michael Stenta 633f3e2ac5 Add references to GeoPHP maintainer suggestions to create a Geometry wrapper object for storing non-geospatial properties. 2021-09-01 15:27:02 -04:00
Michael Stenta 8fff08df4e Add entity type, bundle, and internal ID to KML. 2021-09-01 15:27:02 -04:00