Merge pull request #4 from jeromelebleu/master

Show development note on home page
This commit is contained in:
Alexis Gavoty 2013-12-19 08:34:33 -08:00
commit 7c520dc0c1
2 changed files with 10 additions and 9 deletions

View file

@ -19,7 +19,7 @@
<div class="clearfix"></div>
<br />
</div>
<div id="flash" class="alert" style="display: none">
<div id="flash" style="display: none">
</div>
<div id="slider-container">
<div id="slideBack" class="block" style="display: none;"></div>

View file

@ -47,14 +47,12 @@ app = Sammy('#main', function (sam) {
html = '';
for(lvl in flashs) {
flashs[lvl].forEach( function(msg) {
html += '<div class="'+ lvl +'">'+ msg +'</div>';
if (lvl == 'fail') { alertClass = 'alert-danger'; }
else { alertClass = 'alert-'+ lvl; }
html += '<div class="alert '+ alertClass +'">'+ msg +'</div>';
});
}
if (level == 'fail') { alertClass = 'alert-danger'; }
else if (level == 'success') { alertClass = 'alert-success'; }
else { alertClass = 'alert-info'; }
$('#flash').removeClass().addClass('alert '+ alertClass).html(html).fadeIn();
$('#flash').html(html).fadeIn();
},
// API connection helper
@ -233,6 +231,9 @@ app = Sammy('#main', function (sam) {
*
*/
sam.get('#/', function (c) {
// 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.');
c.view('home');
});
@ -265,7 +266,7 @@ app = Sammy('#main', function (sam) {
store.set('user', 'admin');
store.set('password', btoa(c.params['password']));
c.api('/api', function(data) {
if (data.apiVersion == '0.1') {
if (data.apiVersion) {
c.api('/users', function(data) {
store.set('connected', true);
$('#logout-button').fadeIn();
@ -277,7 +278,7 @@ app = Sammy('#main', function (sam) {
}
});
} else {
c.flash('fail', 'Non-compatible API (0.1 required)');
c.flash('fail', 'Non-compatible API');
c.redirect('#/login');
}
});