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

Bootstrap-2.0 inputs have wrappers? #56

Open
pareeohnos opened this issue Apr 18, 2012 · 8 comments
Open

Bootstrap-2.0 inputs have wrappers? #56

pareeohnos opened this issue Apr 18, 2012 · 8 comments

Comments

@pareeohnos
Copy link

I'm trying to use this gem and I'm having a few minor issues with the markup that is being produced.
I'm using the following code :

                        <%= home.label 'Address' do |controls| %> 
                <%= controls.text_field :home_name, :class => 'span3', :placeholder => "Building name/number" %>
                <%= controls.text_field :home_name, :class => 'span3', :placeholder => "Road" %>
                <%= controls.text_field :home_name, :class => 'span3', :placeholder => "Town" %>
                <%= controls.text_field :home_name, :class => 'span3', :placeholder => "County" %>
                <%= controls.text_field :home_name, :class => 'span2', :placeholder => "Postcode" %>
            <% end %>

Which is producing nearly the right format, however each of the input tags are being wrapped in a span with a class of input. So for example

<div class="control-group" id="field_control_group">
    <label class="control-label" for="field">Label</label>
    <div class="controls">
        <span class="input">
            <input class="span3" id="field" name="fields[field]" size="30" type="text" />
        </span>
    </div>
</div>

As a result, the bootstrap styling breaks and doesn't work the way it's meant to work.
Is there any easy way to get rid of this or disable this?

Thanks

@stouset
Copy link
Owner

stouset commented Apr 20, 2012

Are you using Twitter Bootstrap 2?

@pareeohnos
Copy link
Author

Sure am yeah.

@stouset
Copy link
Owner

stouset commented Apr 20, 2012

Use the bootstrap-2.0 branch. I need to fix a few remaining bugs and gemify it, but it should work.

@pareeohnos
Copy link
Author

That's the branch I'm using? At least I should be? Certainly the output it's producing is in line with bootstrap-2.0 apart from the extra span. I'll grab it again and re-install and see if it helps

@stouset
Copy link
Owner

stouset commented Apr 20, 2012

Ah, apologies. Have had a lot of bug reports from people still using the 1.3-compatible version. Can I see the full code for the form? You're missing the twitter_bootstrap_form_for line in your example.

@pareeohnos
Copy link
Author

Ah fair enough. yeah sure thing, here you go


<%= twitter_bootstrap_form_for @CareHome, :html => { :class => "form-horizontal" } do |home| %>

        <%= home.fieldset do %>

            <div class="page-header">
                <h1>Sign Up <small>Register your care home</small></h1>
            </div>

            <%= home.text_field :home_name, :class => 'span3', :placeholder => "The name of your care home" %>

            <%= home.label 'Name' do |controls| %> 
                <%= controls.text_field :home_name, :class => 'span3', :placeholder => "The name of your care home" %>
            <% end %>

            <%= home.label 'Homepage' do |controls| %> 
                <%= controls.text_field :home_name, :class => 'span2', :placeholder => "The home page you would like", :add_on => :append do %>
                    <span class="add-on">.euphoricare.com</span>
                <% end %>
            <% end %>

            <%= home.label 'Address' do |controls| %> 
                <%= controls.text_field :home_name, :class => 'span3', :placeholder => "Building name/number" %>
                <%= controls.text_field :home_name, :class => 'span3', :placeholder => "Road" %>
                <%= controls.text_field :home_name, :class => 'span3', :placeholder => "Town" %>
                <%= controls.text_field :home_name, :class => 'span3', :placeholder => "County" %>
                <%= controls.text_field :home_name, :class => 'span2', :placeholder => "Postcode" %>
            <% end %>


            <%= home.actions do %>
                <%= home.submit 'Sign Up'%>
            <% end %>

        <% end %>
    <% end %>

I realise the form names are all the same but I'm just testing around with stuff

@stouset
Copy link
Owner

stouset commented Apr 20, 2012

Looks reasonable to me. I'll try and figure out what's going on tonight. At work right now.

@pareeohnos
Copy link
Author

That'd be fantastic thanks! I'm glad I'm not just doing something stupid. No hurry though, I can work around it for now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants