mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-27 06:52:35 -04:00
[admin] overview of translation contributions
This commit is contained in:
parent
49503f8191
commit
40da22794a
@ -76,6 +76,46 @@
|
|||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<details v-if="contributors.length" class="border mb-3">
|
||||||
|
<summary class="bg-light p-3">
|
||||||
|
Contributors
|
||||||
|
</summary>
|
||||||
|
<div class="p-2">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Contributor</th>
|
||||||
|
<th>Approved translations</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="{username, isMember, count} in contributors">
|
||||||
|
<td>
|
||||||
|
<nuxt-link :to="`/@${username}`">@{{username}}</nuxt-link>
|
||||||
|
<span v-if="isMember" class="badge bg-primary text-white">
|
||||||
|
<Icon v="collective-logo.svg" class="inverted"/>
|
||||||
|
<T>contact.team.member</T>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ count }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" class="small">
|
||||||
|
This overview only considers translations submitted via the web interface, got gitlab/gdocs.
|
||||||
|
Let's use it to consider inviting people to the team.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
</div>
|
</div>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
@ -94,6 +134,7 @@ export default {
|
|||||||
async asyncData({ app }) {
|
async asyncData({ app }) {
|
||||||
return {
|
return {
|
||||||
translationProposals: await app.$axios.$get(`/translations/proposals`),
|
translationProposals: await app.$axios.$get(`/translations/proposals`),
|
||||||
|
contributors: await app.$axios.$get(`/translations/contributors`),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -98,4 +98,25 @@ router.post('/translations/proposals-done', handleErrorAsync(async (req, res) =>
|
|||||||
return res.json('OK');
|
return res.json('OK');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
router.get('/translations/contributors', handleErrorAsync(async (req, res) => {
|
||||||
|
if (!req.isGranted('translations')) {
|
||||||
|
return res.status(401).json({error: 'Unauthorised'});
|
||||||
|
}
|
||||||
|
|
||||||
|
const contributors = [];
|
||||||
|
for (let {author_id, c} of await req.db.all(SQL`SELECT author_id, count(*) AS c FROM translations
|
||||||
|
WHERE locale = ${global.config.locale} AND status >= ${TRANSLATION_STATUS.APPROVED}
|
||||||
|
GROUP BY author_id
|
||||||
|
`)) {
|
||||||
|
const { username, roles } = await req.db.get(SQL`SELECT username, roles FROM users WHERE id=${author_id}`);
|
||||||
|
contributors.push({
|
||||||
|
username,
|
||||||
|
isMember: !!roles,
|
||||||
|
count: c,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.json(contributors);
|
||||||
|
}));
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user