Urails
This presentation is the property of its rightful owner.
Sponsored Links
1 / 9

URails PowerPoint PPT Presentation


  • 89 Views
  • Uploaded on
  • Presentation posted in: General

URails. Meeting 003. Reminder.

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Urails

URails

Meeting 003


Reminder

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.


Ruby excercise

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)


Urails

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


Html excercise

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


Urails

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


Css cont

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)


Css cont1

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)


  • Login