Skip to content

Commit

Permalink
Show proper error message when trying to view a non-existent version [#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-H committed Aug 22, 2019
1 parent 5de9845 commit fced45c
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion assets/components/versionx/js/mgr/action.chunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ VersionX.page.Chunk = function(config) {
cls: 'modx-page-header',
border: false
},{
xtype: 'versionx-panel-chunksdetail',
xtype: !VersionX.record ? 'versionx-panel-notfound' : 'versionx-panel-chunksdetail',
cls: 'x-panel-body',
vxRecord: VersionX.record,
vxRecordCmp: VersionX.cmrecord,
Expand Down
2 changes: 1 addition & 1 deletion assets/components/versionx/js/mgr/action.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ VersionX.page.Plugin = function(config) {
cls: 'modx-page-header',
border: false
},{
xtype: 'versionx-panel-pluginsdetail',
xtype: !VersionX.record ? 'versionx-panel-notfound' : 'versionx-panel-pluginsdetail',
cls: 'x-panel-body',
vxRecord: VersionX.record,
vxRecordCmp: VersionX.cmrecord,
Expand Down
2 changes: 1 addition & 1 deletion assets/components/versionx/js/mgr/action.resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ VersionX.page.Resource = function(config) {
bodyStyle: 'margin: 20px 0 0 0;',
border: false
},{
xtype: 'versionx-panel-resourcesdetail',
xtype: !VersionX.record ? 'versionx-panel-notfound' : 'versionx-panel-resourcesdetail',
cls: 'x-panel-body',
vxRecord: VersionX.record,
vxRecordCmp: VersionX.cmrecord,
Expand Down
2 changes: 1 addition & 1 deletion assets/components/versionx/js/mgr/action.snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ VersionX.page.Snippet = function(config) {
cls: 'modx-page-header',
border: false
},{
xtype: 'versionx-panel-snippetsdetail',
xtype: !VersionX.record ? 'versionx-panel-notfound' : 'versionx-panel-snippetsdetail',
cls: 'x-panel-body',
vxRecord: VersionX.record,
vxRecordCmp: VersionX.cmrecord,
Expand Down
2 changes: 1 addition & 1 deletion assets/components/versionx/js/mgr/action.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ VersionX.page.Template = function(config) {
cls: 'modx-page-header',
border: false
},{
xtype: 'versionx-panel-templatesdetail',
xtype: !VersionX.record ? 'versionx-panel-notfound' : 'versionx-panel-templatesdetail',
cls: 'x-panel-body',
vxRecord: VersionX.record,
vxRecordCmp: VersionX.cmrecord,
Expand Down
2 changes: 1 addition & 1 deletion assets/components/versionx/js/mgr/action.templatevar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ VersionX.page.Template = function(config) {
cls: 'modx-page-header',
border: false
},{
xtype: 'versionx-panel-templatevarsdetail',
xtype: !VersionX.record ? 'versionx-panel-notfound' : 'versionx-panel-templatevarsdetail',
cls: 'x-panel-body',
vxRecord: VersionX.record,
vxRecordCmp: VersionX.cmrecord,
Expand Down
13 changes: 13 additions & 0 deletions assets/components/versionx/js/mgr/common/panel.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,16 @@ VersionX.panel.Common.DetailPanel = function(config) {
};
Ext.extend(VersionX.panel.Common.DetailPanel,MODx.Panel,{});
Ext.reg('versionx-panel-common-detailpanel',VersionX.panel.Common.DetailPanel);

VersionX.panel.Common.NotFound = function(config) {
config = config || {};
Ext.apply(config,{
items: [{
xtype: 'panel',
html: '<div class="vx-error-panel"><p>The requested version does not exist.</p></div>'
}]
});
VersionX.panel.Common.NotFound.superclass.constructor.call(this,config);
};
Ext.extend(VersionX.panel.Common.NotFound,MODx.Panel,{});
Ext.reg('versionx-panel-notfound',VersionX.panel.Common.NotFound);
7 changes: 7 additions & 0 deletions core/components/versionx/controllers/base.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public function initialize()
color: #750300;
font-weight: bold !important;
}
.vx-error-panel {
background: #ffdbdb;
padding: 1em;
border: 1px solid #830000;
border-radius: 3px;
color: #5a2a2a;
}
</style>');

$this->addJavascript($this->versionx->config['js_url'].'mgr/versionx.class.js');
Expand Down
1 change: 1 addition & 0 deletions core/components/versionx/docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This changelog shows an overview of what changed throughout VersionX releases, w
++ Released on 2019-08-22 ++
++++++++++++++++++++++++++++++++
- Hide users dropdown if user lacks view_user permission [#96]
- Show proper error message when trying to view a non-existent version [#106]

++++++++++++++++++++++++++++++++
++ VersionX 2.2.1-pl ++
Expand Down

0 comments on commit fced45c

Please sign in to comment.