-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Safe values #772
Safe values #772
Conversation
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.
Looks great!
end | ||
|
||
alias_method :🦺, :safe |
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.
🕶️
@@ -18,7 +30,7 @@ def view_template | |||
with "nil content" do | |||
view do | |||
def view_template | |||
unsafe_raw nil | |||
raw nil |
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.
This method name is so much better than unsafe_raw
!
Hey, good timing! Any idea when this will be released? Found myself in need for it for implementing the Modal component in PhlexyUI: <button class="btn" onclick="my_modal_1.showModal()">open modal</button>
<dialog id="my_modal_1" class="modal">
... |
It's in the betas that are out for 2.0. I'm not sure there's a target date for releasing 2.0, other than just "when it's ready" 😅 Probably before ruby 3.4 comes out |
Ahh thought this was going to be added pre-2.0. I'll have to work with what we have now then, thanks! |
Have to ask, would it be possible to add this pre-2.0? EDIT: Yeah this looks like a breaking change, so don't think it can! |
Install 2.x beta. There's nothing super risky in there; just a few changes that break a few things, but should be relatively straightforward to fix. |
@bradgessler Yeah I also think there's not too many breaking changes. The thing is that I'm needing this for https:/PhlexyUI/phlexy_ui, and even though it's new and probably no-one uses it yet, if someone does, they may not want to be in Phlex 2.x beta 😅 I can definitely wait, no worries and thanks for this PR! |
You can get around it in v1 by using |
Thanks for chiming in @joeldrapper! I did see that helper being removed in this PR, but had trouble getting it to work with yielded content. I'm opening a discussion here Discussion #793: unsafe_raw with yield renders the yielded content outside to avoid hijacking this PR further. Thanks again everyone 😃 |
Unrelated: @davidalejandroaguilar when you take on forms in PhlexyUI, take a look at https:/rubymonolith/superform I'm in the same boat as you--holding out for 2.x to drop before switching everything over. |
@bradgessler I've seen it of course (I have it starred 😉), it's very interesting! Great to see so many different takes built on Phlex. |
Phlex::SGML#unsafe_raw
Phlex::SGML#safe
which creates aPhlex::SGML::SafeValue
Phlex::SGML::SafeObject
a generic interface for safe objects, whichPhlex::SGML::SafeValue
implementsPhlex::SGML#raw
, which takes a SafeObject__attributes__
to allow the use of unsafe attribute names when the values are SafeObjects.Example
Thanks @bradgessler for writing the original implementation of this PR. #719
Closes #718