Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display users in table in Admin Settings #149

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ Hi, I'm Wingy. I made this app. My website is [samwing.dev](https://samwing.dev)
<table>
<tr>
<td align="center">
<a href="https://github.com/Wingysam">
<img src="https://avatars.githubusercontent.com/u/18403742?v=4" width="100;" alt="Wingysam"/>
<a href="https://github.com/cj13579">
<img src="https://avatars.githubusercontent.com/u/1965454?v=4" width="100;" alt="cj13579"/>
<br />
<sub><b>Wingysam</b></sub>
<sub><b>cj13579</b></sub>
</a>
</td></tr>
</table>
Expand Down
4 changes: 4 additions & 0 deletions src/languages/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export const strings = {
ADMIN_SETTINGS_USERS_EDIT: 'Edit',
ADMIN_SETTINGS_USERS_HEADER: 'Users',
ADMIN_SETTINGS_VERSION_INFO: 'Version Info',
ADMIN_SETTINGS_TABLE_USERNAME: 'Username',
ADMIN_SETTINGS_TABLE_ADMIN_USER: 'Admin',
ADMIN_SETTINGS_TABLE_WISHLIST_COUNT: 'Wishlist items',
ADMIN_SETTINGS_TABLE_EDIT: 'Edit',
ADMIN_USER_EDIT_ACCOUNT_UNCONFIRMED: "This account hasn't been confirmed.",
ADMIN_USER_EDIT_ADMIN_ISADMIN: name => `${name} is an admin.`,
ADMIN_USER_EDIT_ADMIN_NOTADMIN: name => `${name} is not an admin.`,
Expand Down
25 changes: 18 additions & 7 deletions src/views/adminSettings.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@ extends layout.pug

block content
h2= lang('ADMIN_SETTINGS_USERS_HEADER')
each user in users
span.is-size-6.inline= user.id
a(href=`${_CC.config.base}admin-settings/edit/${user.id}`)
span.is-size-7.icon.has-text-info
i.fas.fa-edit
span.is-sr-only
= lang('ADMIN_SETTINGS_USERS_EDIT')
table.table
thead
th=lang('ADMIN_SETTINGS_TABLE_USERNAME')
th=lang('ADMIN_SETTINGS_TABLE_ADMIN_USER')
th=lang('ADMIN_SETTINGS_TABLE_WISHLIST_COUNT')
th=lang('ADMIN_SETTINGS_TABLE_EDIT')
tbody
each user in users
tr(id=user.id)
td=user.id
td=user.doc.admin
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like this to use the localized equivalent of yes or no rather than true/false. Something like:

= user.doc.admin ? lang('YES') : lang('NO')

Other than that this looks great! It's a lot more intuitive, thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, makes sense. Done in cc185ca

image

td=Object.keys(user.doc.wishlist).length
td
a(href=`${_CC.config.base}admin-settings/edit/${user.id}`)
span.is-size-7.icon.has-text-info
i.fas.fa-edit
span.is-sr-only
= lang('ADMIN_SETTINGS_USERS_EDIT')
br
h3= lang('ADMIN_SETTINGS_USERS_ADD_HEADER')
form(action=`${_CC.config.base}admin-settings/add`, method='POST')
Expand Down