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
Cms page fixes #13144
Cms page fixes #13144
Conversation
83b7fd7
to
bff7ef7
Compare
@matks ready for review |
admin-dev/themes/new-theme/js/components/form/preview-opener.js
Outdated
Show resolved
Hide resolved
src/Adapter/CMS/Page/QueryHandler/GetCmsPageForEditingHandler.php
Outdated
Show resolved
Hide resolved
@matks addressed your comments |
17e7829
to
5e84e77
Compare
@zuk3975 Travis is not happy. I think with a rebase you should be fine as I see code on |
ef54b12
to
b41c728
Compare
open() { | ||
const urlParams = new URLSearchParams(location.search); | ||
|
||
if (this.previewUrl && urlParams.has('open_preview') && this.disablePreview !== 1) { |
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.
could you rename this.disablePreview !== 1
so we can avoid !==
check?
@@ -1,3 +1,5 @@ | |||
import PreviewOpener from '../../../components/form/preview-opener'; |
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.
I think this file needs license.
/** | ||
* Opens new page of provided url if query contains specific parameters | ||
*/ | ||
open() { |
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.
Shouldn't it be private?
* Responsible for opening another page with specified url. | ||
* For example used in 'Save and preview' cms page create/edit actions | ||
*/ | ||
export default class PreviewOpener { |
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.
Please document usage of this component.
/** | ||
* @var string | ||
*/ | ||
private $previewUrl; |
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.
Can you document this attribute?
@@ -158,6 +158,9 @@ public function createAction(Request $request) | |||
} catch (CoreException $e) { | |||
$this->addFlash('error', $this->getErrorMessageForException($e, $this->getErrorMessages())); | |||
} | |||
if ($request->isXmlHttpRequest()) { | |||
return $this->json('test'); |
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.
Hmmmm. 😄
} | ||
|
||
/* When form is submitted, but invalid, disable opening preview page */ | ||
if ($result->isSubmitted()) { |
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.
You don't check if form is invalid, but comment says you should.
[ | ||
sprintf( | ||
'"%s"', | ||
$this->trans('Name', 'Admin.Global')), |
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.
Weird place for )
at the end. Same for other items in this array. I think you could inline it.
$cms->getAssociatedShops() | ||
); | ||
$cms->getAssociatedShops(), | ||
$this->context->link->getCMSLink($cms, null, null, $this->context->language->id) |
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.
You can inject Link
and $langId
instead of Context
.
src/PrestaShopBundle/Resources/views/Admin/Improve/Design/Cms/Blocks/form.html.twig
Outdated
Show resolved
Hide resolved
@matks ready |
@zuk3975 PR approved 😉 however I need you to make it target |
@LouiseBonnard Your requested change has been handled so I add the "Wording ✔️" label 😉 |
save and preview
button in create/edit cms page form andmissing constraints
in cmsPageCategoryType (Added TypedRegexConstraints and missing Length constraints) .Refactors CmsPageController
to handle exceptions properly. (Avoid code replication from FrameworkBundleAdminController->getErrorMessageForException which wasn't implemented before).Improve > design > pages
, use interface buttons to create or edit cms page. Once form is ready to submit, pressSave and preview
button. You should be redirected to edit page (same cms page that you previously edited or created)new window should popup
with front office of that edited/created cms page. Make sure that browser doesn't block popup, else you will see native browser warning of blocked popup window, but new window won't open. In cmsCategory forms addedfield length constraints
as in legacy code (for example name field max 64 chars). Everything else should work as before.This change is