Chapter 5 Flashcards
What should a mockup/wireframe include?
User interface, links, buttons, etc
What is a mockup/wireframe, and why is it important?
A rough sketch of what the application will eventually look like; it allows you to work towards a goal.
To support older browsers which can’t parse HTML5 elements, what JavaScript script should be added, and where?
HTML5shim should be added in the head
What is the difference between a class an an ID?
Classes can be used multiple times on a page, ID’s can only be used once.
T/F: only one class may be assigned to a tag.
F; you can assign multiple classes by separating them with a space
What are header, nav, and section tags for?
They are used like div tags, except that they also describe the location of the element on the page.
What are the three arguments to the link_to function, and what purpose does the function serve?
It creates a link on the page.
The first argument is the link text, next is the url, and last is an options hash for CSS purposes
When using the image_tag helper, where will Rails look for the image?
app/assets/images/
What are the arguments to image_tag?
The path of the image and an options hash, used to set attributes
Why does rails place all assets in the same directory when operating on a server?
It allows them to be served faster.
What is Bootstrap?
A framework from Twitter which allows for design and UI elements in HTML5
What is a .css.scss file?
A Sass-CSS file
How can we include bootstrap?
After getting the gem, add the following lines to a sass file in the asset pipeline:
@import “bootstrap-sprockets”;
@import “bootstrap”;
What is a good way to test out what a CSS rule does?
Comment it out and see what changes
Why is the CSS of a style sheet in the app/assets/stylesheets/ directory universal?
It is applied to all pages, and if no class or ID is specified then all tags as well. The higher level of the tag (I.e. html is the highest tag) then the more tags that will be affected.
What does the ‘render’ function do?
Inserts the evaluation of a file into the view.
What is the naming convention or partials?
Add an underscore (_) to the beginning of the file name
What is a partial?
A way, in Rails, to package up assets in one place.
Describe the asset directories of the asset pipeline.
App, lib, and vendor directories each have an assets directory, which in turn has a subdirectory for images, javascripts, and stylesheets
What are manifest files of the asset pipeline?
Files to tell Rails how to combine javascripts and CSS into single files
What is the preprocessor engine of the asset pipeline?
Processes files in a manner depending on their extension, for delivery to browser. Files with multiple extension are evaluated right to left, with the rightmost (last) extension determining the first processor.
Why is the asset pipeline efficient?
It allows assets to be logically split into different files, but Rails optimizes them and combined them into a single ole for speedy delivery to a browser
What is the syntax for nesting pseudo-classes in sass?
&:pseudoclassname{}
What is the syntax for defining a variable in sass?
$varname: value;
Say we want to add a page, what are the steps to take?
Add a route, add a controller action, and add an erb view
How can we defined a named route?
get ‘routename’ => ‘controller#action’
T/F: named routes will not work in other files; they are only for the server.
F; once a route has been named it can be used anywhere else
What routes does the following named route define:
get ‘help’ => ‘static_pages#help’
help_path, which is ‘/help’
help_url, which is the full, unabbreviated URL
What is an integration test, and how is one defined?
It is a test of our application’s behavior.
It can be generated with:
$rails generate integration_test testname