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

[Alert] Add id and attr option #156

Merged
merged 4 commits into from
Jun 15, 2023
Merged

[Alert] Add id and attr option #156

merged 4 commits into from
Jun 15, 2023

Conversation

cavasinf
Copy link
Collaborator

Description

Adds id and attr option

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I updated the documentation (see here)
  • I agree that this code will be published under the MIT license

@cavasinf cavasinf added Status: Needs Review Not under investigation Feature Feature requested labels Apr 19, 2023
@cavasinf cavasinf added this to the 1.1 milestone Apr 19, 2023
@cavasinf cavasinf marked this pull request as ready for review April 19, 2023 09:30
@cavasinf
Copy link
Collaborator Author

Should we remove the deprecated part now @kevinpapst ?

@kevinpapst
Copy link
Owner

Yes, remove the deprecated stuff.

I know you like the better readability of multiline HTML.
But I have several test cases where I check the generated HTML for special cases (sometimes that is the only way to test a certain code piece. Those tests always break with HTML structure changes. Can you use {%- and -}} to prevent line breaks?

What just came to my mind while reading your changes: we could merge role and id into the _attr array and let the macro create all HTML attributes. The macro could prevent line breaks, my tests are happy about the HTML and you have the better readability.

@cavasinf
Copy link
Collaborator Author

Yes, remove the deprecated stuff.

Done ✔️

I know you like the better readability of multiline HTML.

Yes I do 😉 And I do it without noticing it now, sorry 😅

But I have several test cases where I check the generated HTML for special cases (sometimes that is the only way to test a certain code piece. Those tests always break with HTML structure changes. Can you use {%- and -}} to prevent line breaks?

Good idea! Done ✔️

What just came to my mind while reading your changes: we could merge role and id into the _attr array and let the macro create all HTML attributes.

Funny, because I was thinking about that when I added those new params.
IT IS a great idea, but then I thought of other includes/component/... If we're going to do this (which I'm 💯 percent with). We should do it in a new PR that changes all those things and warn devs about this BC break.

@cavasinf
Copy link
Collaborator Author

cavasinf commented Apr 19, 2023

Talking about things to change.
I don't think that:

{% set _background = _title is empty or _description is empty or _important %}

Has its place in the bundle.
Maybe it is related to your logic or the old AdminLTE logic.
But I think the alert-important class should be written when the important option is set to true.
Not with magic variable that can be tricky.

WDYT ?

We can deprecate it like that:

{% if (_title is empty or _description is empty) and options.important is not defined %}
    {% deprecated "Using important alert without setting the 'important' option is deprecated, set option to true instead." %}
    {% set _important = true %}
{% endif %}

@kevinpapst
Copy link
Owner

Where do I find {% set _background = _title is empty or _description is empty or _important %} that?

I had recently troubles showing an alert notification in a certain way. Maybe that was the reason...

@cavasinf
Copy link
Collaborator Author

Where do I find {% set _background = _title is empty or _description is empty or _important %} that?

I had recently troubles showing an alert notification in a certain way. Maybe that was the reason...

There:

{% set _background = _title is empty or _description is empty or _important %}

@cavasinf cavasinf marked this pull request as draft April 19, 2023 13:06
@cavasinf cavasinf marked this pull request as ready for review April 27, 2023 13:16
@cavasinf cavasinf requested a review from kevinpapst June 14, 2023 08:39
@cavasinf
Copy link
Collaborator Author

Any update on that @kevinpapst?

Copy link
Owner

@kevinpapst kevinpapst left a comment

Choose a reason for hiding this comment

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

Tested, works 👍 merge 🚀

Thanks!

@kevinpapst kevinpapst merged commit fdc3c18 into main Jun 15, 2023
@kevinpapst kevinpapst deleted the cavasinf-alert branch June 15, 2023 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Feature requested Status: Needs Review Not under investigation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants