diff --git a/install/ui/associate.js b/install/ui/associate.js index cb741652f..eb4a5a056 100644 --- a/install/ui/associate.js +++ b/install/ui/associate.js @@ -717,6 +717,10 @@ IPA.association_facet = function (spec) { that.columns.put(column.name, column); }; + that.resize = function(){ + that.table.resize(); + }; + that.create_column = function(spec) { var column = IPA.column(spec); if (spec.link_entity){ @@ -769,7 +773,8 @@ IPA.association_facet = function (spec) { label: label, entity_name: that.entity_name, other_entity: that.other_entity, - page_length: that.page_length + page_length: that.page_length, + scrollable: true }); var columns = that.columns.values; diff --git a/install/ui/details.js b/install/ui/details.js index 80e7bd9e6..237de6024 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -382,7 +382,6 @@ IPA.details_facet = function(spec) { var section = sections[i]; that.toggle(section, true); } - return false; } }).appendTo(that.controls); @@ -401,7 +400,6 @@ IPA.details_facet = function(spec) { var section = sections[i]; that.toggle(section, false); } - return false; } }).appendTo(that.controls); @@ -447,8 +445,12 @@ IPA.details_facet = function(spec) { details.append('
'); } + + + that.resize(); }; + that.setup = function(container) { that.facet_setup(container); @@ -490,7 +492,7 @@ IPA.details_facet = function(spec) { var div = section.container; if (visible != div.is(":visible")) { - div.slideToggle(); + div.slideToggle('slow', that.resize); } }; diff --git a/install/ui/entity.js b/install/ui/entity.js index 030bcb016..5df56b1a6 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -130,6 +130,15 @@ IPA.facet = function (spec) { return $('.content', that.container); }; + that.resize = function(){ + var facet_content = $('.facet-content', that.container); + facet_content.css("height", 'auto'); + facet_content.css('overflow-y', 'auto'); + + var content_max_height = $(window).height() - + IPA.reserved_screen_size; + facet_content.css('height',content_max_height); + }; that.on_error = function(xhr, text_status, error_thrown) { if (that.entity.redirect_facet) { @@ -194,6 +203,10 @@ IPA.table_facet = function(spec) { return that; }; + that.resize = function(){ + that.table.resize(); + }; + var columns = spec.columns || []; for (var i=0; i').appendTo(tr); - if (that.scrollable && (i == columns.length-1)) { + if (that.scrollable ) { + var width; if (column.width) { - var width = parseInt( + width = parseInt( column.width.substring(0, column.width.length-2),10); width += 16; - th.css('width', width+'px'); + }else{ + /* don't use the checkbox column as part of the overall + calculation for column widths. It is so small + that it throws off the average. */ + width = (that.table.width() - IPA.checkbox_column_width) / + (columns.length); } + width += 'px'; + th.css('width', width); + column.width = width; } else { if (column.width) { th.css('width', column.width); @@ -1167,6 +1178,9 @@ IPA.table_widget = function (spec) { 'style': 'float: right;' }).appendTo(th); } + if (that.scrollable && !column.width){ + column.width = th.width() +'px'; + } } that.tbody = $('').appendTo(that.table); @@ -1178,7 +1192,7 @@ IPA.table_widget = function (spec) { that.row = $(''); var td = $('', { - 'style': 'width: 22px;' + 'style': 'width: '+ IPA.checkbox_column_width +'px;' }).appendTo(that.row); $('', { @@ -1268,6 +1282,7 @@ IPA.table_widget = function (spec) { name: 'total_pages' }).appendTo(that.pagination); } + that.resize(); }; that.select_changed = function(){ @@ -1282,6 +1297,16 @@ IPA.table_widget = function (spec) { that.tbody.empty(); }; + that.resize = function(){ + if (that.scrollable){ + that.tbody.attr('overflow-y', 'auto'); + that.tbody.height("auto"); + var table_max_height = $(window).height() - + IPA.reserved_screen_size; + that.tbody.height(table_max_height); + } + }; + that.load = function(result) { that.empty();