-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework the front end preview #989
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!! Really looking forward to this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Can we maybe add an image to see what the toolbar will look like?
Any particular reason why the user list is loaded with ajax?
core-bundle/src/Resources/views/FrontendPreview/authenticator.html.twig
Outdated
Show resolved
Hide resolved
a426da7
to
aaf3052
Compare
aaf3052
to
414b966
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks excellent to me. Imho, this can be extended with unit tests and merged as is!
Polishing CSS and adding more toolbar functionality such as JS can still be done afterwards. At least we got rid of the iframe now and the preview bar is shown consistently everywhere :) Great work!
Co-Authored-By: Martin Auswöger <martin@auswoeger.com>
9434896
to
6fae43a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in the Mumble call yesterday, $user->amg
is the correct implementation, but it should be in the BackendUser
class instead.
#1120 has been merged, so this can be added now. 👍 |
# Conflicts: # calendar-bundle/tests/DependencyInjection/ContaoCalendarExtensionTest.php # calendar-bundle/tests/EventListener/PreviewUrlConverterListenerTest.php # core-bundle/src/Resources/contao/library/Contao/User.php # news-bundle/tests/DependencyInjection/ContaoNewsExtensionTest.php # news-bundle/tests/EventListener/PreviewUrlConverterListenerTest.php
2e6aa15
to
2c1c97d
Compare
I addressed the changes and merged against master to resolve conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all good to me! Unfortunately, the coverage seems to decrease quite a lot, are we missing tests on new classes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks very good to me. 👍 We cannot merge it with the decreasing test coverage though.
06899aa
to
1371041
Compare
ae12b74
to
b225e1d
Compare
Thank you @richardhj. 🎉 |
🎉 thanks, Richard! ❤️ |
This PR injects the back end preview bar and replaces the preview frameset.
How this works:
The preview bar is injected into the DOM on
kernel.response
event.When the user wants to view the page as a member, an Ajax request is triggered in which the preview authentication will be handled. The Ajax endpoint logs in the user, returns an HTTP OK and finally, a page reload is done.
TODO:
Impressions:
Outlook:
I already worked on an enhanced version of the preview. Once this PR is approved and merged, I add a framework for 3rd parties to add content to the preview toolbar.
So-called "preview providers" (class must implementing an interface and tag the service with
contao.preview_provider
) can add arbitrary content to the toolbar.In the end, the great advantage of the preview is the back end scope in the front end.
The toolbar should be either horizontally (as we know it) or left-aligned when the content requires it.
Use case: theme switch or changing CSS variables on runtime.