@rmdes/indiekit-endpoint-rss 1.1.0 → 1.1.1

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/assets/styles.css CHANGED
@@ -86,10 +86,18 @@
86
86
  align-items: center;
87
87
  border-block-end: 1px solid var(--color-border);
88
88
  display: flex;
89
+ flex-wrap: wrap;
89
90
  gap: var(--space-s);
90
91
  padding: var(--space-s) 0;
91
92
  }
92
93
 
94
+ /* The publish disclosure gets a row of its own. As a plain flex sibling of the
95
+ icon, info and actions it was squeezed into the same line and overlapped the
96
+ feed metadata. */
97
+ .rss-publish {
98
+ flex-basis: 100%;
99
+ }
100
+
93
101
  .rss-feed-item:last-child {
94
102
  border-block-end: none;
95
103
  }
package/locales/en.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "feedAdded": "Feed added successfully",
41
41
  "feedRemoved": "Feed removed",
42
42
  "feedUpdated": "Feed updated",
43
- "feedEnabled": "Feed enabled",
43
+ "feedEnabled": "Feed enabled",
44
44
  "feedDisabled": "Feed disabled",
45
45
  "backfillQueued": "Backfill queued; items will be published as drafts over the next sync cycles",
46
46
  "syncComplete": "Sync complete",
@@ -56,8 +56,12 @@
56
56
  "enabled": "Create posts from this feed",
57
57
  "postType": "Post type",
58
58
  "content": "Content template",
59
+ "contentHint": "Placeholders: {{title}} {{link}} {{description}} {{content}} {{author}} {{sourceTitle}}",
59
60
  "linkProperty": "Link property",
61
+ "linkPropertyHint": "Discovery property carrying the item URL, e.g. bookmark-of. Leave empty for a plain note or article.",
60
62
  "status": "Post status",
63
+ "draft": "Draft",
64
+ "published": "Published",
61
65
  "save": "Save publish settings"
62
66
  }
63
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-rss",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "RSS feed reader endpoint for Indiekit. Aggregates multiple feeds, caches in MongoDB, displays on frontend.",
5
5
  "keywords": [
6
6
  "indiekit",
package/views/rss.njk CHANGED
@@ -101,39 +101,78 @@
101
101
  <div class="rss-feed-error">{{ feed.lastError }}</div>
102
102
  {% endif %}
103
103
  </div>
104
- <details class="rss-publish">
105
- <summary>{{ __("rss.publish.title") }}{% if feed.publish.enabled %} &bull; {{ feed.publish.postType }}{% endif %}</summary>
104
+ {% set typeItems = [] %}
105
+ {% for type in postTypes %}
106
+ {% set typeItems = (typeItems.push({
107
+ text: type,
108
+ value: type,
109
+ selected: feed.publish.postType == type
110
+ }), typeItems) %}
111
+ {% endfor %}
112
+ {% set publishSummary %}{{ __("rss.publish.title") }}{% if feed.publish.enabled %} &bull; {{ feed.publish.postType }}{% endif %}{% endset %}
113
+ {% call details({
114
+ classes: "rss-publish",
115
+ summary: publishSummary
116
+ }) %}
106
117
  <form data-publish-feed="{{ feed.id }}">
107
- <label>
108
- <input type="checkbox" name="enabled" {{ "checked" if feed.publish.enabled }}>
109
- {{ __("rss.publish.enabled") }}
110
- </label>
111
- <label>
112
- {{ __("rss.publish.postType") }}
113
- <select name="postType">
114
- {% for type in postTypes %}
115
- <option value="{{ type }}" {{ "selected" if feed.publish.postType == type }}>{{ type }}</option>
116
- {% endfor %}
117
- </select>
118
- </label>
119
- <label>
120
- {{ __("rss.publish.content") }}
121
- <input class="input" type="text" name="content" value="{{ feed.publish.content or '{{description}}' }}">
122
- </label>
123
- <label>
124
- {{ __("rss.publish.linkProperty") }}
125
- <input class="input" type="text" name="linkProperty" value="{{ feed.publish.linkProperty or '' }}">
126
- </label>
127
- <label>
128
- {{ __("rss.publish.status") }}
129
- <select name="status">
130
- <option value="draft" {{ "selected" if feed.publish.status != "published" }}>draft</option>
131
- <option value="published" {{ "selected" if feed.publish.status == "published" }}>published</option>
132
- </select>
133
- </label>
134
- {{ button({ type: "submit", text: __("rss.publish.save") }) }}
118
+ {{ checkboxes({
119
+ idPrefix: "publish-enabled-" + feed.id,
120
+ name: "enabled",
121
+ items: [{
122
+ value: "true",
123
+ text: __("rss.publish.enabled"),
124
+ checked: feed.publish.enabled
125
+ }]
126
+ }) }}
127
+
128
+ {{ select({
129
+ id: "publish-post-type-" + feed.id,
130
+ name: "postType",
131
+ label: __("rss.publish.postType"),
132
+ items: typeItems
133
+ }) }}
134
+
135
+ {{ input({
136
+ id: "publish-content-" + feed.id,
137
+ name: "content",
138
+ label: __("rss.publish.content"),
139
+ hint: __("rss.publish.contentHint"),
140
+ value: feed.publish.content or "{{description}}"
141
+ }) }}
142
+
143
+ {{ input({
144
+ id: "publish-link-property-" + feed.id,
145
+ name: "linkProperty",
146
+ label: __("rss.publish.linkProperty"),
147
+ hint: __("rss.publish.linkPropertyHint"),
148
+ optional: true,
149
+ value: feed.publish.linkProperty
150
+ }) }}
151
+
152
+ {{ select({
153
+ id: "publish-status-" + feed.id,
154
+ name: "status",
155
+ label: __("rss.publish.status"),
156
+ items: [
157
+ {
158
+ text: __("rss.publish.draft"),
159
+ value: "draft",
160
+ selected: feed.publish.status != "published"
161
+ },
162
+ {
163
+ text: __("rss.publish.published"),
164
+ value: "published",
165
+ selected: feed.publish.status == "published"
166
+ }
167
+ ]
168
+ }) }}
169
+
170
+ {{ button({
171
+ type: "submit",
172
+ text: __("rss.publish.save")
173
+ }) }}
135
174
  </form>
136
- </details>
175
+ {% endcall %}
137
176
  <div class="rss-feed-actions">
138
177
  <label class="rss-toggle">
139
178
  <input
@@ -322,7 +361,9 @@
322
361
  const data = new FormData(e.target);
323
362
 
324
363
  const publish = {
325
- enabled: data.get('enabled') === 'on',
364
+ // The checkboxes component sets value="true"; an unchecked box is
365
+ // omitted from FormData entirely, so presence is the signal.
366
+ enabled: data.get('enabled') !== null,
326
367
  postType: data.get('postType'),
327
368
  content: data.get('content'),
328
369
  linkProperty: data.get('linkProperty') || null,