-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
…o add more elements
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 |
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.
prettier?
}, | ||
}); | ||
const toggleAddGroupTriggerBtn = () => { |
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.
const toggleAddGroupTriggerBtn = () => { | |
const toggleAddGroupTriggerBtnState = () => { |
?
}, | ||
}); | ||
const toggleAddGroupTriggerBtnState = () => { | ||
const addGroupBtns = doc.querySelectorAll('.ibexa-content-type-edit__add-field-definitions-group [data-related-collapse-selector]'); | ||
const areEveryAddGroupBtnsDisabled = [...addGroupBtns].every((btn) => |
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.
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(); |
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.
toggleAddGroupTriggerBtnState(); | |
toggleAddGroupTriggerBtnState(); |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Checklist:
$ composer fix-cs
)