[5.1.1] Flesh out the application layout

As a first step toward adding links and styles to the sample
application, we'll update the site layout file application.html.erb with
additional HTML structure. This includes some additional divisions, some
CSS classes, and the start of our site navigation.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:adding_to_the_layout
[5.1.1] Spruce up the home page

Apart from the site footer, our layout is now complete, and we can look
at the results by visiting the Home page. To take advantage of the
upcoming style elements, we'll add some extra elements to the
home.html.erb view.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:adding_to_the_layout
[5.1.2] Add Bootstrap

Our first step is to add Bootstrap, which in Rails applications can be
accomplished with the bootstrap-sass gem. The Bootstrap framework
natively uses the LESS CSS language for making dynamic stylesheets, but
the Rails asset pipeline supports the (very similar) Sass language by
default, so bootstrap-sass converts LESS to Sass and makes all the
necessary Bootstrap files available to the current application.

The first step in adding custom CSS to our application is to create a
file to contain it.  After creating the file for custom CSS, we can use
the @import function to include Bootstrap.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:custom_css
[5.1.2] Add custom CSS

Next we'll add some CSS that will be used site-wide for styling the
layout and each individual page.  Although Bootstrap comes with CSS
rules for nice typography, we'll also add some custom rules for the
appearance of the text on our site (Not all of these rules apply to the
Home page, but each rule here will be used at some point in the sample
application.)

Finally, we'll add some rules to style the site's logo, which simply
consists of the text "sample app". We've used a CSS id because we expect
the site logo to appear on the page only once, but you could use a class
instead.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:custom_css
[5.1.3] Separate shim and header into partials

Although the layout in application.html.erb serves its purpose, it's
getting a little cluttered. The HTML shim takes up three lines and uses
weird IE-specific syntax, so it would be nice to tuck it away somewhere
on its own. In addition, the header HTML forms a logical unit, so it
should all be packaged up in one place. The way to achieve this in Rails
is to use a facility called partials.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:partials
[5.1.3] Add footer to layout

Now that we know how to make partials, let's add a site footer to go
along with the header. By now you can probably guess that we’ll call it
_footer.html.erb and put it in the layouts directory.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:partials
[5.2.2] Convert footer CSS to take advantage of SASS

Sass is a language for writing stylesheets that improves on CSS in many
ways. In this section, we cover two of the most important improvements,
nesting and variables.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:sass
[5.3.2] Create named routes for all pages

Now that we've finished a site layout with decent styling, it's time
to start filling in the links we've stubbed out with '#'. Of course,
we could hard-code links like

    <a href="/static_pages/about">About</a>

but that isn't the Rails Way. For one, it would be nice if the URI for
the about page were /about rather than /static_pages/about; moreover,
Rails conventionally uses named routes, which involves code like

    <%= link_to "About", about_path %>

This way the code has a more transparent meaning, and it's also more
flexible since we can change the definition of about_path and have the
URI change everywhere about_path is used.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:layout_links
[5.3.3] Set links to use named routes

Let's put the named routes created in Section 5.3.2 to work in our
layout. This will entail filling in the second arguments of the link_to
functions with the proper named routes. For example, we'll convert

    <%= link_to "About", '#' %>

to

    <%= link_to "About", about_path %>

and so on.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:named_routes
[5.3.4] Refactor rspec tests

We noted in Section 5.3.1 that the tests for the static pages are
getting a little verbose and repetitive. In this section we'll make use
of the latest features of RSpec to make our tests more compact and
elegant.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:pretty_rspec
[5.4.1] Generate users controller

It's been a while since we created our first controller, the StaticPages
controller, way back in Section 3.1.2. It's time to create a second one,
the Users controller. As before, we'll use generate to make the simplest
controller that meets our present needs, namely, one with a stub signup
page for new users. Following the conventional REST architecture favored
by Rails, we'll call the action for new users new and pass it as an
argument to generate controller to create it automatically:

    $ rails generate controller Users new --no-test-framework

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:users_controller
[5.4.2] Generate integration tests for users controller

With the code from Section 5.4.1, we already have a working page for new
users at /users/new, but recall from Table 5.1 that we want the URI to
be /signup instead. As in Section 5.3, we’ll first write some
integration tests, which we’ll now generate:

    $ rails generate integration_test user_pages

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:signup_url
[5.4.2] Route signup page to /signup

With the code from Section 5.4.1, we already have a working page for new
users at /users/new, but recall that we want the URI to be /signup
instead.

[Source] http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:signup_url
Merge branch 'filling-in-layout'