detailShower: function(detailName, collection_name, regionName, title) {\r
var app=this;\r
showModelId = function(model_id) {\r
- showModel = function(model) {\r
- detailViewClass = app[detailName];\r
- detailView = new detailViewClass({model: model});\r
- app[regionName].show(detailView);\r
- detailView.showLinkedItems();\r
- $("#xos-detail-button-box").show();\r
- $("#xos-listview-button-box").hide();\r
- }\r
-\r
$("#contentTitle").html(templateFromId("#xos-title-detail")({"title": title}));\r
\r
collection = xos[collection_name];\r
model = collection.get(model_id);\r
if (model == undefined) {\r
- if (!collection.isLoaded) {\r
- // If the model cannot be found, then maybe it's because\r
- // we haven't finished loading the collection yet. So wait for\r
- // the sort event to complete, then try again.\r
- collection.once("sort", function() {\r
- collection = xos[collection_name];\r
- model = collection.get(model_id);\r
- if (model == undefined) {\r
- // We tried. It's not here. Complain to the user.\r
- app[regionName].show(new HTMLView({html: "failed to load object " + model_id + " from collection " + collection_name}));\r
- } else {\r
- showModel(model);\r
- }\r
- });\r
- } else {\r
- // The collection was loaded, the user must just be asking for something we don't have.\r
- app[regionName].show(new HTMLView({html: "failed to load object " + model_id + " from collection " + collection_name}));\r
- }\r
+ app[regionName].show(new HTMLView({html: "failed to load object " + model_id + " from collection " + collection_name}));\r
} else {\r
- showModel(model);\r
+ detailViewClass = app[detailName];\r
+ detailView = new detailViewClass({model: model});\r
+ app[regionName].show(detailView);\r
+ detailView.showLinkedItems();\r
+ $("#xos-detail-button-box").show();\r
+ $("#xos-listview-button-box").hide();\r
}\r
}\r
return showModelId;\r