From 7ab6b0b946f2d2e07ffe38defcb5fc2a885da37b Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 17 Sep 2020 13:33:20 +0800 Subject: [PATCH] Roo/bootstrap/Card.js --- Roo/bootstrap/Card.js | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/Roo/bootstrap/Card.js b/Roo/bootstrap/Card.js index a445de1dd2..ff2c42b3a1 100644 --- a/Roo/bootstrap/Card.js +++ b/Roo/bootstrap/Card.js @@ -9,7 +9,10 @@ * * * possible... may not be implemented.. - * @cfg {String} header content of header (for panel) + * @cfg {String} header_image + * @cfg {String|Object} header + * @cfg {String|Object} header_size (0|1|2|3|4|5) H1 or H2 etc.. 0 indicates default + * * @cfg {String|Object} title * @cfg {String|Object} subtitle * @cfg {String|Object} body @@ -56,6 +59,7 @@ Roo.bootstrap.Card = function(config){ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { + weight : '', margin: '', /// may be better in component? @@ -80,6 +84,11 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { display_lg: '', display_xl: '', + header_image : '', + header : '', + header_size : 0, + title : '', + html : '', layoutCls : function() { @@ -136,9 +145,9 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { getAutoCreate : function(){ var cfg = { - tag : this.tag || 'div', - html : '', - cls : 'card' + tag : 'div', + cls : 'card', + cn : [ ] }; if (this.weight.length && this.weight != 'light') { @@ -150,7 +159,22 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { cfg.cls += this.layoutCls(); - + if (this.header) { + cfg.cn.push({ + tag : 'div', + cls : 'card-header', + html : this.header // escape? + }); + } + if (this.header_image) { + cfg.cn.push({ + tag : 'img', + cls : 'card-img-top', + src: this.header_image // escape? + }); + } + + if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) { -- 2.39.2