From c241f31d9afe807506c997de31912e726b753268 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Mon, 8 Dec 2014 11:46:42 -0800 Subject: [PATCH] fix selects not having default item set properly --- planetstack/core/xoslib/static/js/xoslib/xosHelper.js | 3 ++- planetstack/core/xoslib/templates/xosAdmin.html | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js index b0e2dee..497a418 100644 --- a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js +++ b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js @@ -121,11 +121,12 @@ XOSApplication = Marionette.Application.extend({ return function(parent_modelName, parent_fieldName, parent_id) { app.Router.showPreviousURL(); console.log("acs"); - console.log(modelName); + console.log(parent_modelName); console.log(parent_fieldName); console.log(parent_id); model = new xos[collection_name].model(); model.attributes[parent_fieldName] = parent_id; + console.log(model); detailViewClass = app[addChildName]; var detailView = new detailViewClass({model: model, collection:xos[collection_name]}); detailView.dialog = $("xos-addchild-dialog"); diff --git a/planetstack/core/xoslib/templates/xosAdmin.html b/planetstack/core/xoslib/templates/xosAdmin.html index 8ca18db..c113e04 100644 --- a/planetstack/core/xoslib/templates/xosAdmin.html +++ b/planetstack/core/xoslib/templates/xosAdmin.html @@ -89,7 +89,6 @@ @@ -108,7 +107,7 @@ <% _.each(addFields, function(fieldName) { %> <%= fieldNameToHumanReadable(fieldName) %>: <% if (fieldName in foreignFields) { %> - <%= idToSelect(fieldName, window[fieldName], foreignFields[fieldName], "humanReadableName") %> + <%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName") %> <% } else if (inputType[fieldName] == "checkbox") { %> > <% } else { %> @@ -128,7 +127,7 @@ <% console.log(model); _.each(detailFields, function(fieldName) { %> <%= fieldNameToHumanReadable(fieldName) %>: <% if (fieldName in foreignFields) { %> - <%= idToSelect(fieldName, window[fieldName], foreignFields[fieldName], "humanReadableName") %> + <%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName") %> <% } else if (inputType[fieldName] == "checkbox") { %> > <% } else { %> -- 2.43.0