Skip to content

Commit a1c84f6

Browse files
feat(endpoint-posts): featured field
1 parent 2baefef commit a1c84f6

16 files changed

+141
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{% call fieldset({
2+
classes: "fieldset--group",
3+
legend: __("posts.form.featured.label"),
4+
optional: not field.required
5+
}) %}
6+
{{ fileInput({
7+
field: {
8+
attributes: {
9+
endpoint: application.mediaEndpoint
10+
}
11+
},
12+
name: "featured[url]",
13+
type: "url",
14+
value: fieldData("featured.url").value,
15+
label: __("posts.form.media.label"),
16+
accept: "image/*",
17+
attributes: {
18+
placeholder: "https://"
19+
},
20+
errorMessage: fieldData("featured.url").errorMessage
21+
}) | indent(2) }}
22+
23+
{{ textarea({
24+
name: "featured[alt]",
25+
value: fieldData("featured.alt").value,
26+
label: __("posts.form.featured.alt"),
27+
rows: 1,
28+
errorMessage: fieldData("featured.alt").errorMessage
29+
}) | indent(2) }}
30+
{% endcall %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% set html %}
2+
<figure>
3+
<img src="{{ property[0].url | url(publication.me) }}" alt="{{ property[0].alt }}">
4+
</figure>
5+
{% endset -%}
6+
{{- prose({
7+
html: html
8+
}) if property }}

packages/endpoint-posts/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ export default class PostsEndpoint {
7272
exists: { if: (value, { req }) => isRequired(req, "content") },
7373
notEmpty: true,
7474
},
75+
"featured.url": {
76+
errorMessage: (value, { req }) =>
77+
req.__(`posts.error.media.empty`, "/photos/image.jpg"),
78+
exists: { if: (value, { req }) => isRequired(req, "featured") },
79+
notEmpty: true,
80+
},
81+
"featured.alt": {
82+
errorMessage: (value, { req }) =>
83+
req.__(`posts.error.featured-alt.empty`),
84+
exists: { if: (value, { req }) => req.body?.featured.url },
85+
notEmpty: true,
86+
},
7587
geo: {
7688
errorMessage: (value, { req }) => req.__(`posts.error.geo.invalid`),
7789
exists: { if: (value, { req }) => req.body?.geo },

packages/endpoint-posts/locales/de.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "Geben Sie einige Inhalte ein"
1616
},
17+
"featured-alt": {
18+
"empty": "Geben Sie eine Beschreibung dieses Bildes ein"
19+
},
1720
"geo": {
1821
"invalid": "Geben Sie gültige Koordinaten ein"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "Inhalt"
4447
},
4548
"continue": "Fortsetzen",
49+
"featured": {
50+
"alt": "Barrierefreie Beschreibung",
51+
"label": "Ausgewähltes Bild"
52+
},
4653
"geo": {
4754
"hint": "Breitengrad und Längengrad, zum Beispiel %s",
4855
"label": "Koordinaten des Standorts"

packages/endpoint-posts/locales/en.json

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"content": {
55
"empty": "Enter some content"
66
},
7+
"featured-alt": {
8+
"empty": "Enter a description of this image"
9+
},
710
"geo": {
811
"invalid": "Enter valid coordinates"
912
},
@@ -68,6 +71,10 @@
6871
"content": {
6972
"label": "Content"
7073
},
74+
"featured": {
75+
"label": "Featured image",
76+
"alt": "Accessible description"
77+
},
7178
"geo": {
7279
"label": "Location coordinates",
7380
"hint": "Latitude and longitude, for example %s"

packages/endpoint-posts/locales/es-419.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "Introducir algún contenido"
1616
},
17+
"featured-alt": {
18+
"empty": "Introduzca una descripción de esta imagen"
19+
},
1720
"geo": {
1821
"invalid": "Introduce coordenadas válidas"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "Contenido"
4447
},
4548
"continue": "Continuar",
49+
"featured": {
50+
"alt": "Descripción accesible",
51+
"label": "Imagen destacada"
52+
},
4653
"geo": {
4754
"hint": "Latitud y longitud, por ejemplo %s",
4855
"label": "Coordenadas de ubicación"

packages/endpoint-posts/locales/es.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "Introducir algún contenido"
1616
},
17+
"featured-alt": {
18+
"empty": "Introduzca una descripción de esta imagen"
19+
},
1720
"geo": {
1821
"invalid": "Introduce coordenadas válidas"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "Contenido"
4447
},
4548
"continue": "Continuar",
49+
"featured": {
50+
"alt": "Descripción accesible",
51+
"label": "Imagen destacada"
52+
},
4653
"geo": {
4754
"hint": "Latitud y longitud, por ejemplo %s",
4855
"label": "Coordenadas de ubicación"

packages/endpoint-posts/locales/fr.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "Saisir du contenu"
1616
},
17+
"featured-alt": {
18+
"empty": "Entrez une description de cette image"
19+
},
1720
"geo": {
1821
"invalid": "Saisir des coordonnées valides"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "Contenu"
4447
},
4548
"continue": "Continuer",
49+
"featured": {
50+
"alt": "Description accessible",
51+
"label": "Image en vedette"
52+
},
4653
"geo": {
4754
"hint": "Latitude et longitude, par exemple %s",
4855
"label": "Coordonnées de localisation"

packages/endpoint-posts/locales/hi.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "कुछ सामग्री दर्ज करें"
1616
},
17+
"featured-alt": {
18+
"empty": "इस छवि का विवरण दर्ज करें"
19+
},
1720
"geo": {
1821
"invalid": "मान्य निर्देशांक दर्ज करें"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "कॉन्टेंट"
4447
},
4548
"continue": "जारी रखें",
49+
"featured": {
50+
"alt": "सुलभ वर्णन",
51+
"label": "विशेष रुप से प्रदर्शित छवि"
52+
},
4653
"geo": {
4754
"hint": "उदाहरण के लिए, अक्षांश और देशांतर %s",
4855
"label": "स्थान निर्देशांक"

packages/endpoint-posts/locales/id.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "Masukkan beberapa konten"
1616
},
17+
"featured-alt": {
18+
"empty": "Masukkan deskripsi gambar ini"
19+
},
1720
"geo": {
1821
"invalid": "Masukkan koordinat yang valid"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "Konten"
4447
},
4548
"continue": "Lanjutkan",
49+
"featured": {
50+
"alt": "Deskripsi yang dapat diakses",
51+
"label": "Gambar unggulan"
52+
},
4653
"geo": {
4754
"hint": "Lintang dan bujur, misalnya %s",
4855
"label": "Koordinat lokasi"

packages/endpoint-posts/locales/nl.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "Voer wat inhoud in"
1616
},
17+
"featured-alt": {
18+
"empty": "Voer een beschrijving van deze afbeelding in"
19+
},
1720
"geo": {
1821
"invalid": "Voer geldige coördinaten in"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "Inhoud"
4447
},
4548
"continue": "Doorgaan",
49+
"featured": {
50+
"alt": "Toegankelijke beschrijving",
51+
"label": "Uitgelichte afbeelding"
52+
},
4653
"geo": {
4754
"hint": "Lengte- en breedtegraad, bijvoorbeeld %s",
4855
"label": "Locatiecoördinaten"

packages/endpoint-posts/locales/pl.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "Wprowadź jakąś zawartość"
1616
},
17+
"featured-alt": {
18+
"empty": "Wprowadź opis tego obrazu"
19+
},
1720
"geo": {
1821
"invalid": "Wprowadź poprawne współrzędne"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "Zawartość"
4447
},
4548
"continue": "Kontynuuj",
49+
"featured": {
50+
"alt": "Dostępny opis",
51+
"label": "Wyróżniony obraz"
52+
},
4653
"geo": {
4754
"hint": "Szerokość i długość geograficzna, na przykład %s",
4855
"label": "Współrzędne lokalizacji"

packages/endpoint-posts/locales/pt.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "Insira algum conteúdo"
1616
},
17+
"featured-alt": {
18+
"empty": "Insira uma descrição desta imagem"
19+
},
1720
"geo": {
1821
"invalid": "Insira coordenadas válidas"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "Conteúdo"
4447
},
4548
"continue": "Continuar",
49+
"featured": {
50+
"alt": "Descrição acessível",
51+
"label": "Imagem em destaque"
52+
},
4653
"geo": {
4754
"hint": "Latitude e longitude, por exemplo %s",
4855
"label": "Coordenadas de localização"

packages/endpoint-posts/locales/sr.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "Unesite neki sadržaj"
1616
},
17+
"featured-alt": {
18+
"empty": "Unesite opis ove slike"
19+
},
1720
"geo": {
1821
"invalid": "Unesite važeće koordinate"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "Sadržaj"
4447
},
4548
"continue": "Nastavi",
49+
"featured": {
50+
"alt": "Pristupačan opis",
51+
"label": "Istaknuta slika"
52+
},
4653
"geo": {
4754
"hint": "Geografska širina i dužina, na primer %s",
4855
"label": "Koordinate lokacije"

packages/endpoint-posts/locales/sv.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "Ange innehåll"
1616
},
17+
"featured-alt": {
18+
"empty": "Ange en beskrivning av den här bilden"
19+
},
1720
"geo": {
1821
"invalid": "Ange giltiga koordinater"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "Innehåll"
4447
},
4548
"continue": "Fortsätt",
49+
"featured": {
50+
"alt": "Tillgänglig beskrivning",
51+
"label": "Utvald bild"
52+
},
4653
"geo": {
4754
"hint": "Latitud och longitud, till exempel %s",
4855
"label": "Platskoordinater"

packages/endpoint-posts/locales/zh-Hans-CN.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"content": {
1515
"empty": "输入一些内容"
1616
},
17+
"featured-alt": {
18+
"empty": "输入此图片的描述"
19+
},
1720
"geo": {
1821
"invalid": "输入有效坐标"
1922
},
@@ -43,6 +46,10 @@
4346
"label": "内容"
4447
},
4548
"continue": "继续",
49+
"featured": {
50+
"alt": "无障碍描述",
51+
"label": "特色图片"
52+
},
4653
"geo": {
4754
"hint": "纬度和经度,例如 %s",
4855
"label": "位置坐标"

0 commit comments

Comments
 (0)