-
Notifications
You must be signed in to change notification settings - Fork 508
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
Allow default option for disabled-with part two #329
Comments
I wonder if we can achieve something like this without adding a new data attribute - maybe cases where |
You mean I think @JangoSteve don't like the idea of using boolean values as data attribute. If we can't do this in the jquery_ujs side, I also don't want to add this logic to the Rails helpers. I deprecated |
Can someone clarify for me what exactly we're talking about changing in jquery-ujs in this issue? I don't think I quite understand. For what it's worth, I know it's not the prettiest thing in the world, but the solution you're currently using doesn't have to be as bad as the code you pasted:
That being said, I'm still unclear what the proposed |
@JangoSteve it would disable the button with its existing text--the default text. It could be called anything really, it's just what made most sense to me at the time. For example...
That would cause the button to be disabled with "Post it" or "Save" depending if the post is a new record or otherwise, without needing to stick a conditional there. Being able to use the It's a minor issue, but it seems logical to disable the button with its current text without having to call a translation function and then figure out if it's new/existing record translate. I hope that made sense. |
Got it. So you actually don't want it to change the text at all, you just want it to disable the button without modifying the text. I think rather than
@rafaelfranca To clarify, it's not that I don't like boolean values as data-attributes; I don't like choosing specific strings and changing their type or meaning. When an HTML attribute has a value, the value is always a string. Others had suggested before to specifically look for the string |
To clarify further on my previous point, it's not the |
Right. Got it. |
@JangoSteve @rafaelfranca excuse me for my interruption guys, as I mentioned in #339 jQuery's |
@simsalabim You're right. My example is incorrect. I guess I can't distill the issue down as much as I was trying. The full issue is with:
We want 1 and 2 to both be true as they're both remote links. So in jquery-ujs, we just check to see if the link has the So, we'd have to explicitly check for At the end of the day, if we're checking for |
@JangoSteve great, I did it exactly the way you described above. Is there any chance #339 will be merged then? |
BTW, It could have been as simple as |
As per discussion in jQuery issues I was pointed out that |
Besides the |
Rails has a great feature for translating button text. We can write this:
This feature allows us to reuse partials in
new
andedit
templates with no logic. Rails automatically substitutes the button text based on youren.yml
file.Now, if you want to disable the button state and still reuse your partial, you have to use some ugly logic:
Which defeats the point. It would be nice to have a a
disabled-with-default
option that just disables the button with its existing text. Something like:= f.submit class: 'button', 'disable-with-default'
The text was updated successfully, but these errors were encountered: