mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge branch '5.0' into 5
This commit is contained in:
commit
c7db5e25a9
2
client/dist/js/SilverStripeNavigator.js
vendored
2
client/dist/js/SilverStripeNavigator.js
vendored
@ -1 +1 @@
|
||||
!function(){"use strict";var e,t,i={311:function(e){e.exports=jQuery}},r={};function n(e){var t=r[e];if(void 0!==t)return t.exports;var o=r[e]={exports:{}};return i[e](o,o.exports,n),o.exports}(0,(t=(e=n(311))&&e.__esModule?e:{default:e}).default)(document).ready((function(){(0,t.default)("#switchView a.newWindow").on("click",(function(e){var t;return window.open(this.href,(t=this.target,document.getElementsByTagName("base")[0].href.replace("http://","").replace(/\//g,"_").replace(/\./g,"_")+t)).focus(),!1})),(0,t.default)("#SilverStripeNavigatorLink").on("click",(function(e){return(0,t.default)("#SilverStripeNavigatorLinkPopup").toggle(),!1})),(0,t.default)("#SilverStripeNavigatorLinkPopup a.close").on("click",(function(e){return(0,t.default)("#SilverStripeNavigatorLinkPopup").hide(),!1})),(0,t.default)("#SilverStripeNavigatorLinkPopup input").on("focus",(function(e){this.select()}))}))}();
|
||||
!function(){"use strict";!function(){function e(e){const t=getComputedStyle(e).display;e.style.display="none",e.dataset.__toggle_display=t}const t=document.querySelectorAll("#switchView a.newWindow");if(t.length>0)for(const e of t.values())e.addEventListener("click",(function(t){t.preventDefault();var n;return window.open(e.href,(n=e.target,document.getElementsByTagName("base")[0].href.replace("http://","").replace(/\//g,"_").replace(/\./g,"_")+n)).focus(),!1}));const n=document.getElementById("SilverStripeNavigatorLinkPopup");if(n){const t=document.getElementById("SilverStripeNavigatorLink");t&&t.addEventListener("click",(function(t){var o;return t.preventDefault(),o=n,"none"!==getComputedStyle(o).display?e(o):function(e){e.style.display=e.dataset.__toggle_display?e.dataset.__toggle_display:"block"}(o),!1}));const o=n.querySelectorAll("a.close");if(o.length>0)for(const t of o.values())t.addEventListener("click",(function(t){return t.preventDefault(),e(n),!1}));const l=n.querySelectorAll("input");if(l.length>0)for(const e of l.values())e.addEventListener("focus",(function(t){e.select()}))}}()}();
|
@ -1,29 +1,69 @@
|
||||
import $ from 'jquery';
|
||||
(function() {
|
||||
function windowName(suffix) {
|
||||
const base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_');
|
||||
return base + suffix;
|
||||
}
|
||||
|
||||
function windowName(suffix) {
|
||||
var base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_');
|
||||
return base + suffix;
|
||||
}
|
||||
function displayHide(elem) {
|
||||
const displayComputed = getComputedStyle(elem).display;
|
||||
elem.style.display = 'none';
|
||||
elem.dataset.__toggle_display = displayComputed;
|
||||
}
|
||||
|
||||
function displayShow(elem) {
|
||||
elem.style.display = elem.dataset.__toggle_display ? elem.dataset.__toggle_display : 'block';
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#switchView a.newWindow').on('click', function(e) {
|
||||
var w = window.open(this.href, windowName(this.target));
|
||||
w.focus();
|
||||
return false;
|
||||
});
|
||||
function displayToggle(elem) {
|
||||
const displayComputed = getComputedStyle(elem).display;
|
||||
if (displayComputed !== 'none') {
|
||||
displayHide(elem);
|
||||
} else {
|
||||
displayShow(elem);
|
||||
}
|
||||
}
|
||||
|
||||
$('#SilverStripeNavigatorLink').on('click', function(e) {
|
||||
$('#SilverStripeNavigatorLinkPopup').toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#SilverStripeNavigatorLinkPopup a.close').on('click', function(e) {
|
||||
$('#SilverStripeNavigatorLinkPopup').hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#SilverStripeNavigatorLinkPopup input').on('focus',function(e) {
|
||||
this.select();
|
||||
});
|
||||
});
|
||||
const newWindowLinks = document.querySelectorAll('#switchView a.newWindow');
|
||||
if (newWindowLinks.length > 0) {
|
||||
for (const link of newWindowLinks.values()) {
|
||||
link.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
const w = window.open(link.href, windowName(link.target));
|
||||
w.focus();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const popup = document.getElementById('SilverStripeNavigatorLinkPopup');
|
||||
if (popup) {
|
||||
const navigatorLink = document.getElementById('SilverStripeNavigatorLink');
|
||||
if (navigatorLink) {
|
||||
navigatorLink.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
displayToggle(popup);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
const closeLinks = popup.querySelectorAll('a.close');
|
||||
if (closeLinks.length > 0) {
|
||||
for (const link of closeLinks.values()) {
|
||||
link.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
displayHide(popup);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const inputs = popup.querySelectorAll('input');
|
||||
if (inputs.length > 0) {
|
||||
for (const input of inputs.values()) {
|
||||
input.addEventListener('focus', function(e) {
|
||||
input.select();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@ -321,7 +321,6 @@ class ContentController extends Controller
|
||||
if (Director::isDev() || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
|
||||
if ($this->dataRecord) {
|
||||
Requirements::css('silverstripe/cms: client/dist/styles/SilverStripeNavigator.css');
|
||||
Requirements::javascript('silverstripe/admin: thirdparty/jquery/jquery.js');
|
||||
Requirements::javascript('silverstripe/cms: client/dist/js/SilverStripeNavigator.js');
|
||||
|
||||
$return = $nav = SilverStripeNavigator::get_for_record($this->dataRecord);
|
||||
|
Loading…
Reference in New Issue
Block a user