Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config/nova-google-polygon.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@

return [
// Get your key from https://console.developers.google.com
'api_key' => env('NOVA_GOOGLE_POLYGON_API_KEY', '')
'api_key' => env('NOVA_GOOGLE_POLYGON_API_KEY', ''),
'center' => [
'lat' => env('NOVA_GOOGLE_POLYGON_CENTER_LAT', 48.858361),
'lng' => env('NOVA_GOOGLE_POLYGON_CENTER_LNG', 2.336164),
]
];
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/field.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* vuex v4.0.2
* (c) 2021 Evan You
* vuex v4.1.0
* (c) 2022 Evan You
* @license MIT
*/

Expand Down
312 changes: 159 additions & 153 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions resources/js/components/DetailField.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PanelItem :index="index" :field="field">
<template #value>
<Map :center="center" :shape-options="shapeOptions" :readonly="true" :value="value" />
<Map :center="center" :shape-options="shapeOptions" :readonly="true" :value="value"/>
</template>
</PanelItem>
</template>
Expand All @@ -10,14 +10,17 @@
import Map from './Map';

export default {
components: { Map },
components: {Map},
props: ['index', 'field'],
computed: {
value() {
return this.field.value || [];
},
center() {
return { lat: 48.858361, lng: 2.336164 };
return {
lat: parseFloat(Nova.config('googlePolygon').center.lat),
lng: parseFloat(Nova.config('googlePolygon').center.lng)
};
},
shapeOptions() {
return {
Expand Down
9 changes: 6 additions & 3 deletions resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@
</template>

<script>
import { HandlesValidationErrors, FormField } from 'laravel-nova';
import {FormField, HandlesValidationErrors} from 'laravel-nova';
import Map from './Map';

export default {
components: { Map },
components: {Map},
mixins: [FormField, HandlesValidationErrors],
props: ['field', 'showHelpText'],
data: () => ({
value: [],
}),
computed: {
center() {
return { lat: 48.858361, lng: 2.336164 };
return {
lat: parseFloat(Nova.config('googlePolygon').center.lat),
lng: parseFloat(Nova.config('googlePolygon').center.lng)
};
},
shapeOptions() {
return {
Expand Down
1 change: 1 addition & 0 deletions src/FieldServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function boot(): void
Nova::provideToScript([
'googlePolygon' => [
'key' => config('nova-google-polygon.api_key'),
'center' => config('nova-google-polygon.center'),
],
]);
});
Expand Down