diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-06-08 18:13:35 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-06-08 18:13:35 +0200 |
| commit | 695d6c0f403f6970047c19c804e39391b9763271 (patch) | |
| tree | 2cba33588e42ec214b3d30b4825e36e7c4e47b40 /ishtar_common/static | |
| parent | 339df04ebd6047f1c41491db8c9e284afa43d2ad (diff) | |
| parent | 49c9f8e285a9d75e08207ee697a81ac09c88a947 (diff) | |
| download | Ishtar-695d6c0f403f6970047c19c804e39391b9763271.tar.bz2 Ishtar-695d6c0f403f6970047c19c804e39391b9763271.zip | |
Merge branch 'master-warehouse'
Diffstat (limited to 'ishtar_common/static')
| -rw-r--r-- | ishtar_common/static/js/grid.tbltogrid.js | 106 | ||||
| -rw-r--r-- | ishtar_common/static/media/style.css | 41 | ||||
| -rw-r--r-- | ishtar_common/static/media/style_basic.css | 4 |
3 files changed, 147 insertions, 4 deletions
diff --git a/ishtar_common/static/js/grid.tbltogrid.js b/ishtar_common/static/js/grid.tbltogrid.js new file mode 100644 index 000000000..addab1e48 --- /dev/null +++ b/ishtar_common/static/js/grid.tbltogrid.js @@ -0,0 +1,106 @@ +/* + Transform a table to a jqGrid. + Peter Romianowski <peter.romianowski@optivo.de> + If the first column of the table contains checkboxes or + radiobuttons then the jqGrid is made selectable. +*/ +// Addition - selector can be a class or id +function tableToGrid(selector, options) { +jQuery(selector).each(function() { + if(this.grid) {return;} //Adedd from Tony Tomov + // This is a small "hack" to make the width of the jqGrid 100% + jQuery(this).width("99%"); + var w = jQuery(this).width(); + + // Text whether we have single or multi select + var inputCheckbox = jQuery('tr td:first-child input[type=checkbox]:first', jQuery(this)); + var inputRadio = jQuery('tr td:first-child input[type=radio]:first', jQuery(this)); + var selectMultiple = inputCheckbox.length > 0; + var selectSingle = !selectMultiple && inputRadio.length > 0; + var selectable = selectMultiple || selectSingle; + //var inputName = inputCheckbox.attr("name") || inputRadio.attr("name"); + + // Build up the columnModel and the data + var colModel = []; + var colNames = []; + jQuery('th', jQuery(this)).each(function() { + if (colModel.length === 0 && selectable) { + colModel.push({ + name: '__selection__', + index: '__selection__', + width: 0, + hidden: true + }); + colNames.push('__selection__'); + } else { + colModel.push({ + name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'), + index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'), + width: jQuery(this).width() || 150 + }); + colNames.push(jQuery(this).html()); + } + }); + var data = []; + var rowIds = []; + var rowChecked = []; + jQuery('tbody > tr', jQuery(this)).each(function() { + var row = {}; + var rowPos = 0; + jQuery('td', jQuery(this)).each(function() { + if (rowPos === 0 && selectable) { + var input = jQuery('input', jQuery(this)); + var rowId = input.attr("value"); + rowIds.push(rowId || data.length); + if (input.is(":checked")) { + rowChecked.push(rowId); + } + row[colModel[rowPos].name] = input.attr("value"); + } else { + row[colModel[rowPos].name] = jQuery(this).html(); + } + rowPos++; + }); + if(rowPos >0) { data.push(row); } + }); + + // Clear the original HTML table + jQuery(this).empty(); + + // Mark it as jqGrid + jQuery(this).addClass("scroll"); + + jQuery(this).jqGrid(jQuery.extend({ + datatype: "local", + width: w, + colNames: colNames, + colModel: colModel, + multiselect: selectMultiple + //inputName: inputName, + //inputValueCol: imputName != null ? "__selection__" : null + }, options || {})); + + // Add data + var a; + for (a = 0; a < data.length; a++) { + var id = null; + if (rowIds.length > 0) { + id = rowIds[a]; + if (id && id.replace) { + // We have to do this since the value of a checkbox + // or radio button can be anything + id = encodeURIComponent(id).replace(/[.\-%]/g, "_"); + } + } + if (id === null) { + id = a + 1; + } + jQuery(this).jqGrid("addRowData",id, data[a]); + } + + // Set the selection + for (a = 0; a < rowChecked.length; a++) { + jQuery(this).jqGrid("setSelection",rowChecked[a]); + } +}); +}; diff --git a/ishtar_common/static/media/style.css b/ishtar_common/static/media/style.css index 1d47bcbd9..e74a6d205 100644 --- a/ishtar_common/static/media/style.css +++ b/ishtar_common/static/media/style.css @@ -45,7 +45,7 @@ a.add-button, color:#000; } -#context_menu .basket{ +#context_menu option.basket{ color:#000; font-weight: bold; font-style: italic; @@ -434,6 +434,11 @@ div#main_menu > ul > li{ } */ +div#welcome{ + text-align:left; + font-size: 1.2em; +} + div#content{ clear:both; margin-top:190px ; @@ -546,21 +551,20 @@ ul.form-flex { margin: 0; } - ul.form-flex li{ width: 395px; } @media screen and (min-width: 1051px) { div.form, - ul.form-flex { + ul.form-flex{ width: 800px; } } @media screen and (min-width: 1400px) { div.form, - ul.form-flex { + ul.form-flex{ width: 1200px; } } @@ -571,6 +575,10 @@ ul.form-flex label { padding-left: 10px; } +#window ul.form-flex label { + width: 150px; +} + .form table{ padding:0.2em; margin-left:auto; @@ -750,6 +758,10 @@ table.confirm tr.spacer td:last-child{ right:135px; } +a.photo{ + padding: 0.5em; +} + #global-vars textarea{ width:220px; } @@ -898,6 +910,22 @@ table.confirm tr.spacer td:last-child{ font-style:italic; } +#window table.simple td.item-list{ + text-align:left; +} + +table td.item-list span{ + padding: 4px 4px; + background-color: #eee; + margin: 0.2em; + line-height: 26px; + border-radius: 4px; +} + +#window table.simple td.item-list .display_details{ + vertical-align: middle; +} + #window .head{ text-align:center; background-color:#f1f2f6; @@ -946,6 +974,11 @@ table.confirm tr.spacer td:last-child{ width:465px; } +#window ul.form-flex span.value { + display: inline-table; + width: 230px; +} + .strong{ font-weight:bold; } diff --git a/ishtar_common/static/media/style_basic.css b/ishtar_common/static/media/style_basic.css index d624ae09c..1d92928dc 100644 --- a/ishtar_common/static/media/style_basic.css +++ b/ishtar_common/static/media/style_basic.css @@ -85,3 +85,7 @@ p{ width:100%; border-bottom:1px solid #922; } + +.display_details, .display_details_inline{ + display: none; +} |
