in xf/ui/xf.ui.popup.js [57:127]
createDialog : function (headerText, messageText, buttons) {
buttons = buttons || [];
/*
<div class="xf-dialog-box">
<div class="xf-dialog-box-header">
<h3>Impossible! <!-- Header text here --> </h3>
</div>
<div class="xf-dialog-box-content">
<!-- Message text here -->
You’re the smartest guy I've ever known.
</div>
<div class="xf-dialog-box-footer clearfix">
<!-- Buttons here -->
<div class="xf-grid-unit xf-grid-unit-1of2">
<button class="xf-button xf-button-small">
<span class="xf-button-text">Cancel</span>
</button>
</div>
<div class="xf-grid-unit xf-grid-unit-1of2">
<button class="xf-button xf-button-small xf-button-special">
<span class="xf-button-text">OK</span>
</button>
</div>
</div>
</div>
*/
var jqDialog = this.render(),
_template = _.template(
'<div class="xf-dialog-box"><div class="xf-dialog-box-header"><h3><%= headerText %></h3></div>' +
'<div class="xf-dialog-box-content"><%= messageText %></div>' +
'<div class="xf-dialog-box-footer clearfix"></div></div>'
);
jqDialog.find('.xf-dialog-content').html(_template({headerText : headerText, messageText : messageText}));
var jqBtnContainer = jqDialog.find('.xf-dialog-box-footer');
if (buttons.length < 1) {
buttons.push({
text: 'OK',
handler: function (){
XF.UI.popup.hide(jqDialog);
}
});
}
if (buttons.length > 0) {
var jqBtn,
btnCount = buttons.length;
_.each(buttons, function (btn, index, buttons){
if (btn instanceof $){
jqBtn = btn;
} else {
console.log('BUTTON');
console.log(btn);
jqBtn = XF.ui.popup.createButton(btn);
}
jqBtnContainer.append(
$('<div></div>')
.addClass('xf-grid-unit xf-grid-unit-1of' + btnCount)
.append(jqBtn)
);
});
}
this.dialog = jqDialog;
XF.trigger('ui:enhance', jqDialog);
return jqDialog;
},