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-3619: Tag update helper #633

Merged
merged 4 commits into from
Dec 2, 2022
Merged

Conversation

GrabowskiM
Copy link
Contributor

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

Checklist:

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

});
});
const parseAll = (baseElement = doc) => {
if (!baseElement) {
Copy link
Contributor

Choose a reason for hiding this comment

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

baseElement has default, so when it can be undefined?

Copy link
Contributor

Choose a reason for hiding this comment

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

It won't be undefined but it can be null.


baseElement.dataset.bsOriginalTitle = content;
contentElements.forEach((contentElement) => {
contentElement.innerHTML = content;
Copy link
Contributor

Choose a reason for hiding this comment

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

this probably should be escaped

Copy link
Contributor

@tischsoic tischsoic Nov 10, 2022

Choose a reason for hiding this comment

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

so, e.g. innerText = content or maybe something more sophisticated?

Copy link
Contributor

Choose a reason for hiding this comment

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

we have text helper for escaping.

{% set tag_attributes = tag_attributes|default({})|merge({'class': (tag_attributes.class|default('') ~ ' ibexa-tag')|trim}) %}
{% set is_deletable = is_deletable is defined ? is_deletable : true %}
{% set tag_attributes = tag_attributes|default({})|merge({
'class': (tag_attributes.class|default('') ~ ' ibexa-tag' ~ (is_deletable ? ' ibexa-tag--deletable'))|trim
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
'class': (tag_attributes.class|default('') ~ ' ibexa-tag' ~ (is_deletable ? ' ibexa-tag--deletable'))|trim
class: (tag_attributes.class|default('') ~ ' ibexa-tag' ~ (is_deletable ? ' ibexa-tag--deletable'))|trim

@@ -24,6 +24,7 @@
}

&__remove-btn {
display: none;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't such a change make this an ibexa-badge? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, yes, but actually no.

It looks the same way as badge when is_deletable set to false, but when it can be deleted it's not. And I don't think it would be wise to change whole rendered/used component based on only is_deletable param.

if (!baseElement) {
return;
}

const middleEllipsisContainers = [...doc.querySelectorAll('.ibexa-middle-ellipsis')];
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this find also baseElement?

if (!baseElement) {
console.warn('No baseElement provided');
Copy link
Contributor

Choose a reason for hiding this comment

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

Printing this warning for null but not for undefined may be confusing. Maybe we can create more/less specific message? Or maybe create a more specific check?

});
parseAll(baseElement);
Copy link
Contributor

Choose a reason for hiding this comment

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

you should not use deprecated methods.

};

ibexa.addConfig('helpers.ellipsis.middle', {
parseAll,
update,
Copy link
Contributor

Choose a reason for hiding this comment

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

parseAll is deprecated and should not be used, we don't want to expose parse method?

@micszo micszo self-assigned this Dec 1, 2022
@GrabowskiM GrabowskiM force-pushed the IBX-3619-update-tag-functionality branch from 6430d85 to 485a241 Compare December 1, 2022 08:07
@GrabowskiM GrabowskiM force-pushed the IBX-3619-update-tag-functionality branch from 485a241 to 2d9311a Compare December 1, 2022 08:32
@GrabowskiM GrabowskiM changed the base branch from main to 4.3 December 1, 2022 08:32
@sonarcloud
Copy link

sonarcloud bot commented Dec 1, 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

@micszo micszo removed their assignment Dec 1, 2022
@dew326 dew326 merged commit 9abe3fb into 4.3 Dec 2, 2022
@dew326 dew326 deleted the IBX-3619-update-tag-functionality branch December 2, 2022 07:20
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.

None yet

8 participants