Skip to content

Commit ba65af2

Browse files
committed
Initial import
0 parents  commit ba65af2

File tree

6 files changed

+158
-0
lines changed

6 files changed

+158
-0
lines changed

app.rb

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
require 'sinatra'
2+
3+
get '/' do
4+
erb :index
5+
end
6+
7+
get '/fruit' do
8+
@fruits = ["Bananas", "Apples", "Raspberries", "Oranges", "Pineapples", "Mangoes"]
9+
erb :fruits_view
10+
end
11+
12+
get '/oldest_dogs' do
13+
# for more info http://en.wikipedia.org/wiki/List_of_oldest_dogs
14+
@dogs = ["Max", "Bella", "Bluey", "Lady", "Minius", "Bramble", "Adjutant", "Butch"]
15+
erb :oldest_dogs_view
16+
end
17+
18+
19+
get '/countries' do
20+
@countries = list_of_countries
21+
erb :countries_view
22+
end
23+
24+
get '/simpsons' do
25+
@simpsons = list_of_simpsons
26+
erb :simpsons_view
27+
end
28+
29+
def list_of_countries
30+
[
31+
["UK", "London"],
32+
["France", "Paris"],
33+
["Spain", "Madrid"],
34+
["Norway", "Oslo"],
35+
["Italy", "Rome"],
36+
["Germany", "Berlin"]
37+
]
38+
end
39+
40+
def list_of_simpsons
41+
[
42+
{ :name => "Homer", :age => 38, :gender => "M", :catchphrase => "D'oh!", :pic => "http://simpsons.wikia.com/wiki/Homer_Simpson?file=Homer_Simpson.png"},
43+
{ :name => "Marge", :age => 34, :gender =>"F" , :catchphrase => "Hmm...", :pic =>"http://images.wikia.com/simpsons/images/0/0b/Marge_Simpson.png"},
44+
{ :name => "Bart", :age => 10, :gender => "M", :catchphrase => "Eat My Shorts!", :pic =>"http://images.wikia.com/simpsons/images/6/65/Bart_Simpson.png"},
45+
{ :name => "Lisa", :age =>8, :gender =>"F", :catchphrase => "Trust in yourself and you can achieve anything.", :pic =>"http://images.wikia.com/simpsons/images/5/57/Lisa_Simpson2.png"},
46+
{ :name => "Maggie", :age => 1, :gender => "F", :catchphrase => "", :pic => "http://images.wikia.com/simpsons/images/8/89/Maggie.png"}
47+
]
48+
end

views/countries_view.erb

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>List all the things</title>
5+
<!-- Latest compiled and minified CSS -->
6+
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css">
7+
</head>
8+
<body>
9+
<div class='container'>
10+
11+
<h1>List of countries</h1>
12+
13+
<!-- put your table here -->
14+
15+
</div>
16+
</body>
17+
</html>

views/fruits_view.erb

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>List all the things</title>
5+
<!-- Latest compiled and minified CSS -->
6+
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css">
7+
</head>
8+
<body>
9+
<div class='container'>
10+
11+
<h1>List of fruits</h1>
12+
13+
<ul>
14+
<% @fruits.each do |fruit| %>
15+
<li><%= fruit %></li>
16+
<% end %>
17+
</ul>
18+
19+
20+
</div>
21+
</body>
22+
</html>

views/index.erb

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>List all the things</title>
5+
<!-- Latest compiled and minified CSS -->
6+
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css">
7+
<style>
8+
h1 { background-color: yellow;}
9+
</style>
10+
</head>
11+
<body>
12+
<div class='container'>
13+
<h1>List all the things</h1>
14+
<p class='text-center'>
15+
<img alt="List all the things" src="http://i.qkme.me/3vctmh.jpg">
16+
</p>
17+
<div class="row">
18+
<div class='col-lg-3'>
19+
<h2><a href='/fruit'>Fruit</a></h2>
20+
</div>
21+
<div class='col-lg-3'>
22+
<h2><a href='/oldest_dogs'>Oldest dogs</a></h2>
23+
</div>
24+
<div class='col-lg-3'>
25+
<h2><a href='/countries'>Countries</a></h2>
26+
</div>
27+
<div class='col-lg-3'>
28+
<h2><a href='/simpsons'>Simpsons</a></h2>
29+
</div>
30+
</div>
31+
32+
</div>
33+
</body>
34+
</html>

views/oldest_dogs_view.erb

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>List all the things</title>
5+
<!-- Latest compiled and minified CSS -->
6+
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css">
7+
</head>
8+
<body>
9+
<div class='container'>
10+
11+
<h1>List of oldest dogs</h1>
12+
13+
<!-- put your list here -->
14+
15+
16+
17+
18+
<p>For more info see <a href="http://en.wikipedia.org/wiki/List_of_oldest_dogs">here</a>.</p>
19+
</div>
20+
</body>
21+
</html>

views/simpsons_view.erb

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>List all the things</title>
5+
<!-- Latest compiled and minified CSS -->
6+
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css">
7+
</head>
8+
<body>
9+
<div class='container'>
10+
<h1>List of Simpsons</h1>
11+
12+
<!-- put your profiles here -->
13+
14+
</div>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)