Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Related to [#2638], prevent a JS error if the previous node doesn't e…

…xist (e.g. on element create)
  • Loading branch information...
commit 9a1ff1bff9f1dd824bcefa2255c1079abfecda19 1 parent 1a92f53
@garryn garryn authored
View
5 manager/assets/modext/widgets/element/modx.panel.chunk.js
@@ -158,8 +158,9 @@ Ext.extend(MODx.panel.Chunk,MODx.FormPanel,{
var n = c !== '' && c !== null && c != 0 ? 'n_chunk_category_'+c : 'n_type_chunk';
var t = Ext.getCmp('modx-element-tree');
if (t) {
- t.getNodeById('n_chunk_element_' + Ext.getCmp('modx-chunk-id').getValue() + '_' + r.result.object.previous_category).destroy();
- t.refreshNode(n,true);
+ var node = t.getNodeById('n_chunk_element_' + Ext.getCmp('modx-chunk-id').getValue() + '_' + r.result.object.previous_category);
+ if (node) node.destroy();
+ t.refreshNode(n,true);
}
}
View
3  manager/assets/modext/widgets/element/modx.panel.plugin.js
@@ -184,7 +184,8 @@ Ext.extend(MODx.panel.Plugin,MODx.FormPanel,{
if (t) {
var c = Ext.getCmp('modx-plugin-category').getValue();
var u = c != '' && c != null && c != 0 ? 'n_plugin_category_'+c : 'n_type_plugin';
- t.getNodeById('n_plugin_element_' + Ext.getCmp('modx-plugin-id').getValue() + '_' + o.result.object.previous_category).destroy();
+ var node = t.getNodeById('n_plugin_element_' + Ext.getCmp('modx-plugin-id').getValue() + '_' + o.result.object.previous_category);
+ if (node) node.destroy();
t.refreshNode(u,true);
}
}
View
3  manager/assets/modext/widgets/element/modx.panel.snippet.js
@@ -156,7 +156,8 @@ Ext.extend(MODx.panel.Snippet,MODx.FormPanel,{
if (t) {
var c = Ext.getCmp('modx-snippet-category').getValue();
var u = c != '' && c != null && c != 0 ? 'n_snippet_category_'+c : 'n_type_snippet';
- t.getNodeById('n_snippet_element_' + Ext.getCmp('modx-snippet-id').getValue() + '_' + r.result.object.previous_category).destroy();
+ var node = t.getNodeById('n_snippet_element_' + Ext.getCmp('modx-snippet-id').getValue() + '_' + r.result.object.previous_category);
+ if (node) node.destroy();
t.refreshNode(u,true);
}
}
View
3  manager/assets/modext/widgets/element/modx.panel.template.js
@@ -182,7 +182,8 @@ Ext.extend(MODx.panel.Template,MODx.FormPanel,{
if (t) {
var c = Ext.getCmp('modx-template-category').getValue();
var u = c != '' && c != null && c != 0 ? 'n_template_category_'+c : 'n_type_template';
- t.getNodeById('n_template_element_' + Ext.getCmp('modx-template-id').getValue() + '_' + r.result.object.previous_category).destroy();
+ var node = t.getNodeById('n_template_element_' + Ext.getCmp('modx-template-id').getValue() + '_' + r.result.object.previous_category);
+ if (node) node.destroy();
t.refreshNode(u,true);
}
}
View
3  manager/assets/modext/widgets/element/modx.panel.tv.js
@@ -228,7 +228,8 @@ Ext.extend(MODx.panel.TV,MODx.FormPanel,{
if (t) {
var c = Ext.getCmp('modx-tv-category').getValue();
var u = c != '' && c != null && c != 0 ? 'n_tv_category_'+c : 'n_type_tv';
- t.getNodeById('n_tv_element_' + Ext.getCmp('modx-tv-id').getValue() + '_' + r.result.object.previous_category).destroy();
+ var node = t.getNodeById('n_tv_element_' + Ext.getCmp('modx-tv-id').getValue() + '_' + r.result.object.previous_category);
+ if (node) node.destroy();
t.refreshNode(u,true);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.