Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Build a Simple Ruby on Rails Application Customizing Forms Installing simple_form

Laura Butler
Laura Butler
3,251 Points

New status page formatting huge issues

Hi

I get to this step and all is going fine then I go into new status in my browser and the formatting is all weird. It looks like the nav bar has extended over the rest of the page and neither the submit nor the back button are clickable.

There is nothing in my css that would prompt this appearance and even when I commented out the nav bar nothing changed.

Any thoughts?

Brandon Barrette
Brandon Barrette
20,485 Points

Share us your code and/or screen shots please.

2 Answers

Daniel Cunningham
Daniel Cunningham
21,109 Points

Hello, I'm not sure if you're still working on this course, but I have had the same issue. It looks to me like it's an issue with the way Bootstrap has been changed and simple_form has not been updated to adjust to it.

As Jim Hoskens brings up around 5:50 in the video, simple form brings up the classes "Control-group", "text" and "optional". After looking through what I downloaded a couple weeks ago in bootstrap, I cannot find any of those CSS forms in bootstrap.

Bootstrap (on the website) appears to use different divs for the label and the text area. "col-sm-2" for the field and "col-sm-10" for the text area. The label and input are wrapped in the "form-group" class and the entire form is in the class "horizontal-form". Because of this, I am abandoning the use of simple_form as it will apply the same CSS wrappers to both the label and the input box.

Unfortunately, it kind of invalidates following the video, but from what I'm seeing, this type of styling isnt critical to getting the functionality behind the website.

It's easier to not use simple_form. To get the text area just add the following code to the _form.html.erb file in the app/views/statuses directory. replace:

html.erb
  <%= form_for(@status) do |f| %>

with:

html.erb
  <%= form_for(@status, html: {class: "form-horizontal" }) do |f| %>

and replace:

html.erb
  <div class="field">
    <%= f.label :content %><br>
    <%= f.text_area :content %>
  </div>

with:

html.erb
  <div class="form-group">
    <%= f.label :content, class: "col-sm-2 control-label" %>
    <div class="col-sm-10">
      <%= f.text_area :content, class: "form-control" %>
    </div>
  </div>

This should normally make it work :-)