mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 22:09:48 +08:00
Merge pull request #2883 from kartik-v/patch-14
Simplify inline script code
This commit is contained in:
@@ -5,8 +5,11 @@ use yii\helpers\Json;
|
|||||||
/* @var $this \yii\base\View */
|
/* @var $this \yii\base\View */
|
||||||
/* @var $url string */
|
/* @var $url string */
|
||||||
/* @var $enforceRedirect boolean */
|
/* @var $enforceRedirect boolean */
|
||||||
|
?>
|
||||||
$redirectJavaScript = <<<EOL
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script>
|
||||||
function popupWindowRedirect(url, enforceRedirect)
|
function popupWindowRedirect(url, enforceRedirect)
|
||||||
{
|
{
|
||||||
if (window.opener && !window.opener.closed) {
|
if (window.opener && !window.opener.closed) {
|
||||||
@@ -19,15 +22,8 @@ function popupWindowRedirect(url, enforceRedirect)
|
|||||||
window.location = url;
|
window.location = url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOL;
|
popupWindowRedirect(<?= Json::encode($url) ?>, <?= Json::encode($enforceRedirect) ?>);
|
||||||
|
</script>
|
||||||
$redirectJavaScript .= 'popupWindowRedirect(' . Json::encode($url) . ', ' . Json::encode($enforceRedirect) . ');';
|
|
||||||
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<?= Html::script($redirectJavaScript) ?>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2 id="title" style="display:none;">Redirecting back to the "<?= Yii::$app->name ?>"...</h2>
|
<h2 id="title" style="display:none;">Redirecting back to the "<?= Yii::$app->name ?>"...</h2>
|
||||||
|
|||||||
Reference in New Issue
Block a user