From ccaa65b0e4c5112431449c920342f51a63c2df90 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 19 Mar 2012 21:06:02 +0000 Subject: [PATCH] Implement groupbox/caption with fieldset/legend --- etemplate/js/et2_widget_groupbox.js | 50 +++++++++++++++++++++++++++++ etemplate/js/etemplate2.js | 1 + 2 files changed, 51 insertions(+) create mode 100644 etemplate/js/et2_widget_groupbox.js diff --git a/etemplate/js/et2_widget_groupbox.js b/etemplate/js/et2_widget_groupbox.js new file mode 100644 index 0000000000..1b2794dade --- /dev/null +++ b/etemplate/js/et2_widget_groupbox.js @@ -0,0 +1,50 @@ +/** + * eGroupWare eTemplate2 - JS Groupbox object + * + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package etemplate + * @subpackage api + * @link http://www.egroupware.org + * @author Nathan Gray + * @copyright Nathan Gray 2012 + * @version $Id$ + */ + +"use strict"; + +/*egw:uses + et2_core_baseWidget; +*/ + +/** + * Class which implements the hrule tag + */ +var et2_groupbox = et2_baseWidget.extend({ + + init: function() { + this._super.apply(this, arguments); + + this.setDOMNode(document.createElement("fieldset")); + } +}); + +et2_register_widget(et2_groupbox, ["groupbox"]); + +var et2_groupbox_legend = et2_baseWidget.extend({ + attributes: { + "label": { + "name": "Label", + "type": "string", + "default": "", + "description": "Label for group box" + } + }, + + init: function() { + this._super.apply(this, arguments); + + var legend = jQuery(""+this.options.label+""); + this.setDOMNode(legend[0]); + } +}); +et2_register_widget(et2_groupbox_legend, ["caption"]); diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index 5bfee07244..5f6906e520 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -16,6 +16,7 @@ et2_widget_grid; et2_widget_box; et2_widget_hbox; + et2_widget_groupbox; et2_widget_button; et2_widget_description; et2_widget_textbox;