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

1297 commits

Author SHA1 Message Date
Michael Stenta
1ea5f0069e The Seed module depends on farm_plant_type, not farm_plant. 2021-09-09 14:27:31 -04:00
Michael Stenta
6379e8b59f Split Animal type and Plant type vocabularies out to their own modules.
This is mainly for consistency with the other vocabs, in
case there are future modules that want to vocab without
the asset type (like we needed with Material Type). By
putting all vocabs in modules/taxonomy we make it easy to
quickly see all the vocabularies that farmOS provides in
both the file system and module list.

The one remaining exception is Crop Family, which is
included in the farm_plant_type module.
See https://www.drupal.org/project/farm/issues/3191115
2021-09-09 14:27:31 -04:00
Michael Stenta
2a52a82d4f Fix hook_farm_api_meta_alter() documentation. 2021-09-09 14:27:31 -04:00
Michael Stenta
3d6161453f Hide geometry field label in asset and log page top region. 2021-09-09 14:26:15 -04:00
Michael Stenta
7e67a71c06 Add some vertical padding to layout regions. 2021-09-09 14:26:15 -04:00
Michael Stenta
abd21f53b5 Put asset "Group membership" field in the second region. 2021-09-09 14:26:15 -04:00
Michael Stenta
c6112ff7f6 Add hook_farm_ui_theme_region_items() for defining asset, log, and plan content region items. 2021-09-09 10:24:44 -04:00
Michael Stenta
98aa8b5ee0 Use a stacked two-column layout for full asset, log, and plan pages. 2021-09-09 10:16:29 -04:00
Michael Stenta
1e3c018fe0 Fix map.js in farm_ui_theme.libraries.yml. 2021-09-06 16:08:36 -04:00
Michael Stenta
08c50d7fde Fix TypeError: Argument 1 passed to Drupal\Core\Entity\EntityStorageBase::loadMultiple() must be of the type array or null, string given.
This error occurs if ?asset=X is used instead of ?asset[]=X.
We can take a more defensive approach by automatically
wrapping the input in an array if it isn't already one.
2021-09-06 11:00:51 -04:00
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
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
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
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
paul121
70ad63479d Allow geojson and gpx file extensions. 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
8c0d20d138 Remove unused $defaultFileScheme from KmlImporter. 2021-09-01 16:59:12 -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
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