Adds better error handling to missing grid editors

This commit is contained in:
Per Ploug
2015-03-18 11:45:22 +01:00
parent c2cfd26ee6
commit 3a9ad91f8f
2 changed files with 21 additions and 6 deletions

View File

@@ -0,0 +1,2 @@
<p class="red">Something went wrong with this editor, below is the data stored:</p>
<pre>{{control | json}}</pre>

View File

@@ -572,18 +572,31 @@ angular.module("umbraco")
control.$index = index;
control.$uniqueId = $scope.setUniqueId();
//error handling in case of missing editor..
//should only happen if stripped earlier
if(!control.editor){
control.$editorPath = "views/propertyeditors/grid/editors/error.html";
}
if(!control.$editorPath){
var editorConfig = $scope.getEditor(control.editor.alias);
control.editor = editorConfig;
//if its a path
if(_.indexOf(control.editor.view, "/") >= 0){
control.$editorPath = control.editor.view;
if(editorConfig){
control.editor = editorConfig;
//if its a path
if(_.indexOf(control.editor.view, "/") >= 0){
control.$editorPath = control.editor.view;
}else{
//use convention
control.$editorPath = "views/propertyeditors/grid/editors/" + control.editor.view + ".html";
}
}else{
//use convention
control.$editorPath = "views/propertyeditors/grid/editors/" + control.editor.view + ".html";
control.$editorPath = "views/propertyeditors/grid/editors/error.html";
}
}
};