-
Notifications
You must be signed in to change notification settings - Fork 359
Required label asterix #150
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
Required label asterix #150
Conversation
…e associated with model attributes that are required (via ActiveRecord::Validations::PresenceValidator)
Fixed the code :-)
Handle nil models / attributes.
|
Would be nice to merge it:) |
|
Sorry for the delay guys... I'm mid launch with a new company and that's been taking up all my spare time. The only concern I have with this is that it's turned on by default. I personally don't like using asterisks in my labels and wouldn't want to have to turn them off on all my projects that already use this. Can you add the ability to toggle it on and off with the default being off? |
|
I agree with Stephen re: default being 'off', otherwise I would have to On 14-10-09 12:40 PM, Stephen Potenza wrote:
|
|
Hey guys! Don't disagree here ... I guess the "best" place to control the on/off right now would be to add a parameter within the form creation? Those of us who are in love with the * would need to add this parameter to each form definition ... something like: <%= bootstrap_form_for(@thing, layout: :horizontal, required_field_symbol: '*') do |f| %> Thoughts? |
|
Amazing, I already forgot how this worked! So, what the change does is add a "required" class to the label ... it is then up to the user to specify some CSS to do something with it. So for example, if a user adds this then they get nice asterisks: label.required:after { On the other hand, if a user does nothing then nothing changes assuming they don't have a rule for the "required" CSS class. I could still add an option to enable / disable the class addition (or maybe specify a custom class) but also not looking to over-engineer if folks are happy with it as-is. Let me know what you think. |
|
Last attempt, I retract the previous statement, I did include the CSS into rails_bootstrap_forms. So, new proposal, what if I remove / comment the "required" CSS and then go with what I said in the previous comment? |
…ith the label and leave the actual CSS definition up to the user.
…terix Conflicts: CHANGELOG.md
|
Hey @potenza, First .. hope the launch is going / went well and you are still alive! Second, anything I can do to help move this merge request along? Thanks! |
|
@krsyoung Thank you! The launch went surprisingly well so we've been a bit overwhelmed for the last couple of weeks (but that's a good thing). This looks good. Thanks for the PR 👍 |
|
Glad to hear @potenza. Thanks for all you do! Absolutely loving this project. |
Proposed update that will automatically append an asterix (*) to any label associated with a field bound to a model attribute with a presence validator. This pull is associated with issue #143.