@rmdes/indiekit-endpoint-posts 1.0.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/assets/icon.svg +4 -0
- package/includes/@indiekit-endpoint-posts-syndicate.njk +21 -0
- package/includes/@indiekit-endpoint-posts-widget.njk +14 -0
- package/includes/post-types/category-field.njk +11 -0
- package/includes/post-types/category.njk +4 -0
- package/includes/post-types/content-field.njk +17 -0
- package/includes/post-types/content.njk +3 -0
- package/includes/post-types/featured-field.njk +30 -0
- package/includes/post-types/featured.njk +8 -0
- package/includes/post-types/geo-field.njk +8 -0
- package/includes/post-types/location-field.njk +42 -0
- package/includes/post-types/location.njk +12 -0
- package/includes/post-types/mp-channel.njk +4 -0
- package/includes/post-types/name-field.njk +7 -0
- package/includes/post-types/published.njk +4 -0
- package/includes/post-types/summary-field.njk +17 -0
- package/includes/post-types/summary.njk +4 -0
- package/index.js +108 -0
- package/lib/controllers/delete.js +52 -0
- package/lib/controllers/form.js +121 -0
- package/lib/controllers/new.js +87 -0
- package/lib/controllers/post.js +51 -0
- package/lib/controllers/posts.js +96 -0
- package/lib/endpoint.js +53 -0
- package/lib/middleware/post-data.js +98 -0
- package/lib/middleware/validation.js +23 -0
- package/lib/status-types.js +32 -0
- package/lib/utils.js +201 -0
- package/locales/de.json +127 -0
- package/locales/en.json +127 -0
- package/locales/es-419.json +127 -0
- package/locales/es.json +127 -0
- package/locales/fr.json +127 -0
- package/locales/hi.json +127 -0
- package/locales/id.json +127 -0
- package/locales/it.json +127 -0
- package/locales/nl.json +127 -0
- package/locales/pl.json +127 -0
- package/locales/pt-BR.json +127 -0
- package/locales/pt.json +127 -0
- package/locales/sr.json +127 -0
- package/locales/sv.json +127 -0
- package/locales/zh-Hans-CN.json +127 -0
- package/package.json +55 -0
- package/views/new.njk +21 -0
- package/views/post-delete.njk +17 -0
- package/views/post-form.njk +114 -0
- package/views/post.njk +39 -0
- package/views/posts.njk +13 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{% extends "form.njk" %}
|
|
2
|
+
|
|
3
|
+
{% block fieldset %}
|
|
4
|
+
{{ input({
|
|
5
|
+
name: "type",
|
|
6
|
+
type: "hidden",
|
|
7
|
+
value: type
|
|
8
|
+
}) | indent(2) }}
|
|
9
|
+
|
|
10
|
+
{{ input({
|
|
11
|
+
name: "postType",
|
|
12
|
+
type: "hidden",
|
|
13
|
+
value: postType
|
|
14
|
+
}) | indent(2) }}
|
|
15
|
+
|
|
16
|
+
{% for name, field in fields %}
|
|
17
|
+
{% include "post-types/" + name + "-field.njk" ignore missing %}
|
|
18
|
+
{% endfor %}
|
|
19
|
+
|
|
20
|
+
{{ checkboxes({
|
|
21
|
+
name: "mp-syndicate-to",
|
|
22
|
+
values: properties["mp-syndicate-to"],
|
|
23
|
+
fieldset: {
|
|
24
|
+
legend: __("posts.form.mp-syndicate-to.label")
|
|
25
|
+
},
|
|
26
|
+
items: syndicationTargetItems
|
|
27
|
+
}) | indent(2) }}
|
|
28
|
+
|
|
29
|
+
{% call details({
|
|
30
|
+
open: showAdvancedOptions,
|
|
31
|
+
summary: __("posts.form.advancedOptions")
|
|
32
|
+
}) %}
|
|
33
|
+
{{ radios({
|
|
34
|
+
fieldset: {
|
|
35
|
+
legend: __("posts.form.published.label")
|
|
36
|
+
},
|
|
37
|
+
name: "publication-date",
|
|
38
|
+
values: fieldData("publication-date").value,
|
|
39
|
+
items: [{
|
|
40
|
+
label: __("posts.form.published.now") if postStatus !== "published" else fieldData("published").value | date("PPPppp", { locale: opts.locale, timeZone: application.timeZone }),
|
|
41
|
+
value: "now",
|
|
42
|
+
checked: true
|
|
43
|
+
}, {
|
|
44
|
+
label: __("posts.form.published.scheduled"),
|
|
45
|
+
value: "scheduled",
|
|
46
|
+
conditional: input({
|
|
47
|
+
classes: "input--width-10",
|
|
48
|
+
name: "published",
|
|
49
|
+
type: "datetime-local",
|
|
50
|
+
label: __("posts.form.published.label")
|
|
51
|
+
})
|
|
52
|
+
}]
|
|
53
|
+
}) }}
|
|
54
|
+
|
|
55
|
+
{{ checkboxes({
|
|
56
|
+
name: "mp-channel",
|
|
57
|
+
values: properties["mp-channel"],
|
|
58
|
+
fieldset: {
|
|
59
|
+
legend: __("posts.form.mp-channel.label"),
|
|
60
|
+
optional: true
|
|
61
|
+
},
|
|
62
|
+
items: channelItems
|
|
63
|
+
}) | indent(2) if publication.channels }}
|
|
64
|
+
|
|
65
|
+
{{ radios({
|
|
66
|
+
inline: true,
|
|
67
|
+
name: "visibility",
|
|
68
|
+
values: properties.visibility,
|
|
69
|
+
fieldset: {
|
|
70
|
+
legend: __("posts.form.visibility.label"),
|
|
71
|
+
optional: true
|
|
72
|
+
},
|
|
73
|
+
items: [{
|
|
74
|
+
label: __("posts.status.public"),
|
|
75
|
+
value: "public"
|
|
76
|
+
}, {
|
|
77
|
+
label: __("posts.status.private"),
|
|
78
|
+
value: "private"
|
|
79
|
+
}, {
|
|
80
|
+
label: __("posts.status.unlisted"),
|
|
81
|
+
value: "unlisted"
|
|
82
|
+
}]
|
|
83
|
+
}) | indent(4) if fields.visibility }}
|
|
84
|
+
|
|
85
|
+
{{ input({
|
|
86
|
+
classes: "input--width-25",
|
|
87
|
+
name: "mp-slug",
|
|
88
|
+
value: fieldData("slug").value,
|
|
89
|
+
label: __("posts.form.mp-slug.label"),
|
|
90
|
+
optional: true
|
|
91
|
+
}) | indent(4) }}
|
|
92
|
+
{% endcall %}
|
|
93
|
+
{% endblock %}
|
|
94
|
+
|
|
95
|
+
{% block buttons %}
|
|
96
|
+
<div class="button-group">
|
|
97
|
+
{{ button({
|
|
98
|
+
name: "post-status",
|
|
99
|
+
value: "published",
|
|
100
|
+
text: __("posts.form.update") if postStatus === "published" else __("posts.form.publish")
|
|
101
|
+
}) | indent(4) if not draftMode }}
|
|
102
|
+
|
|
103
|
+
{{ button({
|
|
104
|
+
name: "post-status",
|
|
105
|
+
value: "draft",
|
|
106
|
+
classes: "button--secondary",
|
|
107
|
+
text: __("posts.form.updateDraft") if postStatus === "draft" else __("posts.form.publishDraft")
|
|
108
|
+
}) | indent(4) if postStatus !== "published" }}
|
|
109
|
+
|
|
110
|
+
{{ prose({
|
|
111
|
+
text: "[" + __("posts.form.cancel") + "](" + postsPath + ")"
|
|
112
|
+
}) | indent(4) }}
|
|
113
|
+
</div>
|
|
114
|
+
{% endblock %}
|
package/views/post.njk
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{% extends "document.njk" %}
|
|
2
|
+
|
|
3
|
+
{% block content %}
|
|
4
|
+
{{ badge({
|
|
5
|
+
color: statusTypes.deleted.color,
|
|
6
|
+
text: __(statusTypes.deleted.text)
|
|
7
|
+
}) if properties.deleted }}
|
|
8
|
+
|
|
9
|
+
{{ badge({
|
|
10
|
+
color: statusTypes[postStatus].color,
|
|
11
|
+
text: __(statusTypes[postStatus].text)
|
|
12
|
+
}) if postStatus }}
|
|
13
|
+
|
|
14
|
+
{{ badge({
|
|
15
|
+
color: statusTypes[properties.visibility].color,
|
|
16
|
+
icon: statusTypes[properties.visibility].icon,
|
|
17
|
+
text: __(statusTypes[properties.visibility].text)
|
|
18
|
+
}) if postStatus === "published" and statusTypes[properties.visibility] }}
|
|
19
|
+
|
|
20
|
+
{{ badge({
|
|
21
|
+
color: statusTypes.syndicated.color,
|
|
22
|
+
icon: statusTypes.syndicated.icon,
|
|
23
|
+
text: __(statusTypes.syndicated.text)
|
|
24
|
+
}) if postStatus === "published" and properties.syndication and statusTypes.syndicated }}
|
|
25
|
+
|
|
26
|
+
{% if postStatus === "published" and properties["mp-syndicate-to"] %}
|
|
27
|
+
{% include "@indiekit-endpoint-posts-syndicate.njk" %}
|
|
28
|
+
{% endif %}
|
|
29
|
+
|
|
30
|
+
{% for name, property in properties %}
|
|
31
|
+
{% include "post-types/" + name + ".njk" ignore missing %}
|
|
32
|
+
{% endfor %}
|
|
33
|
+
|
|
34
|
+
{% call details({
|
|
35
|
+
summary: __("posts.post.properties")
|
|
36
|
+
}) %}
|
|
37
|
+
{{ summary({ rows: summaryRows(properties) }) }}
|
|
38
|
+
{% endcall %}
|
|
39
|
+
{% endblock %}
|
package/views/posts.njk
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{% extends "document.njk" %}
|
|
2
|
+
|
|
3
|
+
{% block content %}
|
|
4
|
+
{%- if posts.length > 0 %}
|
|
5
|
+
{{ cardGrid({
|
|
6
|
+
cardSize: "16rem",
|
|
7
|
+
items: posts
|
|
8
|
+
}) }}
|
|
9
|
+
{{ pagination(cursor) }}
|
|
10
|
+
{%- else -%}
|
|
11
|
+
{{ prose({ text: __("posts.posts.none") }) }}
|
|
12
|
+
{%- endif %}
|
|
13
|
+
{% endblock %}
|