Skip to content
Snippets Groups Projects
Commit 4902c174 authored by Fuentes Serna  Juan Mariano (ID SIS)'s avatar Fuentes Serna Juan Mariano (ID SIS)
Browse files

SSDM-6017 : Improved layout for storage manager grid

parent 74995379
No related branches found
No related tags found
No related merge requests found
...@@ -342,6 +342,18 @@ var LayoutManager = { ...@@ -342,6 +342,18 @@ var LayoutManager = {
this.isLoadingView === false && this.isLoadingView === false &&
this.firstColumn.width() > 0; this.firstColumn.width() > 0;
}, },
getContentWidth : function() {
var width = $( window ).width();
if (width > this.DESKTOP_SIZE) {
return this.secondColumn.width();
} else if (width > this.TABLET_SIZE) {
return this.secondColumn.width();
} else if (width > this.MOBILE_SIZE) {
return this.firstColumn.width();
} else {
alert("Layout manager unable to know the layout, this should never happen.");
}
},
reloadView : function(view, forceFirstTime) { reloadView : function(view, forceFirstTime) {
var _this = this; var _this = this;
this.isLoadingView = true; this.isLoadingView = true;
......
...@@ -39,9 +39,16 @@ function GridView(gridModel) { ...@@ -39,9 +39,16 @@ function GridView(gridModel) {
var $emptyCell = $("<th>"); var $emptyCell = $("<th>");
$headerRow.append($emptyCell); $headerRow.append($emptyCell);
var contentWidth = LayoutManager.getContentWidth();
var headerWidth = 24;
var minHeight = 32;
var cellWidth = contentWidth/parseInt(this._gridModel.numColumns) - headerWidth;
for(var j = 0; j < this._gridModel.numColumns; j++) { for(var j = 0; j < this._gridModel.numColumns; j++) {
var $numberCell = $("<th>").append(j+1); var $numberCell = $("<th>").append(j+1);
$numberCell.css('width', Math.floor(80/(this._gridModel.numColumns+1)) +'%'); $numberCell.css('width', cellWidth +'px');
$numberCell.css('text-align', 'center');
$numberCell.css('vertical-align', 'middle');
// $numberCell.css('padding', '0px'); // $numberCell.css('padding', '0px');
$headerRow.append($numberCell); $headerRow.append($numberCell);
} }
...@@ -50,13 +57,16 @@ function GridView(gridModel) { ...@@ -50,13 +57,16 @@ function GridView(gridModel) {
for(var i = 0; i < this._gridModel.numRows; i++) { for(var i = 0; i < this._gridModel.numRows; i++) {
var $newRow = $("<tr>"); var $newRow = $("<tr>");
$newRow.css('height', minHeight +'px');
var rowLabel = i+1; var rowLabel = i+1;
if(this._gridModel.useLettersOnRows) { if(this._gridModel.useLettersOnRows) {
rowLabel = Util.getLetterForNumber(rowLabel); rowLabel = Util.getLetterForNumber(rowLabel);
} }
var $numberCell = $("<th>").append(rowLabel); var $numberCell = $("<th>").append(rowLabel);
$numberCell.css('width', Math.floor(80/(this._gridModel.numColumns+1)) +'%'); $numberCell.css('width', headerWidth + 'px');
$numberCell.css('padding', '0px'); $numberCell.css('padding', '0px');
$numberCell.css('text-align', 'center');
$numberCell.css('vertical-align', 'middle');
$newRow.append($numberCell); $newRow.append($numberCell);
for(var j = 0; j < this._gridModel.numColumns; j++) { for(var j = 0; j < this._gridModel.numColumns; j++) {
...@@ -108,7 +118,8 @@ function GridView(gridModel) { ...@@ -108,7 +118,8 @@ function GridView(gridModel) {
} }
this._addLabels($newColumn, i + 1, j + 1); this._addLabels($newColumn, i + 1, j + 1);
$newColumn.css('width', Math.floor(80/(this._gridModel.numColumns+1)) +'%'); $newColumn.css('width', cellWidth +'px');
$newColumn.css('min-height', minHeight +'px');
$newColumn.css('padding', '0px'); $newColumn.css('padding', '0px');
$newColumn.css('overflow', 'hidden'); $newColumn.css('overflow', 'hidden');
$newRow.append($newColumn); $newRow.append($newColumn);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment