[enh] #28 Show a notification to the admin when there are no user created on the server.

This commit is contained in:
opi 2014-05-08 14:13:23 +02:00
parent 6d9592541f
commit 02f7bad25e
2 changed files with 20 additions and 3 deletions

View file

@ -63,7 +63,7 @@ app = Sammy('#main', function (sam) {
// Flash helper to diplay instant notifications
flash: function (level, message) {
flashs = store.get('flash');
if (!flashs) { flashs = {'info': [], 'fail': [], 'success': [] } }
if (!flashs) { flashs = {'info': [], 'fail': [], 'warning': [], 'success': [] } }
flashs[level].push(message);
store.set('flash', flashs);
@ -275,7 +275,8 @@ app = Sammy('#main', function (sam) {
// Show development note
c.flash('info', '<b>You are using a development version.</b><br />' +
'Please note that you can use the <a href="https://doc.yunohost.org/#/moulinette" target="_blank">moulinette</a> if you want to access to more YunoHost\'s features.');
'Please note that you can use the <a href="https://doc.yunohost.org/#/moulinette" target="_blank" class="alert-link">moulinette</a> if you want to access to more YunoHost\'s features.');
// Available sections
data = {links: [
@ -288,7 +289,15 @@ app = Sammy('#main', function (sam) {
{name: "Backup", path: '#/backup'},
]};
c.view('home', data);
c.api('/users', function(data2) {
// Warn admin if no users are created.
if (data2.Users.length == 0) {
c.flash('warning', "You probably need to <a href='#/users/create' class='alert-link'>create a user</a> first.");
}
c.view('home', data);
});
});
sam.get('#/login', function (c) {

View file

@ -20,4 +20,12 @@
<p class="list-group-item-text">{{Mail}}</p>
</a>
{{/Users}}
{{^Users}}
<div class="alert alert-warning">
<span class="fa-exclamation-triangle"></span>
No users.
</div>
{{/Users}}
</div>