mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Take first non-empty link field for preview
Goes by priority, but allows for fields to be empty. This is important e.g. for models which are removed just from live, or just from draft. Also reacts to a field rename done in CMS module (62783c75).
This commit is contained in:
parent
f63893544e
commit
dc08e87bd5
@ -67,7 +67,10 @@
|
||||
if(this.is('.is-collapsed')) return;
|
||||
|
||||
// var url = ui.xmlhttp.getResponseHeader('x-frontend-url');
|
||||
var url = $('.cms-edit-form').find(':input[name=PreviewURL],:input[name=StageURLSegment]').val();
|
||||
var url = $('.cms-edit-form')
|
||||
.find(':input[name=PreviewURL],:input[name=StageLink],:input[name=LiveLink]')
|
||||
.filter(function() {return $(this).val() !== '';})
|
||||
.val();
|
||||
if(url) {
|
||||
this.loadUrl(url);
|
||||
this.unblock();
|
||||
@ -294,7 +297,11 @@
|
||||
onclick: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var preview = $('.cms-preview'), url = $('.cms-edit-form').find(':input[name=PreviewURL],:input[name=StageURLSegment]').val();
|
||||
var preview = $('.cms-preview'),
|
||||
url = $('.cms-edit-form')
|
||||
.find(':input[name=PreviewURL],:input[name=StageLink],:input[name=LiveLink]')
|
||||
.filter(function() {return $(this).val() !== '';})
|
||||
.val();
|
||||
if(url) {
|
||||
preview.loadUrl(url);
|
||||
preview.unblock();
|
||||
|
Loading…
Reference in New Issue
Block a user