1 / 9

URails

URails. Meeting 003. Reminder.

hisano
Download Presentation

URails

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. URails Meeting 003

  2. Reminder • There’s a lot of different technologies in web development, many of which have nothing to do with Rails. As we go, it will be a balancing act between learning generic web stuff and Rails stuff. So, if you feel we’re moving slowly, please hang in there! Once we get the basics out of the way, there’s some really cool stuff you can do.

  3. Ruby Excercise • Create a class called Fraction (in a file called “fraction.rb”) with the following methods: • Constructor that takes two numbers (numerator and denominator) • Accessors and mutators for numerator and denominator (as well as instance variables) • to_s method (toString) that prints “<num>/<den>” • to_f method (toFloat) that prints the floating-point form of the fraction • Create a script that does the following (don’t forget to require “fraction”) • Creates 3 Fraction objects • Creates an array • Stores your 3 Fraction objects in the array • Permutes the objects in the array in a random order (there’s a single method for this, look at the Array documentation!) • Loop through and print the contents of the Array to the console (using to_s on the Fraction) • Create a Hash with the same Fractions where the key is the fraction in english (i.e. if the fraction is 1/5, the symbol would be :one_fifth) • Iterate through the Hash, printing out the key and the value (using to_f on the Fraction)

  4. HTML • Review: <tag>…content…</tag> • Tags can have attributes: • <tag attr1=“some_value” attr2=“other_value”></tag> • HTML has tags defined for you: • <a>…</a> defines a link • a tags have an href attribute that tells a link where to go: <a href=“http://www.google.com”>Google</a> • <p>…</p> defines a “paragraph” • <ol>…</ol> and <ul>…</ul> define ordered and unordered lists • <table>…</table> makes a table • And more

  5. HTML Excercise • Split up into groups, I’ll assign you a tag • Tables • Images/Paragraphs/Formatting • Lists • Head • Go to www.w3schools.com -> “Learn HTML” • Find your assigned tag on the left • Figure it out (Read about it and build one yourself) • Pick someone to present your topic to the rest of the class • Explain what it’s for and how to use it

  6. CSS • Cascading Style Sheets • HTML defines content of a website, CSS defines the style • Adds Zaz to your website • Colors • Spacing • Fonts/Font styles • Borders • Go to www.w3schools.com again and check out CSS

  7. CSS (cont.) • You can add styles to predefined tags • More commonly, you add style to custom “selectors” of which there are two types • id (unique) • class (non-unique) • selectors are just attributes of a tag • <p class=“blue_background”>I’m blue!</p> • Note: CSS applies to id and class exactly the same, the only difference is id’s are supposed to be unique on a page, whereas many tags can use the same class. (Not necessarily respected by all browsers)

  8. CSS (cont.) • For spacing and formatting use div tags • div tags can have all the same CSS applied to them in terms of styling, but they can also have spacing • width • height • Box Model (see next slide)

More Related