mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[enh] #28 Show a notification to the admin when there are no user created on the server.
This commit is contained in:
parent
6d9592541f
commit
02f7bad25e
2 changed files with 20 additions and 3 deletions
15
js/app.js
15
js/app.js
|
@ -63,7 +63,7 @@ app = Sammy('#main', function (sam) {
|
||||||
// Flash helper to diplay instant notifications
|
// Flash helper to diplay instant notifications
|
||||||
flash: function (level, message) {
|
flash: function (level, message) {
|
||||||
flashs = store.get('flash');
|
flashs = store.get('flash');
|
||||||
if (!flashs) { flashs = {'info': [], 'fail': [], 'success': [] } }
|
if (!flashs) { flashs = {'info': [], 'fail': [], 'warning': [], 'success': [] } }
|
||||||
flashs[level].push(message);
|
flashs[level].push(message);
|
||||||
store.set('flash', flashs);
|
store.set('flash', flashs);
|
||||||
|
|
||||||
|
@ -275,7 +275,8 @@ app = Sammy('#main', function (sam) {
|
||||||
|
|
||||||
// Show development note
|
// Show development note
|
||||||
c.flash('info', '<b>You are using a development version.</b><br />' +
|
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
|
// Available sections
|
||||||
data = {links: [
|
data = {links: [
|
||||||
|
@ -288,7 +289,15 @@ app = Sammy('#main', function (sam) {
|
||||||
{name: "Backup", path: '#/backup'},
|
{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) {
|
sam.get('#/login', function (c) {
|
||||||
|
|
|
@ -20,4 +20,12 @@
|
||||||
<p class="list-group-item-text">{{Mail}}</p>
|
<p class="list-group-item-text">{{Mail}}</p>
|
||||||
</a>
|
</a>
|
||||||
{{/Users}}
|
{{/Users}}
|
||||||
|
|
||||||
|
{{^Users}}
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
<span class="fa-exclamation-triangle"></span>
|
||||||
|
No users.
|
||||||
|
</div>
|
||||||
|
{{/Users}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue