Chapter 5 Flashcards
how can we test if links on a page work correctly?
write a integration test to check it
bootstrap
open-source web design framework from twitter.
wireframes
rough sketches of what the eventual application will look like
git checkout master
go to master branch
git checkout -b filling-in-layout
create new branch and move to it
HTML5 shim(or shiv)
some old browsers dont support HTML5 so we include some javascript code known as HTML shim or shiv to work around the issue
header class=”navbar navbar-fixed-top navbar-inverse”
indicates elements that should go at the top of the page. given tag three CSS classes separated by spaces.
html classes and ids
merely labels, and are useful for styling with CSS. classes can be used multiple times on a page, but ids can be used only once.
<div></div>
div tag is a generic division. it doesnt do anything apart from divide the documents into distict parts. in this case, the div has a css class ‘container’. as with headers tag classes, this class has special meaning to bootstrap.
<li>
</li>
rails helper link_to to create links. link_to is the link text, while the second is the url, we will fill in the url with named routes, but for now we use the stub url ‘#’.
ul tag
unordered list
tag
used to more clearly communicate the purpose of the navigation links.
<ul class="nav navbar-nav navbar-right"> <li><a href="#">Home</a></li> <li><a href="#">Help</a></li> <li><a href="#">Log in</a></li> </ul>
after evaluating embedded ruby, the html code looks like this.
<div>
</div>
container has special meaning to bootstrap. yield method inserts the contents of each page into the site layout
convert to html
<a>Sign up now!</a> stub link
<div></div>
the jumbotron css class has special meaning to bootstrap
embedded ruby:
link_to image_tag(“rails.png”, alt: “Rails logo”),
‘http://rubyonrails.org/’
shows off the image_tag helper, which takes arguments the path to an image and an optional options hash, alt attribute of the image tag using symbols. for this to work, there needs to be an image called rails.png
use curl to move png image to rails app:
curl -0 http://rubyonrails.org/images/rails.png
mv rails.png app/assets/images/
<img></img>
9308b8f92fea4c19a3a0d8385b494526is added to rails to ensure that the filename is unique, whcih causes browsers to load images properly when they have been updated. src doesnt include images in the path, instead using assets directory common to all assets. on the server rails associates images in the assets directory with the proper directory.
alt
display text if image cannot be displayed
benefit of bootstrap
makes our applications design responsive, ensuring that it looks sensible across a wide range of devices