Skip to content

Instantly share code, notes, and snippets.

@abloom
Created January 19, 2010 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save abloom/281240 to your computer and use it in GitHub Desktop.
Save abloom/281240 to your computer and use it in GitHub Desktop.
planBuildingViewsDidChange: function() {
var planBuildingViews = SC.A(this.get("planBuildingViews")),
showResearch = (planBuildingViews.indexOf("siteResearch") > -1),
showPlanning = (planBuildingViews.indexOf("planning") > -1),
splitView = Research.mainPage.planBuilding,
research = splitView.topLeftView,
planning = splitView.bottomRightView,
divider = splitView.dividerView,
dividerThickness = splitView.dividerThickness,
totalHeight = splitView.get("frame").height;
if (showPlanning && showResearch) {
var halfHeight = (totalHeight/2)-dividerThickness;
planning.adjust("height", halfHeight);
research.adjust("height", halfHeight);
planning.adjust("top", halfHeight+dividerThickness);
divider.adjust("top", halfHeight);
} else if(showResearch) {
planning.adjust("height", 0);
research.adjust("height", totalHeight - dividerThickness);
divider.adjust("top", totalHeight - dividerThickness);
} else if (showPlanning) {
research.adjust("height", 0);
planning.adjust("top", 0);
divider.adjust("top", 0);
}
}.observes(".planBuildingViews")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment