aboutsummaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2019-12-03 22:32:17 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-12-03 22:32:17 +0100
commit0de7e84380dff5222e6728aacbbb42abaac51dd9 (patch)
tree07eba3a6070f11fd966c9f257aa652b6f6242eed /app/views
parent68c006b7ad61d0730a3aa8f75c6232c00d0f14e1 (diff)
Upgrade user management page (#2417)
Before, the use of the user management page was a little bit tedious when there was many users. One must select a user to view some metrics, to update it, or to delete it. Now, the view is clearer because it shows all users at once with their metrics. I introduced a detail page that repeats the metrics but also allow to purge the user's feeds, to update or delete the user. This is the first step to make that page more useful and user-friendly. I have in mind to add a pager for when there is a lot of users, a metric to know when was the last time the user was using the application, and a flag to know if the user has admin rights. See #2096 and #2504 for ideas and inspiration
Diffstat (limited to 'app/views')
-rw-r--r--app/views/user/details.phtml51
-rw-r--r--app/views/user/manage.phtml85
2 files changed, 74 insertions, 62 deletions
diff --git a/app/views/user/details.phtml b/app/views/user/details.phtml
new file mode 100644
index 000000000..2e37be872
--- /dev/null
+++ b/app/views/user/details.phtml
@@ -0,0 +1,51 @@
+<?php $this->partial('aside_configure'); ?>
+
+<div class="post">
+ <a href="<?= _url('user', 'manage'); ?>"><?= _t('admin.user.back_to_manage'); ?></a>
+
+ <legend><?= $this->username; ?></legend>
+ <form method="post" action="<?= _url('user', 'manage', 'username', $this->username); ?>">
+ <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken(); ?>" />
+
+ <div class="form-group">
+ <label class="group-name"><?= _t('admin.user.feed_count') ?></label>
+ <div class="group-controls">
+ <?= format_number($this->details['feed_count']) ?>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name"><?= _t('admin.user.article_count') ?></label>
+ <div class="group-controls">
+ <?= format_number($this->details['article_count']) ?>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name"><?= _t('admin.user.database_size') ?></label>
+ <div class="group-controls">
+ <?= format_bytes($this->details['database_size']) ?>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name" for="newPasswordPlain"><?= _t('admin.user.password_form') ?></label>
+ <div class="group-controls">
+ <div class="stick">
+ <input type="password" id="newPasswordPlain" name="newPasswordPlain" autocomplete="new-password" pattern=".{7,}" <?= cryptAvailable() ? '' : 'disabled="disabled" ' ?>/>
+ <a class="btn toggle-password" data-toggle="password-<?= $this->username; ?>"><?= _i('key') ?></a>
+ </div>
+ <?= _i('help'); ?> <?= _t('admin.user.password_format') ?>
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <noscript><b><?= _t('gen.js.should_be_activated'); ?></b></noscript>
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important" name="action" value="update"><?= _t('gen.action.update') ?></button>
+ <button type="submit" class="btn btn-attention confirm" name="action" value="purge"><?= _t('gen.action.purge') ?></button>
+ <button type="submit" class="btn btn-attention confirm" name="action" value="delete"><?= _t('gen.action.remove') ?></button>
+ <div>
+ </div>
+ </form>
+</div>
diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml
index 93d1008b5..e5d5717fa 100644
--- a/app/views/user/manage.phtml
+++ b/app/views/user/manage.phtml
@@ -57,66 +57,27 @@
</div>
</form>
- <form method="post" action="<?= _url('user', 'update') ?>">
- <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
- <legend><?= _t('admin.user.update_users') ?></legend>
-
- <div class="form-group">
- <label class="group-name" for="current_user"><?= _t('admin.user.selected') ?></label>
- <div class="group-controls">
- <select id="current_user" name="username">
- <option selected="selected"> </option>
- <?php foreach (listUsers() as $username) { ?>
- <option value="<?= $username ?>"><?= $username ?></option>
- <?php } ?>
- </select>
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name" for="newPasswordPlain"><?= _t('admin.user.password_form') ?></label>
- <div class="group-controls">
- <div class="stick">
- <input type="password" id="newPasswordPlain" name="newPasswordPlain" autocomplete="new-password" pattern=".{7,}" <?= cryptAvailable() ? '' : 'disabled="disabled" ' ?>/>
- <a class="btn toggle-password" data-toggle="newPasswordPlain"><?= _i('key') ?></a>
- </div>
- <?= _i('help') ?> <?= _t('conf.profile.password_format') ?>
- <noscript><b><?= _t('gen.js.should_be_activated') ?></b></noscript>
- </div>
- </div>
-
- <div class="form-group form-actions">
- <div class="group-controls">
- <button type="submit" class="btn btn-important"><?= _t('gen.action.update') ?></button>
- <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
- </div>
- </div>
- </form>
-
- <form method="post" action="<?= _url('user', 'delete') ?>">
- <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
- <legend><?= _t('admin.user.delete_users') ?></legend>
-
- <div class="form-group">
- <label class="group-name" for="user-list"><?= _t('admin.user.selected') ?></label>
- <div class="group-controls">
- <select id="user-list" class="select-change" name="username">
- <option selected="selected"> </option>
- <?php foreach (listUsers() as $username) { ?>
- <option data-url="<?= _url('user', 'manage', 'u', $username) ?>" <?= $this->current_user === $username ? 'selected="selected"' : '' ?> value="<?= $username ?>"><?= $username ?></option>
- <?php } ?>
- </select>
-
- <p><?php echo _t('admin.user.articles_and_size',
- format_number($this->nb_articles),
- format_bytes($this->size_user)); ?></p>
- </div>
- </div>
-
- <div class="form-group form-actions">
- <div class="group-controls">
- <button type="submit" class="btn btn-attention confirm"><?= _t('gen.action.remove') ?></button>
- </div>
- </div>
- </form>
+ <legend><?= _t('admin.user.list'); ?></legend>
+ <table id="user-list">
+ <thead>
+ <tr>
+ <th><?= _t('admin.user.username') ?></th>
+ <th><?= _t('admin.user.feed_count') ?></th>
+ <th><?= _t('admin.user.article_count') ?></th>
+ <th><?= _t('admin.user.database_size') ?></th>
+ <th>&nbsp;</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($this->users as $username => $values) : ?>
+ <tr>
+ <td><?= $username ?></td>
+ <td><?= format_number($values['feed_count']) ?></td>
+ <td><?= format_number($values['article_count']) ?></td>
+ <td><?= format_bytes($values['database_size']) ?></td>
+ <td><a href="<?= _url('user', 'details', 'username', $username) ?>">Details</a></td>
+ </tr>
+ <?php endforeach ?>
+ </tbody>
+ </table>
</div>