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

IBX-3301: Product type - disable button Add when there is no option to add more elements #629

Merged
merged 4 commits into from
Nov 3, 2022

Conversation

lucasOsti
Copy link
Contributor

Question Answer
Tickets https://issues.ibexa.co/browse/IBX-3301
Bug fix? yes
New feature? no
BC breaks? no
Tests pass? yes
Doc needed? no
License GPL-2.0

Screenshot 2022-10-26 at 16 03 54

Checklist:

  • Coding standards ($ composer fix-cs)
  • Ready for Code Review

const addGroupBtns = doc.querySelectorAll('.ibexa-content-type-edit__add-field-definitions-group [data-related-collapse-selector]');
const areEveryAddGroupBtnsDisabled = [...addGroupBtns].every(btn => btn.classList.contains('ibexa-popup-menu__item-content--disabled'));

addGroupTriggerBtn.disabled = areEveryAddGroupBtnsDisabled
Copy link
Contributor

Choose a reason for hiding this comment

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

prettier?

},
});
const toggleAddGroupTriggerBtn = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const toggleAddGroupTriggerBtn = () => {
const toggleAddGroupTriggerBtnState = () => {

?

@lucasOsti lucasOsti requested a review from dew326 October 27, 2022 07:43
},
});
const toggleAddGroupTriggerBtnState = () => {
const addGroupBtns = doc.querySelectorAll('.ibexa-content-type-edit__add-field-definitions-group [data-related-collapse-selector]');
const areEveryAddGroupBtnsDisabled = [...addGroupBtns].every((btn) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const areEveryAddGroupBtnsDisabled = [...addGroupBtns].every((btn) =>
const areAllAddGroupBtnsDisabled = [...addGroupBtns].every((btn) =>

is best. (also as a sidenote - if you use "every", all other words should be singular, so in that case "isEveryAddGroupBtnDisabled"), but still - best one is one in suggestion ;)

@@ -471,4 +481,5 @@
},
false,
);
toggleAddGroupTriggerBtnState();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
toggleAddGroupTriggerBtnState();
toggleAddGroupTriggerBtnState();

@sonarcloud
Copy link

sonarcloud bot commented Oct 27, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@bogusez bogusez self-assigned this Nov 2, 2022
@dew326 dew326 deleted the IBX-3301-add-btn-content-type-disabled-state branch November 3, 2022 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants