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

Format the javascript code #14967

Merged
merged 4 commits into from
May 10, 2018

Conversation

yogeshsuhagiya
Copy link
Member

Description

Format the javascript code in the template file.

Fixed Issues (if relevant)

  1. N/A

Manual testing scenarios

  1. N/A

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@VladimirZaets VladimirZaets self-assigned this May 3, 2018
@VladimirZaets
Copy link
Contributor

VladimirZaets commented May 3, 2018

Hi @yogeshks , thank you for collaboration. Use javascript inside *.phtml file it's legacy code that we try to refactor according to Magento way.

For that we have <script type="text/x-magento-init" /> tag, where we declare path to JS file and pass paramets if they are needed.

Please make refactoring according to Magento way.
If you have some questions we will glad to help you.

@yogeshsuhagiya
Copy link
Member Author

Hi @VladimirZaets
Thank you for guidance, I really like to refactor JS code. Do I have to create a new JS component for that which a returns callback function?

@VladimirZaets
Copy link
Contributor

Hi @yogeshks , yes, you should create new JS file/component with the callback function, as example and use <script type="text/x-magento-init" /> to call it, as example

@yogeshsuhagiya
Copy link
Member Author

Hi @VladimirZaets
I've added JS component, please verify updates

@VladimirZaets
Copy link
Contributor

Hi @yogeshks. Updates look good, thanks. I took your PR into processing.

@magento-engcom-team
Copy link
Contributor

Hi @yogeshks. Thank you for your contribution.
Changes from your Pull Request will be available with the upcoming 2.2.5 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants