/*
* Call it with level: success, info, warning, danger
*/
-function mysliceAlert(msg, level, timeout) {
+function mysliceAlert(msg, level, timeout, id) {
level = typeof level !== 'undefined' ? level : 'success';
timeout = typeof timeout !== 'undefined' ? timeout : false;
+ id = typeof id !== 'undefined' ? id : '';
+
+ // onelab.upmc.slice the dot is causing a pb in the jQuery selector, so replace it !
+ id = id.replace(/\./g,'');
+
var el = $('#myslice-message');
- el.find('.message').text(msg);
- el.addClass('alert-' + level);
+ el.append("<div id='msg-"+level+"-"+id+"'></div>");
+ var msg_div = $('#msg-'+level+'-'+id);
+ msg_div.addClass('alert alert-dismissable myslice-message');
+ msg_div.append("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>");
+ msg_div.append("<span class='glyphicon glyphicon-exclamation-sign'></span>");
+ msg_div.append("<span class='message'></span>");
+ msg_div.find('.message').html(msg);
+ msg_div.addClass('alert-' + level);
+ el.fadeIn('fast');
el.parent().fadeIn('fast');
if (timeout) {
- setTimeout(function(){el.alert('close');},5000);
+ setTimeout(function(){
+ el.hide();
+ msg_div.remove();
+ },5000);
}
};
/* Table initialisation */
$(document).ready(function() {
+ $('button[type=submit]').click(function() {
+ $('form').submit();
+ });
var platformParameters = {};
-
- $('#myslice-message').bind('closed.bs.alert', function () {
- $(this).parent().hide();
- });
//mysliceAlert('hello','danger');
-
$("#objectList").load("/table/resource/", {"fields" : ["hostname","hrn","country","type"], "options": ["checkbox"] }, function(data) {
$(this).dataTable( {
"sScrollY": window.innerHeight - 275,
var el = $('*[data-key="'+myslice.pending[i]+'"]');
el.addClass("active");
el.find('input[type=checkbox]').prop('checked', true);
+ /*
if (myslice.count() > 0) {
$('#badge-pending').text(myslice.count());
$('#badge-pending').show();
}
+ */
}
}
} );
row.removeClass("active");
myslice.del(id);
cnt = myslice.count();
+ /*
$('#badge-pending').text(cnt);
if (cnt <= 0) {
$('#badge-pending').hide();
- }
+ }*/
} else {
row.addClass("active");
myslice.add(id);
+ /*
cnt = myslice.count();
$('#badge-pending').text(cnt);
if (cnt > 0) {
$('#badge-pending').show();
- }
+ }*/
}
});
});