lemo-crm/web/app/services/message.js

32 lines
941 B
JavaScript

import Ember from 'ember';
import $ from 'jquery'
export default Ember.Service.extend({
alert(msg) {
this._show_alert_(msg);
},
warn(msg) {
this._show_alert_(msg, '#F6F0F0');
},
_show_alert_(msg, bg) {
$([
'<div style="position: absolute; left: 50%; top: -24px; z-index: 20480;">',
'<div style="position: relative; left: -50%; width: 320px; ">',
'<div style="border-radius: 8px; ',
'-moz-border-radius: 8px; border: 1px solid #ccc; ',
'margin-top: 2px; font-size: 14px; padding: 10px 15px; ',
'color: #555; background: ',
bg || '#F6F6F6',
';"><p>',
msg,
'</p>',
'</div></div></div>'
].join(''))
.prependTo($('body'))
.animate({'top': '12px' }, 'slow')
.fadeOut(2000, function() {
$(this).remove();
});
}
});