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:
Ingo Schommer 2012-08-27 18:22:33 +02:00
parent f63893544e
commit dc08e87bd5

View File

@ -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();