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

XWIKI-21878: Various close button modals do not use intended icons #2888

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Sereza7
Copy link
Contributor

@Sereza7 Sereza7 commented Feb 14, 2024

Jira URL

https://jira.xwiki.org/browse/XWIKI-21878

Changes

Description

  • Removed the hard coded values from the templates.
  • Made a REST API call from modal.js to access the current icontheme icon.

Clarifications

  • The only occurrence of × left in the project is the fallback value for the modal.js template.

Screenshots & Video

All of those screenshots are taken after the changes in this PR. Hereafter are four of those. Among them, there's the "more difficult' cases with icons integrated in javascript (modal.js and syntaxPicker.js).
21878-moveAfterPR
21878-syntaxConvAfterPR
21878-previewDiffafterPR
21878-ckeditorModalAfterPR

Executed Tests

Manual tests with FA4, see screenshots. I also checked the modal.js template behaved as expected with Silk, and it behaved as expected.
No test build conducted. From what I could see, this change does not reflect into any test (except the resources xwiki-valid.html and xwiki-invalid.html). Passes regular builds: mvn clean install -f xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins; mvn clean install -f xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-webjar/ needed for testing on a live instance.

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches:
    • Only merge on master.

* Removed the hard coded values from the templates.
* Made a REST API call from modal.js to access the current icontheme icon.

Note: The only occurrence of `×` left in the project is the fallback value for the modal.js template.
var modalTemplate =
// Fetch the cross icon from the icon theme to fill up the modal template.
let iconURL = `${XWiki.contextPath}/rest/wikis/${XWiki.currentWiki}/iconThemes/icons?name=cross`;
let iconRequest = new XMLHttpRequest();
Copy link
Member

Choose a reason for hiding this comment

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

any reason to not use a jquery $.get call here?

Copy link
Contributor Author

@Sereza7 Sereza7 Feb 28, 2024

Choose a reason for hiding this comment

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

No specific reason. I don't have much experience with async javascript and API calls yet. I'll spend some time to try and use jquery instead 👍
Setting this PR as a draft until this is done

@Sereza7 Sereza7 marked this pull request as draft February 28, 2024 17:00
@Sereza7
Copy link
Contributor Author

Sereza7 commented Mar 8, 2024

Used jquery .get instead of native javascript for the API call.

@Sereza7 Sereza7 marked this pull request as ready for review March 8, 2024 13:37
'<button type="button" class="btn btn-primary" disabled="disabled">OK</button>' +
'</div>' +
// Fetch the cross icon from the icon theme to fill up the modal template.
let iconURL = `${XWiki.contextPath}/rest/wikis/${XWiki.currentWiki}/iconThemes/icons?name=cross`;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the wiki name should be URL-encoded to protect against wiki names with special characters (not sure if we allow them, though).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/search?q=repo%3Axwiki%2Fxwiki-platform%20%24%7BXWiki.currentWiki%7D&type=code
It's already used a few times in the codebase.

I took the opportunity to fix those other uses in 4 files in 217df8a .

I rebuilt the ckeditor plugin with the change, and it didn't break anything when testing on the main wiki :)

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