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

Add classes globally to inputs #316

Closed
rafaelfranca opened this issue Sep 11, 2011 · 14 comments
Closed

Add classes globally to inputs #316

rafaelfranca opened this issue Sep 11, 2011 · 14 comments
Assignees

Comments

@rafaelfranca
Copy link
Collaborator

Something like this:

b.use :input, :class => 'xlarge'
@josevalim
Copy link
Contributor

Today passing a class to any component creates a wrapper. I believe if we need to implement this, it shuold be done with a configuration instead of an argument to the wrapper.

@rafaelfranca
Copy link
Collaborator Author

Yeah! I saw that here trying to implement this. We can go with the configuration option.

@rafaelfranca
Copy link
Collaborator Author

I got this

@rafaelfranca
Copy link
Collaborator Author

Thinking about this feature, after implement it, I don't know if is a good idea allow the user to set an class globally. This can make more difficult to change the default class on the inputs.

Something like this:

f.input :name, :input_class => false, :input_html => { :class => "test" }

Or if we have to do this, we need a better implementation.

WDYT @josevalim @carlosantoniodasilva

@carlosantoniodasilva
Copy link
Member

I think that this is not a really common case, I don't see a big problem on that.

@rafaelfranca
Copy link
Collaborator Author

I will use this option to set as default class span12 on our example application. But when I need to change this default, I had to write more code that when I not use the option

@carlosantoniodasilva
Copy link
Member

Well, that's a drawback you'll have if you want to use the default.

At.
Carlos Antonio

On Monday, September 26, 2011 at 10:58 PM, Rafael Mendonça França wrote:

I will use this option to set as default class 'span12' on our example application. But when I need to change this default, I had to write more code that when I not use the option

Reply to this email directly or view it on GitHub:
#316 (comment)

@jlxw
Copy link

jlxw commented Jul 30, 2013

I wonder what happened to this, I can't seem to find this commit in master?

@nashby
Copy link
Collaborator

nashby commented Jul 30, 2013

@jlxw it wasn't merged. See explanation here

@jlxw
Copy link

jlxw commented Jul 30, 2013

@nashby ah thanks!

@herregroen
Copy link

Bootstrap 3 RC1 I believe makes this feature very necessary and an extremely common use-case.

Currently Bootstrap only styles inputs that use the 'form-control' class, considering how widely Bootstrap is used I think adding in the option to apply this class globally without having to specify the default of every single form in your web application is pretty much required if you want to keep simple_form simple.

@ashleydw
Copy link

ashleydw commented Aug 1, 2013

+1 what @herregroen said

@Xuhao
Copy link

Xuhao commented Sep 13, 2013

I need this!

I am going to create a bootstrap3 wrapper, but I can't find a easy way to add "form-control" class to all input.

I found config.label_class = 'control-label' in initializers/simple_form.rb, but no config.input_class.

I don't want to extend input component and add class handy for each input.

cristi-badila pushed a commit to cristi-badila/simple_form that referenced this issue Oct 8, 2013
@balexand
Copy link
Contributor

It looks like this was added in 262c554, which came between 3.0.0.rc and 3.0.0. I'm not sure why the date on the commit is from 2 years ago.

rafaelfranca added a commit that referenced this issue Nov 11, 2013
Backport of fix for #316 - Add configuration to add class globally to inputs.
Gonzih pushed a commit to Gonzih/simple_form that referenced this issue Nov 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

9 participants