cartodb-4.42/lib/assets/javascripts/builder/components/infobox/infobox-factory.js

52 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-04-06 13:25:13 +08:00
var InfoboxView = require('./infobox-item-view');
module.exports = {
// Infobox with no buttons, only message
createInfo: function (opts) {
var closable = opts.closable === undefined ? true : opts.closable;
return new InfoboxView({
type: opts.type || 'default',
title: opts.title,
body: opts.body,
closable: closable
});
},
createWithAction: function (opts) {
var closable = opts.closable === undefined ? true : opts.closable;
var options = {
type: opts.type || 'default',
title: opts.title,
body: opts.body,
closable: closable,
klass: opts.className
};
if (opts.action) {
options.action = {
label: opts.action.label,
type: opts.action.type
};
}
return new InfoboxView(options);
},
createLoading: function (opts) {
return new InfoboxView({
type: opts.type || 'default',
title: opts.title || '',
body: opts.body,
loading: true
});
},
createQuota: function (opts) {
if (opts.closable === undefined) {
opts.closable = true;
}
return new InfoboxView(opts);
}
};