Skip to content

Commit 2c5b7a3

Browse files
feat(indiekit): use action-table to list installed plug-ins
1 parent 0b100e6 commit 2c5b7a3

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

packages/indiekit/lib/controllers/plugin.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,24 @@ import { getPackageData } from "../utils.js";
44
export const list = (request, response) => {
55
const { application } = response.app.locals;
66

7-
const plugins = application.installedPlugins.map((plugin) => {
7+
const pluginRows = application.installedPlugins.map((plugin) => {
88
const _package = getPackageData(plugin.filePath);
9-
plugin.photo = {
10-
srcOnError: "/assets/plug-in.svg",
11-
attributes: { height: 96, width: 96 },
12-
url: `/assets/${plugin.id}/icon.svg`,
13-
};
14-
plugin.title = plugin.name;
15-
plugin.description = _package.description;
16-
plugin.url = `/plugins/${plugin.id}`;
17-
18-
return plugin;
9+
10+
let name = `<h2><a href="/plugins/${plugin.id}">${plugin.name}</a></h2>`;
11+
12+
if (_package.description) {
13+
name += `<p>${_package.description}</p>`;
14+
}
15+
16+
return [
17+
{
18+
text: name,
19+
classes: "s-flow",
20+
},
21+
{
22+
text: _package.version,
23+
},
24+
];
1925
});
2026

2127
response.render("plugins/list", {
@@ -24,7 +30,7 @@ export const list = (request, response) => {
2430
text: response.locals.__("status.title"),
2531
},
2632
title: response.locals.__("status.application.installedPlugins"),
27-
plugins,
33+
pluginRows,
2834
});
2935
};
3036

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{% extends "document.njk" %}
22

33
{% block content %}
4-
{{ cardGrid({
5-
cardSize: "100%",
6-
items: plugins
4+
{{ actionTable({
5+
sort: "name",
6+
head: [
7+
{ text: "Name" },
8+
{ text: "Version" }
9+
],
10+
rows: pluginRows
711
}) }}
812
{% endblock %}

0 commit comments

Comments
 (0)