Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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 (62783c7).
  • Loading branch information...
commit dc08e87bd58ea430d8ac145fe4b610c741aca77f 1 parent f638935
Ingo Schommer chillu authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 admin/javascript/LeftAndMain.Preview.js
11 admin/javascript/LeftAndMain.Preview.js
View
@@ -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();
Please sign in to comment.
Something went wrong with that request. Please try again.