Skip to content

Commit

Permalink
[BUGFIX] Drop 'List View' in workspace preview
Browse files Browse the repository at this point in the history
The workspace preview not only has the default view with
the slider to show differences between live and workspace
version. It additionally contains a full workspace module
accessible through the 'List View' button.
This view is notoriously broken and not fully thought through.
For instance the 'Open version of page' button breaks out of
the module to a different place of the backend, restricted to
the main module frame, and there is no way back.
For simple workspace stage editing, the default preview
mode has the 'send to stage' and 'discards' buttons already,
so there is little reason to have the backend module rendered
in the preview in the first place.
The patch drops the 'List View' from the preview. Next to
a cleaner interface, this increases the performance of the
preview since a full backend call plus various ajax calls
are no longer executed.

Resolves: #92031
Releases: master, 10.4
Change-Id: I33d21931e157aed2ef64cca3808cc4b6c28a8ef1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65303
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
lolli42 authored and bmack committed Aug 18, 2020
1 parent a6f422d commit 6589598
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 84 deletions.
Expand Up @@ -23,11 +23,8 @@ enum Identifiers {
topbar = '#typo3-topbar',
workspacePanel = '.workspace-panel',
liveView = '#live-view',
workspaceTabs = '.t3js-workspace-tabs [data-toggle="tab"]',
workspaceActions = '.t3js-workspace-actions',
stageSlider = '#workspace-stage-slider',
workspaceView = '#workspace-view',
workspaceList = '#workspace-list',
sendToStageAction = '[data-action="send-to-stage"]',
discardAction = '[data-action="discard"]',
stageButtonsContainer = '.t3js-stage-buttons',
Expand Down Expand Up @@ -69,11 +66,8 @@ class Preview extends Workspaces {
private getElements(): void {
this.elements.$liveView = $(Identifiers.liveView);
this.elements.$workspacePanel = $(Identifiers.workspacePanel);
this.elements.$workspaceTabs = $(Identifiers.workspaceTabs);
this.elements.$workspaceActions = $(Identifiers.workspaceActions);
this.elements.$stageSlider = $(Identifiers.stageSlider);
this.elements.$workspaceView = $(Identifiers.workspaceView);
this.elements.$workspaceList = $(Identifiers.workspaceList);
this.elements.$stageButtonsContainer = $(Identifiers.stageButtonsContainer);
this.elements.$previewModeContainer = $(Identifiers.previewModeContainer);
this.elements.$activePreviewMode = $(Identifiers.activePreviewMode);
Expand All @@ -92,9 +86,6 @@ class Preview extends Workspaces {
.on('click', Identifiers.sendToStageAction, this.renderSendPageToStageWindow)
;

this.elements.$workspaceTabs.on('show.bs.tab', (e: JQueryEventObject): void => {
this.elements.$workspaceActions.toggle((<HTMLElement>e.currentTarget).dataset.actions);
});
new ThrottleEvent('input', this.updateSlidePosition, 25).bindTo(document.querySelector(Identifiers.stageSlider));
this.elements.$previewModeContainer.find('[data-preview-mode]').on('click', this.changePreviewMode);
}
Expand Down Expand Up @@ -132,7 +123,6 @@ class Preview extends Workspaces {
if (this.elements.$activePreviewMode.data('activePreviewMode') === 'slider') {
this.elements.$liveView.height(absoluteHeightOfLiveView - outerHeightDifference);
}
this.elements.$workspaceList.height(availableSpace);
}

/**
Expand Down Expand Up @@ -168,9 +158,8 @@ class Preview extends Workspaces {
]).then(async (response: AjaxResponse): Promise<void> => {
$modal.modal('hide');
this.renderStageButtons((await response.resolve())[1].result);
// Reloading live view and and workspace list view IFRAME
// Reloading live view IFRAME
this.elements.$workspaceView.attr('src', this.elements.$workspaceView.attr('src'));
this.elements.$workspaceList.attr('src', this.elements.$workspaceList.attr('src'));
});
}
});
Expand Down
Expand Up @@ -165,13 +165,6 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac
throw new UnableToLinkToPageException('The page ' . $this->pageId . ' had no proper connection to a site, no link could be built.', 1559794913);
}

// Build the "list view" link to the review controller
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$wsSettingsUrl = $uriBuilder->buildUriFromRoute('web_WorkspacesWorkspaces', [
'tx_workspaces_web_workspacesworkspaces' => ['action' => 'singleIndex'],
'id' => $this->pageId
], UriBuilder::ABSOLUTE_URL);

// Evaluate available preview modes
$splitPreviewModes = GeneralUtility::trimExplode(
',',
Expand All @@ -190,7 +183,6 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac
'logoLink' => Typo3Information::URL_COMMUNITY,
'liveUrl' => $liveUrl ?? false,
'wsUrl' => $wsUrl,
'wsSettingsUrl' => $wsSettingsUrl,
'activeWorkspace' => $availableWorkspaces[$activeWorkspace],
'splitPreviewModes' => $splitPreviewModes,
'firstPreviewMode' => current($splitPreviewModes),
Expand Down
20 changes: 0 additions & 20 deletions typo3/sysext/workspaces/Classes/Controller/ReviewController.php
Expand Up @@ -196,26 +196,6 @@ public function indexAction()
}
}

/**
* Renders the review module for a single page. This is used within the
* workspace-preview frame.
*/
public function singleIndexAction()
{
$wsService = GeneralUtility::makeInstance(WorkspaceService::class);
$wsList = $wsService->getAvailableWorkspaces();
$activeWorkspace = $this->getBackendUser()->workspace;
$wsCur = [$activeWorkspace => true];
$wsList = array_intersect_key($wsList, $wsCur);
$this->view->assignMultiple([
'pageUid' => (int)GeneralUtility::_GP('id'),
'showGrid' => true,
'workspaceList' => $this->prepareWorkspaceTabs($wsList, (int)$activeWorkspace),
'activeWorkspaceUid' => $activeWorkspace,
]);
$this->pageRenderer->addInlineSetting('Workspaces', 'singleView', '1');
}

/**
* Prepares available workspace tabs.
*
Expand Down
Expand Up @@ -275,12 +275,6 @@
<trans-unit id="info.newpage.detail" resname="info.newpage.detail">
<source>The previewed page has been created in a workspace and has no live counterpart.</source>
</trans-unit>
<trans-unit id="preview.visualPreview" resname="preview.visualPreview">
<source>Visual preview</source>
</trans-unit>
<trans-unit id="preview.listView" resname="preview.listView">
<source>List view</source>
</trans-unit>
<trans-unit id="preview.livePreview" resname="preview.livePreview">
<source>Live</source>
</trans-unit>
Expand Down
17 changes: 0 additions & 17 deletions typo3/sysext/workspaces/Resources/Private/Layouts/Nodoc.html

This file was deleted.

Expand Up @@ -7,13 +7,7 @@
</a>
<span class="typo3-topbar-site-name">{activeWorkspace}</span>
</div>
<div class="typo3-topbar-tabs t3js-workspace-tabs">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#visual" aria-controls="visual" role="tab" data-toggle="tab" data-actions="true"><f:translate key="preview.visualPreview" extensionName="workspaces" /></a></li>
<li role="presentation"><a href="#list" aria-controls="list" role="tab" data-toggle="tab" data-actions="false"><f:translate key="preview.listView" extensionName="workspaces" /></a></li>
</ul>
</div>
<div class="typo3-topbar-workspace-actions t3js-workspace-actions">
<div class="typo3-topbar-workspace-actions">
<f:if condition="{liveUrl}">
<div class="workspace-action">
<div class="slider-wrapper">
Expand Down Expand Up @@ -59,9 +53,6 @@
<iframe src="{wsUrl}" id="workspace-view"></iframe>
</div>
</div>
<div role="tabpanel" class="tab-pane workspaces" id="list">
<iframe src="{wsSettingsUrl}" id="workspace-list"></iframe>
</div>
</div>
</div>
</html>

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion typo3/sysext/workspaces/ext_tables.php
Expand Up @@ -10,7 +10,7 @@
'before:info',
[
// An array holding the controller-action-combinations that are accessible
\TYPO3\CMS\Workspaces\Controller\ReviewController::class => 'index,singleIndex'
\TYPO3\CMS\Workspaces\Controller\ReviewController::class => 'index'
],
[
'access' => 'user,group',
Expand Down

0 comments on commit 6589598

Please sign in to comment.