Setting "Additional Field Options" for thumbnails in Voyager - laravel

I would like to use thumbnails in my blog posts. In the Post-model I need to write this:
use TCG\Voyager\Traits\Resizable;
class Post extends Model
{
use Resizable;
}
Then there is an other settings piece:
{
"resize": {
"width": "1000",
"height": null
},
"quality" : "70%",
"upsize" : true,
"thumbnails": [
{
"name": "medium",
"scale": "50%"
},
{
"name": "small",
"scale": "25%"
},
{
"name": "cropped",
"crop": {
"width": "300",
"height": "250"
}
}
]
}
Where does the settings part go?
And, how do I generate the thumbnails after that?
Sources:
https://voyager.readme.io/docs/thumbnails-url
https://voyager.readme.io/docs/additional-field-options#section-image

Settings should be written in the BREAD page for your table in front of the image form field.

Related

ESRI Js API 4.15 : FeatureLayer labels are not visible on all features

I'm trying to show labels on a point FeatureLayer, the label is not visible for just one Feature, But it become visible when the map change scale, is there any explanation?
Here is my code:
"renderer": {
"type": "class-breaks",
"field": "nums",
"classBreakInfos": [
{
"minValue": 0,
"maxValue": 9,
"label": " < 10",
"symbol": {
"type": "picture-marker",
"url": "./assets/picto/nums/vert.png",
"width": 30,
"height": 50
}
},
{
"minValue": 10,
"maxValue": 19,
"label": " 10 à 19",
"symbol": {
"type": "picture-marker",
"url": "./assets/picto/nums/orange.png",
"width": 30,
"height": 50
}
},
{
"minValue": 20,
"maxValue": 1000000,
"label": " > 19",
"symbol": {
"type": "picture-marker",
"url": "./assets/picto/nums/rouge.png",
"width": 30,
"height": 50
}
}
]
},
"labelingInfo": [
{
"labelExpressionInfo": {
"expression": "$feature.nums"
},
"labelPlacement": "center-center",
"symbol": {
"type": "text",
"color": "black",
"haloColor": "white",
"xoffset": -2,
"yoffset": 13,
"font": {
"size": 7,
"family": "sans-serif",
"weight": "bolder"
}
}
}
]
I joined a picture of the FeatureLayer labels problem:
Base on you definition, you are using the default deconflict strategy ("static"). Sometimes when overlaps occurs the overlapped label is not showed. Depends on the situation this strategy make sense or not.
You could try "none" option, to turn off deconfliction and you should not have that issue. It seems it might be what you are looking for.
labelClass.deconflictionStrategy = "none";
ArcGIS JS API - LabelClass deconflictionStrategy

contentful graphql nested structure

I have a page in contentful which I retrieve content to my react app with graphql.
In this page, a link a content model called Person which is like that:
{
"name": "Person",
"description": "",
"displayField": "name",
"fields": [
{
"id": "name",
"name": "Name",
"type": "Symbol",
"localized": false,
"required": true,
"validations": [],
"disabled": false,
"omitted": false
},
{
"id": "profilePic",
"name": "profile pic",
"type": "Link",
"localized": false,
"required": true,
"validations": [],
"disabled": false,
"omitted": false,
"linkType": "Asset"
},
{
"id": "socialLinks",
"name": "social links",
"type": "Array",
"localized": false,
"required": false,
"validations": [],
"disabled": false,
"omitted": false,
"items": {
"type": "Link",
"validations": [
{
"linkContentType": [
"socialLink"
]
}
],
"linkType": "Entry"
}
}
ProfilePic is another content model which include name and picUrl.
SocialLinks is an array of socialLink content model which contain name and link
I can retrieve without problem my profilePic name or picUrl but I cannot get the socialLinks.
I have read the contentful documentation about one-to-many but is not clear to me how to apply to my case: https://www.contentful.com/developers/docs/references/graphql/#/reference/schema-generation/one-to-many-multi-type-relationships
My query:
...rest of the query..
founder{
name,
profilePic{
url,
title
},
socialLinksCollection {
items {
name,
link
}
}
},
... rest of the query...
Can somoene help me understand why it doesn't work as a normal collection?
Should I maybe use this concept of linkedFrom? But how exactly?
I had to add (limit: 1) to my socialLinksCollections otehrwise there were too many calls and wasn't possible to get the data back.
Thanks to #stefan judis for the suggestion where to look out for the errors.

Google Places API: different output for textsearch and nearbysearch (formatted_address missing)

Want to use Google Places API nearby search for reverse lookup using coordinates.
I use nearbysearch endpoint.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.892674%2C151.200727&rankby=distance&type=bar&key=...
What is missing is formatted_address.
When trying to use textsearch instead, I do get formatted_address.
https://maps.googleapis.com/maps/api/place/textsearch/json?location=-33.892674%2C151.200727&rankby=distance&type=bar&key=...
Both return the same first place_id and look very similar.
Differences I noticed:
textsearch: formatted_address, empty opening_hours are included
nearbysearch: vicinity, scope, empty opening_hours are not included
How do I get formatted_address?
Update: I checked and both types should return the same fields.
details
When searching by distance & type I guess I could use either nearbysearch or textsearch, but when searching by prominence I will have to use nearbysearch as textsearch requires either type or query.
The query I would like to use (using nearbysearch, so missing formatted_address):
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.892674%2C151.200727&rankby=prominence&radius=500&key=...
Full output textsearch
{
"business_status": "OPERATIONAL",
"formatted_address": "7 Cope St, Redfern NSW 2016",
"geometry": {
"location": {
"lat": -33.892682,
"lng": 151.20075
},
"viewport": {
"northeast": {
"lat": -33.89147812010727,
"lng": 151.2019769298927
},
"southwest": {
"lat": -33.89417777989272,
"lng": 151.1992772701072
}
}
},
"icon": "https://maps.gstatic.com/mapfiles/place_api/icons/bar-71.png",
"id": "d8b3f319ad00fafd66527b248e450284a53386c2",
"name": "Arcadia",
"opening_hours": {
"open_now": true
},
"photos": [
{
"height": 3000,
"html_attributions": [
"Colin Hannah"
],
"photo_reference": "CmRaAAAAvnYeIFoCoiiQoyRqKQqpz1yJK71eXM3wYuCiTFTTtj3iwTiIW_z865AfLogqMiEyyBh5GqZoxAcHDmzyE8KelhGEh3C-ggm5LQDGK4zFWxdTNCholvXurq0ce7zLoztgEhBgklqzYxK5jhDhwqB5wuabGhQRUb448z5zV9l7EDSmXLMo5icv1w",
"width": 4000
}
],
"place_id": "ChIJ3Y3vQdqxEmsRTvCcbZnsYJ8",
"plus_code": {
"compound_code": "4642+W7 Redfern, New South Wales",
"global_code": "4RRH4642+W7"
},
"price_level": 2,
"rating": 4.5,
"reference": "ChIJ3Y3vQdqxEmsRTvCcbZnsYJ8",
"types": [
"bar",
"point_of_interest",
"establishment"
],
"user_ratings_total": 279
},
Full output nearbysearch:
{
"business_status": "OPERATIONAL",
"geometry": {
"location": {
"lat": -33.892682,
"lng": 151.20075
},
"viewport": {
"northeast": {
"lat": -33.8914789697085,
"lng": 151.2019760802915
},
"southwest": {
"lat": -33.89417693029149,
"lng": 151.1992781197085
}
}
},
"icon": "https://maps.gstatic.com/mapfiles/place_api/icons/bar-71.png",
"id": "d8b3f319ad00fafd66527b248e450284a53386c2",
"name": "Arcadia",
"opening_hours": {
"open_now": true
},
"photos": [
{
"height": 3024,
"html_attributions": [
"Milan"
],
"photo_reference": "CmRaAAAA7u4ZpZOddZ8ypuGySsQ1lG0HEX4Ke0DHeYtHYN1gEchx-yf1U-DVLNHVdmFVLoocHbMmWlMVCqcW9oMnpDC4-dw6ObZAovVQG90GpVD3sYeMEpzBB80yjhttjZ1lsIEdEhCzQJane_k8xy-HlI9ZlE9WGhQJ13KgR88Q239e8ocBCt5H0BgpKQ",
"width": 4032
}
],
"place_id": "ChIJ3Y3vQdqxEmsRTvCcbZnsYJ8",
"plus_code": {
"compound_code": "4642+W7 Redfern NSW, Australia",
"global_code": "4RRH4642+W7"
},
"price_level": 2,
"rating": 4.5,
"reference": "ChIJ3Y3vQdqxEmsRTvCcbZnsYJ8",
"scope": "GOOGLE", <===========
"types": [
"bar",
"point_of_interest",
"establishment"
],
"user_ratings_total": 279,
"vicinity": "7 Cope Street, Redfern" <===========
},
Comment from #MrUpsidown points to the documentation where it is stated:
A Text Search response is similar, except that it returns a formatted_address instead of a vicinity property
So, it seems that's just the way it is.
"formatted_address": "7 Cope St, Redfern NSW 2016",
vs
"vicinity": "7 Cope Street, Redfern"

Dependent field in Laravel Nova using Nova Dependency Container

I'm quite new to Laravel Nova, and I'm trying to implement dependent fields but there's no easy solution to it. I want to display a checkbox if a certain value is selected in a select dropdown.
After a little searching, I found this: https://github.com/epartment/nova-dependency-container. I'm trying to use this, but something's not working right. I'm using Laravel v5.7 and Nova v1.3.2. Hence, I've installed v1.1.2 of this package.
I followed the installation guidelines and have written the following code:
<?php
namespace App\Nova;
...
use Epartment\NovaDependencyContainer\HasDependencies;
use Epartment\NovaDependencyContainer\NovaDependencyContainer;
...
class Submission extends Resource
{
use HasDependencies;
....
public function fields(Request $request)
{
$fields[] = Select::make('Route', 'route')->options([
0 => 'First Name',
1 => 'First Name / Last Name',
2 => 'Full Name'
])->displayUsingLabels();
$fields[] = NovaDependencyContainer::make([
Text::make('Title', 'title')
])->dependsOn('route', 2);
...
return $fields;
}
....
}
?>
I can see the field Route with the right options and values. However, when I select 'Full Name', the dependent field Title is not displayed.
When I see the JSON response of the fields, this is what I get:
...
{
"component": "select-field",
"prefixComponent": true,
"indexName": "Route",
"name": "Route",
"attribute": "route",
"value": null,
"panel": null,
"sortable": false,
"textAlign": "left",
"options": [
{
"label": "First Name",
"value": 0
},
{
"label": "First Name / Last Name",
"value": 1
},
{
"label": "Full Name",
"value": 2
}
]
},
{
"component": "nova-dependency-container",
"prefixComponent": true,
"indexName": "",
"name": "",
"attribute": "",
"value": [],
"panel": null,
"sortable": false,
"textAlign": "left",
"fields": [
{
"component": "text-field",
"prefixComponent": true,
"indexName": "Title",
"name": "Title",
"attribute": "title",
"value": null,
"panel": null,
"sortable": false,
"textAlign": "left"
}
],
"dependencies": [
{
"field": "route",
"value": 2
}
]
},
...
I'm not sure where I'm going wrong. Would be great if someone could guide me here. Or if there's another solution that works.
Thanks!

Display enum property of model definitions

i am trying to display the enum of a model in the model description.
The schema of my model is defined under definitions and uses an enum for the action property, because only this three types are allowed. (see code below)
I am using swagger version 2.0. In version 1.2 this seems to work: http://petstore.swagger.wordnik.com/ you can find the example under store/order.
they also use an enum and this is displayed behind the property in the model view.
How can i achieve the same result with the new version?
Thanks for help!
"paths": {
"/event": {
"post": {
"tags": [
"event"
],
"summary": "Add an new Event.",
"description": "TEST",
"operationId": "addEvent",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "body",
"name": "data",
"description": "",
"required": true,
"schema": {
"$ref": "#/definitions/Event"
}
}
],
"responses": {
"405": {
"description": "Invalid input"
}
}
}
}
}
"definitions": {
"Event": {
"id": "eventModel",
"required": [
"action"
],
"properties": {
"action": {
"type": "string",
"default": "START",
"enum": [
"START",
"UPDATE",
"END"
],
"description": "blabla"
}
}
}
}
PS: another mistake i recognized right now, is that the shown model description of arrays misses the closing bracket ].
Your definition is fine, there's a known bug in swagger-ui - https://github.com/swagger-api/swagger-ui/issues/672. Feel free to subscribe the issue and follow the progress there.
As a side note, there's no "id" property in models in Swagger 2.0.

Resources