Skip to content
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

Use AdminController #96

Merged
merged 4 commits into from
Sep 12, 2024
Merged

Use AdminController #96

merged 4 commits into from
Sep 12, 2024

Conversation

matks
Copy link
Contributor

@matks matks commented Nov 28, 2023

Questions Answers
Description? Migrate deprecated ajax_ps_imageslider.php into a controller to comply with PrestaShop/PrestaShop#34578
Type? improvement
BC breaks? yes
Deprecations?
Fixed ticket?
Sponsor company PrestaShop
How to test? See below

BC Breaks

File ajax_ps_imageslider.php has been removed

How to test?

  1. Go to back-office on PrestaShop 9 (develop branch) and click on "Configure" button of ps_imageslider module in Module Manager
  2. Use the back-office page to drag-and-drop slides, and update their position. It should work as expected

This PR modified the function that perform the drag-and-drop of the slides, and store the updated positions.

@Hlavtox
Copy link
Contributor

Hlavtox commented Nov 28, 2023

I didn't test it, but I think you need to register it as a hidden tab with $tab->id_parent = -1;, or it won't work. ;-) Example below:

https://github.com/PrestaShop/ps_faviconnotificationbo/blob/62122b3825d25182743acc0187306ecbdeb0b93e/ps_faviconnotificationbo.php#L79

@leemyongpakvn
Copy link
Contributor

I guess @matks wanted to say about version 4.0.0 of this module, because we are in version 3.1.3 now (maybe he did a copy/paste mistake from ps_checkpayment ;)
Actually, we don't need to remove ajax_ps_imageslider.php file immediately, just keep it and add redirect like what we did with ps_checkpayment v2.0.6 in this PR.
Another option is bumping version to 4.0.0 in this PR, but don't release new major version till we have enough major functioning changes as I and @Hlavtox are doing for ps_facetedsearch and ps_googleanalytics.

@matks
Copy link
Contributor Author

matks commented Nov 29, 2023

I guess @matks wanted to say about version 4.0.0 of this module, because we are in version 3.1.3 now (maybe he did a copy/paste mistake from ps_checkpayment ;)

It's 100% a copy-paste mistake XD I was lazy to rewrite the PR table from scratch

Actually, we don't need to remove ajax_ps_imageslider.php file immediately, just keep it and add redirect like what we did with ps_checkpayment v2.0.6 in this PR.

Yes I can keep it 👍 for backward compatibility if you guys think it's better

I didn't test it, but I think you need to register it as a hidden tab with $tab->id_parent = -1;, or it won't work. ;-) Example below:

I promise it works 🤔 . I am only using one ajax controller action, and I don't have a dedicated view for this controller, maybe this is why it works?

@leemyongpakvn
Copy link
Contributor

leemyongpakvn commented Nov 29, 2023

Tested result on my side: update position is not saved to DB; php-cx-fixer warns about tabs indent in function ajaxProcessUpdateSlidesPosition too.

@matks
Copy link
Contributor Author

matks commented Nov 29, 2023

ps_checkpayment v2.0.6

  1. PHP-CS-Fixer : I'll do it

  2. I'm not sure I can add a redirect to ajax_ps_imageslider.php because it handles a POST request, not a GET request. But I can keep the file, deprecated, with an error message.

  3. I had to update the JavaScript call, can you check again after clearing your browser cache? And if it does not work, can you check what URL and payload is sent by the JS? "On my computer it works" 😁

ps_imageslider.php Outdated Show resolved Hide resolved
Copy link
Contributor

@leemyongpakvn leemyongpakvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with my suggested tweaks, the new controller is still missing or invalid
Screenshot from 2023-11-30 07-46-44

@leemyongpakvn leemyongpakvn changed the title Use frontcontroller Use AdminController Nov 30, 2023
@leemyongpakvn
Copy link
Contributor

I think @Hlavtox is right. In BlockReassurance 4.0.0 Release, new-added AdminBlockListingController is added to Tab table by upgrade-4.0.0.php

@Hlavtox
Copy link
Contributor

Hlavtox commented Jan 10, 2024

Ping @matks, can you recheck and register the tab? ;-)

boherm
boherm previously approved these changes Sep 12, 2024
Copy link
Contributor

@florine2623 florine2623 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @matks ,

Upgrade to v3.2.0 OK

I can only drag and drop the sliders once, after I add another slide, I can't drag n drop anymore.

Screen.Recording.2024-09-12.at.10.35.31.mov

Could you check ?
Thanks :)

@Hlavtox
Copy link
Contributor

Hlavtox commented Sep 12, 2024

Issue fixed, there was some wrong logic in the conditions that rendered the sorting in the header.

Copy link
Contributor

@florine2623 florine2623 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Hlavtox !

LGTM ✅
CRUD sliders, enabled/disabled.
Sliders can be drag n dropped as wanted.

@nicosomb nicosomb merged commit 060a79f into PrestaShop:dev Sep 12, 2024
9 checks passed
@nicosomb nicosomb added this to the 3.1.5 milestone Sep 12, 2024
@matks matks deleted the use-frontcontroller branch September 13, 2024 07:42
@matks
Copy link
Contributor Author

matks commented Sep 13, 2024

Thank you

@Hlavtox Hlavtox mentioned this pull request Sep 14, 2024
@Hlavtox Hlavtox mentioned this pull request Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants