mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
Add admin field application
This commit is contained in:

committed by
Romain Neutron

parent
7199d38ab3
commit
05dc3659af
36
www/scripts/apps/admin/fields/views/alert.js
Normal file
36
www/scripts/apps/admin/fields/views/alert.js
Normal file
@@ -0,0 +1,36 @@
|
||||
define([
|
||||
'underscore',
|
||||
'backbone',
|
||||
'i18n',
|
||||
'bootstrap'
|
||||
], function(_, Backbone, i18n, bootstrap) {
|
||||
var AlertView = Backbone.View.extend({
|
||||
tagName: "div",
|
||||
className: "alert",
|
||||
initialize: function(options) {
|
||||
var self = this;
|
||||
|
||||
if (options) {
|
||||
this.alert = options.alert || "info";
|
||||
this.message = options.message || "";
|
||||
}
|
||||
// remove view when alert is closed
|
||||
this.$el.bind('closed', function () {
|
||||
self.remove();
|
||||
});
|
||||
},
|
||||
render: function() {
|
||||
var template = _.template($("#alert_template").html(), {
|
||||
msg: this.message
|
||||
});
|
||||
|
||||
this.$el.addClass("alert-" + this.alert).html(template).alert();
|
||||
|
||||
$('.block-alert').empty().append(this.$el);
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
return AlertView;
|
||||
});
|
Reference in New Issue
Block a user