Skip to content

Commit

Permalink
LSNBLDR-605; fix column height adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
clhedrick committed Apr 7, 2016
1 parent c4177ce commit 5330444
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 10 additions & 2 deletions lessonbuilder/tool/src/webapp/js/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var noEditor = true;
var userAgent = navigator.userAgent;
var fckEditor = false;
var ckEditor = false;
var commentsToLoad = 0;

$(function() {

Expand Down Expand Up @@ -45,6 +46,7 @@ $(function() {
cache: false
});

commentsToLoad = $(".replaceWithComments").size();
$(".replaceWithComments").each(function(index) {
var pageToRequest = $(this).parent().parent().children(".commentsBlock").attr("href");
// remove pda/SITEID/. We don't want the portal to hack on this
Expand Down Expand Up @@ -80,7 +82,13 @@ $(function() {
});
});

/* only do this once if there is more than one comment block */
function commentsLoaded() {
if (commentsToLoad > 1) {
commentsToLoad--;
return;
}
fixupHeights();
setMainFrameHeight(window.name);

$(".pointsBox").unbind("keyup");
Expand Down Expand Up @@ -122,9 +130,9 @@ function loadMore(link) {
var i = pageToRequest.indexOf("Comment");
pageToRequest = "/lessonbuilder-tool/faces/" + pageToRequest.substring(i);

commentsToLoad = $(link).parents(".replaceWithComments").size();
$(link).parents(".replaceWithComments").load(pageToRequest, commentsLoaded);

setMainFrameHeight(window.name);

}

function performHighlight() {
Expand Down
11 changes: 9 additions & 2 deletions lessonbuilder/tool/src/webapp/js/show-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var delete_orphan_enabled = true;

$(window).load(function () {
window.onbeforeunload = null;
fixupHeights();
});

function msg(s) {
Expand Down Expand Up @@ -2963,9 +2964,15 @@ function fixupColAttrs() {
});
};

$(window).load(fixupHeights);

// called twice, once at page load, once after all comments are loaded.
// depending upon content one or the other may be first, so there's no way to
// be sure without doing it both times
function fixupHeights() {
// if CSS is going to treat this as narrow device, don't need to match columns,
// because they are stacked vertically
if (window.matchMedia("only screen and (max-width: 800px)").matches) {
return;
}
$(".section").each(function(index) {
var max = 0;
// reset to auto to cause recomputation. This is needed because
Expand Down

0 comments on commit 5330444

Please sign in to comment.