Commit 33714fee authored by Jo Hasenau's avatar Jo Hasenau Committed by Benjamin Kott
Browse files

[FEATURE] Load new content element wizard via modal instead of new page

Instead of having the new content element wizard in a separate module page
it will be opened in a modal now.

Resolves: #75676
Releases: master
Change-Id: If117fe3f2d55a4163bcb5c153b47938953050348
Reviewed-on: https://review.typo3.org/52999

Tested-by: Björn Jacob's avatarBjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Benjamin Kott's avatarBenjamin Kott <benjamin.kott@outlook.com>
Tested-by: Benjamin Kott's avatarBenjamin Kott <benjamin.kott@outlook.com>
parent 355be2e7
......@@ -333,3 +333,53 @@ $page-ce-dropzone-possible-border: $state-warning-border;
.t3-page-ce-dropzone-possible {
max-height: 225px;
}
//
// New Content Element Wizard
//
.t3-new-content-element-wizard-window {
background-color: #fafafa;
padding: 0;
.t3-new-content-element-wizard-title {
background-color: #292929;
color: #fff;
padding: $grid-gutter-width/3 $grid-gutter-width/2;
h2 {
margin: 0;
}
& + .nav-tabs {
padding-top: 0;
}
}
.t3-new-content-element-wizard-body {
padding: $grid-gutter-width/2;
}
.nav-tabs {
padding: $grid-gutter-width/2 $grid-gutter-width/2 0;
}
.panel {
border: 0;
box-shadow: none;
}
}
@media (min-width: $screen-md-min) {
.media-new-content-element-wizard {
float: left;
width: 50%;
&:nth-child(2) {
margin-top: 0;
}
&:nth-child(odd) {
clear: both;
}
}
}
......@@ -21,6 +21,7 @@ declare namespace TYPO3 {
export class Modal {
public readonly sizes: {[key: string]: string};
public readonly styles: {[key: string]: string};
public readonly types: {[key: string]: string};
public currentModal: JQuery;
public advanced(configuration: object): any;
public confirm(title: string, content: any, severity: number, buttons: any[], additionalCssClasses?: string[]): JQuery; // tslint:disable-line:max-line-length
......
......@@ -295,7 +295,7 @@ class RecordProvider extends AbstractProvider
$tsConfig = BackendUtility::getModTSconfig($this->record['pid'], 'mod');
$moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
? $tsConfig['properties']['newContentElementWizard.']['override']
: 'new_content_element';
: 'new_content_element_wizard';
$urlParameters = [
'id' => $this->record['pid'],
'sys_language_uid' => $this->record['sys_language_uid'],
......
......@@ -191,6 +191,14 @@ class NewRecordController
// Setting up the context sensitive menu:
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ContextMenu');
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip');
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/Wizard/NewContentElement',
'function(NewContentElement) {
$(".t3js-toggle-new-content-element-wizard").click(function() {
NewContentElement.wizard($(this).data("url"), $(this).data("title"));
});
}'
);
// Creating content
$this->content = '';
$this->content .= '<h1>'
......@@ -400,9 +408,7 @@ class NewRecordController
->fetchColumn(0);
if ($numberOfPages > 0) {
$this->code .= '
<h3>' . htmlspecialchars($this->getLanguageService()->getLL('selectPosition')) . ':</h3>
';
$this->code .= '<h3>' . htmlspecialchars($this->getLanguageService()->getLL('selectPosition')) . ':</h3>';
$positionMap = GeneralUtility::makeInstance(PagePositionMap::class, NewRecordPageTreeView::class);
/** @var $positionMap \TYPO3\CMS\Backend\Tree\View\PagePositionMap */
$this->code .= $positionMap->positionTree(
......@@ -441,9 +447,7 @@ class NewRecordController
// Finish initializing new pages options with TSconfig
// Each new page option may be hidden by TSconfig
// Enabled option for the position of a new page
$this->newPagesSelectPosition = !empty(
$pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageSelectPosition']
);
$this->newPagesSelectPosition = !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageSelectPosition']);
// Pseudo-boolean (0/1) for backward compatibility
$displayNewPagesIntoLink = $this->newPagesInto && !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageInside']) ? 1 : 0;
$displayNewPagesAfterLink = $this->newPagesAfter && !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageAfter']) ? 1 : 0;
......@@ -461,12 +465,25 @@ class NewRecordController
$rowContent = '';
// New pages INSIDE this pages
$newPageLinks = [];
if ($displayNewPagesIntoLink && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ?: $this->id), 'pages')) {
if ($displayNewPagesIntoLink
&& $this->isTableAllowedForThisPage($this->pageinfo, 'pages')
&& $this->getBackendUserAuthentication()->check('tables_modify', 'pages')
&& $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ?: $this->id), 'pages')
) {
// Create link to new page inside:
$newPageLinks[] = $this->linkWrap($this->moduleTemplate->getIconFactory()->getIconForRecord($table, [], Icon::SIZE_SMALL)->render() . htmlspecialchars($lang->sL($v['ctrl']['title'])) . ' (' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:db_new.php.inside')) . ')', $table, $this->id);
$recordIcon = $this->moduleTemplate->getIconFactory()->getIconForRecord($table, [], Icon::SIZE_SMALL)->render();
$newPageLinks[] = $this->linkWrap(
$recordIcon . htmlspecialchars($lang->sL($v['ctrl']['title'])) . ' (' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:db_new.php.inside')) . ')',
$table,
$this->id
);
}
// New pages AFTER this pages
if ($displayNewPagesAfterLink && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) {
if ($displayNewPagesAfterLink
&& $this->isTableAllowedForThisPage($this->pidInfo, 'pages')
&& $this->getBackendUserAuthentication()->check('tables_modify', 'pages')
&& $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')
) {
$newPageLinks[] = $this->linkWrap($pageIcon . htmlspecialchars($lang->sL($v['ctrl']['title'])) . ' (' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:db_new.php.after')) . ')', 'pages', -$this->id);
}
// New pages at selection position
......@@ -511,14 +528,22 @@ class NewRecordController
// If the table is 'tt_content', create link to wizard
if ($table === 'tt_content') {
$groupName = $lang->getLL('createNewContent');
$rowContent = $newContentIcon . '<strong>' . $lang->getLL('createNewContent') . '</strong><ul>';
$rowContent = $newContentIcon
. '<strong>' . $lang->getLL('createNewContent') . '</strong>'
. '<ul>';
// If mod.newContentElementWizard.override is set, use that extension's wizard instead:
$tsConfig = BackendUtility::getModTSconfig($this->id, 'mod');
$moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
? $tsConfig['properties']['newContentElementWizard.']['override']
: 'new_content_element';
: 'new_content_element_wizard';
$url = BackendUtility::getModuleUrl($moduleName, ['id' => $this->id, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]);
$rowContent .= '<li>' . $newLink . ' ' . BackendUtility::wrapInHelp($table, '') . '</li><li><a href="' . htmlspecialchars($url) . '">' . $newContentIcon . htmlspecialchars($lang->getLL('clickForWizard')) . '</a></li></ul>';
$rowContent .= '<li>' . $newLink . ' ' . BackendUtility::wrapInHelp($table, '') . '</li>'
. '<li>'
. '<a href="#" data-url="' . htmlspecialchars($url) . '" data-title="' . htmlspecialchars($this->getLanguageService()->getLL('newContentElement')) . '" class="t3js-toggle-new-content-element-wizard">'
. $newContentIcon . htmlspecialchars($lang->getLL('clickForWizard'))
. '</a>'
. '</li>'
. '</ul>';
} else {
// Get the title
if ($v['ctrl']['readOnly'] || $v['ctrl']['hideTable'] || $v['ctrl']['is_static']) {
......
......@@ -54,6 +54,6 @@ class ContentCreationPagePositionMap extends PagePositionMap
'defVals[tt_content][sys_language_uid]' => $sys_lang,
'returnUrl' => $GLOBALS['SOBE']->R_URI
]);
return 'window.location.href=' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($location) . '+document.editForm.defValues.value; return false;';
return 'list_frame.location.href=' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($location) . '+document.editForm.defValues.value; return false;';
}
}
......@@ -281,7 +281,7 @@ class PagePositionMap
'cmd' => 'crPage',
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]
);
return 'window.location.href=' . GeneralUtility::quoteJSvalue($url) . ';';
return 'list_frame.location.href=' . GeneralUtility::quoteJSvalue($url) . ';';
}
$params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1';
return BackendUtility::editOnClick($params, '', $this->R_URI);
......@@ -544,7 +544,7 @@ class PagePositionMap
$uid = '';
}
$cc = hexdec(substr(md5($uid . '-' . $vv . '-' . $kk), 0, 4));
return '<a href="#" onclick="' . htmlspecialchars($this->onClickInsertRecord($row, $vv, $moveUid, $pid, $this->cur_sys_language)) . '">' . '<i class="t3-icon fa fa-long-arrow-left" name="mImgEnd' . $cc . '" title="' . htmlspecialchars($this->getLanguageService()->getLL($this->l_insertNewRecordHere)) . '"></i></a>';
return '<a href="#" onclick="' . htmlspecialchars($this->onClickInsertRecord($row, $vv, $moveUid, $pid, $this->cur_sys_language)) . '" data-dismiss="modal">' . '<i class="t3-icon fa fa-long-arrow-left" name="mImgEnd' . $cc . '" title="' . htmlspecialchars($this->getLanguageService()->getLL($this->l_insertNewRecordHere)) . '"></i></a>';
}
/**
......@@ -568,7 +568,7 @@ class PagePositionMap
}
$location .= '&redirect=' . rawurlencode($this->R_URI);
// returns to prev. page
return 'window.location.href=' . GeneralUtility::quoteJSvalue($location) . ';return false;';
return 'list_frame.location.href=' . GeneralUtility::quoteJSvalue($location) . ';return false;';
}
/**
......
......@@ -943,7 +943,7 @@ class PageLayoutView implements LoggerAwareInterface
$tsConfig = BackendUtility::getModTSconfig($id, 'mod');
$moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
? $tsConfig['properties']['newContentElementWizard.']['override']
: 'new_content_element';
: 'new_content_element_wizard';
$url = BackendUtility::getModuleUrl($moduleName, $urlParameters);
} else {
$urlParameters = [
......@@ -962,9 +962,11 @@ class PageLayoutView implements LoggerAwareInterface
];
$url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
}
$link = '<a href="' . htmlspecialchars($url) . '" title="'
. htmlspecialchars($this->getLanguageService()->getLL('newContentElement')) . '" class="btn btn-default btn-sm">'
$title = htmlspecialchars($this->getLanguageService()->getLL('newContentElement'));
$link = '<a href="#" data-url="' . htmlspecialchars($url) . '" '
. 'title="' . $title . '"'
. 'data-title="' . $title . '"'
. 'class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard">'
. $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render()
. ' '
. htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>';
......@@ -1063,7 +1065,7 @@ class PageLayoutView implements LoggerAwareInterface
$tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod');
$moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
? $tsConfig['properties']['newContentElementWizard.']['override']
: 'new_content_element';
: 'new_content_element_wizard';
$url = BackendUtility::getModuleUrl($moduleName, $urlParameters);
} else {
$urlParameters = [
......@@ -1076,13 +1078,14 @@ class PageLayoutView implements LoggerAwareInterface
];
$url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
}
$singleElementHTML .= '
<a href="' . htmlspecialchars($url) . '" title="'
. htmlspecialchars($this->getLanguageService()->getLL('newContentElement')) . '" class="btn btn-default btn-sm">'
$title = htmlspecialchars($this->getLanguageService()->getLL('newContentElement'));
$singleElementHTML .= '<a href="#" data-url="' . htmlspecialchars($url) . '" '
. 'title="' . $title . '"'
. 'data-title="' . $title . '"'
. 'class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard">'
. $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render()
. ' '
. htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>
';
. htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>';
}
$singleElementHTML .= '</div></div><div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div></div>';
if ($this->defLangBinding && $this->tt_contentConfig['languageMode']) {
......@@ -1450,8 +1453,10 @@ class PageLayoutView implements LoggerAwareInterface
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
$url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
$theData['__cmds__'] = '<a href="' . htmlspecialchars($url) . '" '
. 'title="' . htmlspecialchars($this->getLanguageService()->getLL('new')) . '">'
$title = htmlspecialchars($this->getLanguageService()->getLL('new'));
$theData['__cmds__'] = '<a href="#" data-url="' . htmlspecialchars($url) . '" class="t3js-toggle-new-content-element-wizard" '
. 'title="' . $title . '"'
. 'data-title="' . $title . '">'
. $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render() . '</a>';
}
$out .= $this->addElement(1, '', $theData, ' class="c-headLine"', 15, '', 'th');
......@@ -2382,7 +2387,7 @@ class PageLayoutView implements LoggerAwareInterface
$tsConfig = BackendUtility::getModTSconfig($id, 'mod');
$moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
? $tsConfig['properties']['newContentElementWizard.']['override']
: 'new_content_element';
: 'new_content_element_wizard';
$onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl($moduleName) . '&id=' . $id . '&colPos=' . $colPos
. '&sys_language_uid=' . $sys_language . '&uid_pid=' . $id
. '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . ';';
......
......@@ -143,6 +143,12 @@ return [
'target' => Controller\ContentElement\NewContentElementController::class . '::mainAction'
],
// Register new content element module
'new_content_element_wizard' => [
'path' => '/record/content/wizard/new',
'target' => Controller\Wizard\NewContentElementWizardController::class . '::mainAction'
],
// Register move element module
'move_element' => [
'path' => '/record/move',
......
......@@ -2,24 +2,34 @@
<f:if condition="{hasAccess}">
<f:then>
<f:form action="" name="editForm" id="NewContentElementController">
<f:form.hidden name="defValues" value=""/>
<h1>{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_misc.xlf:newContentElement')}</h1>
<f:if condition="{onClickEvent} == ''">
<h2>{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_misc.xlf:1_selectType')}</h2>
</f:if>
<div>
<p>{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:sel1')}</p>
{renderedTabs -> f:format.raw()}
</div>
<f:if condition="{onClickEvent} == ''">
<div><a name="sel2"></a></div>
<h2>{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_misc.xlf:2_selectPosition') -> f:format.htmlspecialchars()}</h2>
<div>
<p>{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:sel2') ->
f:format.htmlspecialchars()}</p>
{posMap -> f:format.raw()}
</div>
<f:form.hidden name="defValues" value="" />
<f:if condition="{onClickEvent}">
<f:then>
<script type="text/javascript">
function goToalt_doc() {<f:format.raw>{onClickEvent}</f:format.raw>}
</script>
{renderedTabs -> f:format.raw()}
</f:then>
<f:else>
<div id="new-content-element-wizard-carousel" class="carousel slide" data-ride="carousel" data-interval="false">
<div class="carousel-inner" role="listbox">
<div class="item active" data-slide="next">
<div class="t3-new-content-element-wizard-title">
<h2>{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_misc.xlf:1_selectType')}</h2>
</div>
{renderedTabs -> f:format.raw()}
</div>
<div class="item">
<div class="t3-new-content-element-wizard-title">
<h2>{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_misc.xlf:2_selectPosition') -> f:format.htmlspecialchars()}</h2>
</div>
<div class="t3-new-content-element-wizard-body">
{posMap -> f:format.raw()}
</div>
</div>
</div>
</div>
</f:else>
</f:if>
</f:form>
</f:then>
......
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<div class="media media-new-content-element-wizard">
<f:if condition="{onClickEvent} == ''">
<f:if condition="{onClickEvent}">
<f:then>
<f:if condition="{content}">
<a href="#" onclick="{aOnClick -> f:format.htmlspecialchars()}" data-dismiss="modal">
{content -> f:format.raw()}
</a>
</f:if>
<div class="media-left">
<input type="radio" name="tempB" value="{wizardKey -> f:format.htmlspecialchars()}" onclick="{wizardOnClick -> f:format.htmlspecialchars()}"/>
<a href="#" onclick="{aOnClick -> f:format.htmlspecialchars()}" data-dismiss="modal">
{icon -> f:format.raw()}
</a>
</div>
</f:if>
<f:if condition="{content}">
<a href="#" onclick="{aOnClick -> f:format.htmlspecialchars()}">
{content -> f:format.raw()}
</a>
</f:if>
<div class="media-left">
<a href="#" onclick="{aOnClick -> f:format.htmlspecialchars()}">
{icon -> f:format.raw()}
</a>
</div>
<div class="media-body">
<a href="#" onclick="{aOnClick -> f:format.htmlspecialchars()}">
<strong>{wizardInformation.title -> f:format.htmlspecialchars()}</strong>
<br />
{wizardInformation.description -> f:format.nl2br() -> f:format.htmlspecialchars()}
</a>
</div>
<div class="media-body">
<a href="#" onclick="{aOnClick -> f:format.htmlspecialchars()}" data-dismiss="modal">
<strong>{wizardInformation.title -> f:format.htmlspecialchars()}</strong>
<br />
{wizardInformation.description -> f:format.nl2br() -> f:format.htmlspecialchars()}
</a>
</div>
</f:then>
<f:else>
<input type="radio" class="hide" name="tempB" value="{wizardKey -> f:format.htmlspecialchars()}" onclick="{wizardOnClick -> f:format.htmlspecialchars()}"/>
<f:if condition="{content}">
<a href="#new-content-element-wizard-carousel" onclick="{aOnClick -> f:format.htmlspecialchars()}" data-slide="next">
{content -> f:format.raw()}
</a>
</f:if>
<div class="media-left">
<a href="#new-content-element-wizard-carousel" onclick="{aOnClick -> f:format.htmlspecialchars()}" data-slide="next">
{icon -> f:format.raw()}
</a>
</div>
<div class="media-body">
<a href="#new-content-element-wizard-carousel" onclick="{aOnClick -> f:format.htmlspecialchars()}" data-slide="next">
<strong>{wizardInformation.title -> f:format.htmlspecialchars()}</strong>
<br />
{wizardInformation.description -> f:format.nl2br() -> f:format.htmlspecialchars()}
</a>
</div>
</f:else>
</f:if>
</div>
</html>
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import Modal = require('TYPO3/CMS/Backend/Modal');
import Severity = require('TYPO3/CMS/Backend/Severity');
/**
* Module: TYPO3/CMS/Backend/Wizard/NewContentElement
* NewContentElement JavaScript
* @exports TYPO3/CMS/Backend/Wizard/NewContentElement
*/
class NewContentElement {
public static wizard(url: string, title: string): void {
Modal.advanced({
callback: (currentModal: JQuery) => {
currentModal.find('.t3js-modal-body').addClass('t3-new-content-element-wizard-window');
},
content: url,
severity: Severity.notice,
size: Modal.sizes.large,
title,
type: Modal.types.ajax,
});
}
}
export = NewContentElement;
......@@ -15,7 +15,7 @@
* Module: TYPO3/CMS/Backend/PageActions
* JavaScript implementations for page actions
*/
define(['jquery', 'TYPO3/CMS/Backend/Storage/Persistent'], function($, PersistentStorage) {
define(['jquery', 'TYPO3/CMS/Backend/Storage/Persistent', 'TYPO3/CMS/Backend/Wizard/NewContentElement'], function($, PersistentStorage, NewContentElement) {
'use strict';
/**
......@@ -32,7 +32,8 @@ define(['jquery', 'TYPO3/CMS/Backend/Storage/Persistent'], function($, Persisten
},
identifier: {
pageTitle: '.t3js-title-inlineedit',
hiddenElements: '.t3js-hidden-record'
hiddenElements: '.t3js-hidden-record',
newButton: '.t3js-toggle-new-content-element-wizard'
},
elements: {
$pageTitle: null,
......@@ -181,6 +182,15 @@ define(['jquery', 'TYPO3/CMS/Backend/Storage/Persistent'], function($, Persisten
PageActions.settings.language.pageOverlayId = overlayId;
};
/**
* Activate New Content Element Wizard
*/
PageActions.initializeNewContentElementWizard = function() {
$(PageActions.identifier.newButton).click(function() {
NewContentElement.wizard($(this).data('url'), $(this).data('title'));
});
};
/**
* Save the changes and reload the page tree
*
......@@ -219,6 +229,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Storage/Persistent'], function($, Persisten
$(function() {
PageActions.initializeElements();
PageActions.initializeEvents();
PageActions.initializeNewContentElementWizard();
PageActions.documentIsReady = true;
});
......
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
define(["require", "exports", "TYPO3/CMS/Backend/Modal", "TYPO3/CMS/Backend/Severity"], function (require, exports, Modal, Severity) {
"use strict";
/**
* Module: TYPO3/CMS/Backend/Wizard/NewContentElement
* NewContentElement JavaScript
* @exports TYPO3/CMS/Backend/Wizard/NewContentElement
*/
var NewContentElement = (function () {
function NewContentElement() {
}
NewContentElement.wizard = function (url, title) {
Modal.advanced({
callback: function (currentModal) {
currentModal.find('.t3js-modal-body').addClass('t3-new-content-element-wizard-window');
},
content: url,
severity: Severity.notice,
size: Modal.sizes.large,
title: title,
type: Modal.types.ajax,
});
};
return NewContentElement;
}());
return NewContentElement;
});
.. include:: ../../Includes.txt
===============================================================================
Feature: #75676 - Load new content element wizard via modal instead of new page
===============================================================================
See :issue:`75676`
Description
===========
Instead of having the new content element wizard in a separate module page it
will be opened in a modal now.
Depending on the position of the "new" button, there are still two different
variants of the wizard. When triggered from within the page module it will open
as a single step wizard that just inserts the selected content element at the
trigger position.
When triggered from within the list module's "new record" action, it will open
as a two step wizard, that offers a selection of possible content elements first
and then shows a position map as the secons step. After selecting the position
the new content element will be inserted there.
The original hooks of the new content element wizards have been kept as is.
.. index:: Backend
......@@ -244,10 +244,10 @@
<source>System Records</source>