Worked around a problem where the property "main-view" could not be found by jquery, but the labeled div could be found.

This commit is contained in:
Wynne Crisman
2016-05-06 18:17:22 -07:00
parent b18604ab08
commit a4def1586a
2 changed files with 14 additions and 9 deletions

View File

@@ -38,10 +38,13 @@ FadeManager.prototype.fadeOut = function(elements) {
} }
} }
function LayoutManager(viewName) { /**
* Note: Used to pass viewName - now passes view (a JQuery object containing the view div.)
*/
function LayoutManager(view) {
//PRIVATE MEMBERS //PRIVATE MEMBERS
var _this = this; var _this = this;
var view = $('[bs-view="' + viewName + '"]'); //var view = $('[bs-view="' + viewName + '"]');
var lastUrl = null; var lastUrl = null;
var oldContainer = null; var oldContainer = null;
var container = null; var container = null;
@@ -94,7 +97,8 @@ function LayoutManager(viewName) {
} }
else { else {
view = null; view = null;
throw "view with name: '" + viewName + "' not found"; //throw "view with name: '" + viewName + "' not found";
throw "View does not exist!";
} }
//PRIVILEGED METHODS (public with private access) //PRIVILEGED METHODS (public with private access)

View File

@@ -9,16 +9,17 @@ window.status="";
//Handle the document ready event which is where any initialization code goes. //Handle the document ready event which is where any initialization code goes.
$(document).ready(function($) { $(document).ready(function($) {
var content = $('#content'); var content = $('#content');
var viewName = "main-view"; //var viewName = "main-view";
var view = $('[bs-view="' + viewName + '"]'); //var view = $('[bs-view="' + viewName + '"]');
if(!content || content.length != 1) { if(!content || content.length != 1) {
throw "Content div not found"; throw "Content div not found";
} }
else if(!view || view.length != 1) { //else if(!view || view.length != 1) {
throw "View with name: '" + viewName + "' not found"; // throw "View with name: '" + viewName + "' not found";
} //}
else { else {
var layoutManager = new LayoutManager("main-view"); //var layoutManager = new LayoutManager("main-view");
var layoutManager = new LayoutManager(view);
//layoutManager.defaultUrl = '#!/holidays'; //layoutManager.defaultUrl = '#!/holidays';
layoutManager.defaultUrl = '#!/Farm'; layoutManager.defaultUrl = '#!/Farm';