-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathurl_routing_example.rb
62 lines (55 loc) · 1.17 KB
/
url_routing_example.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Shoes.app(title: 'Advanced URL Routing Example', width: 300, height: 200) do
style(Shoes::Para, size: 10)
style(Shoes::Button, width: 80)
url '/', :index
url '/about', :about
url '/contact', :contact
url '/user/(\d+)', :user
url '/product/(\w+)', :product
def index
background '#f0f0f0'
title 'Home Page'
para 'Welcome to the advanced URL routing example!'
button 'About' do
visit '/about'
end
button 'Contact' do
visit '/contact'
end
button 'User 42' do
visit '/user/42'
end
button 'Product XYZ' do
visit '/product/XYZ'
end
end
def about
background '#DFA5A5'
title 'About Page'
para 'This is the About page.'
home_button
end
def contact
background '#A5DFA5'
title 'Contact Page'
para 'This is the Contact page.'
home_button
end
def user(id)
background '#A5A5DF'
title 'User Page'
para "This is the page for User #{id}"
home_button
end
def product(name)
background '#DFDF A5'
title 'Product Page'
para "This is the page for Product #{name}"
home_button
end
def home_button
button 'Home' do
visit '/'
end
end
end