-
Notifications
You must be signed in to change notification settings - Fork 1
/
languagecoach.rb
91 lines (70 loc) · 1.53 KB
/
languagecoach.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
require "sinatra"
require "sinatra/reloader" if development?
require "sinatra/content_for"
require "tilt/erubis"
require 'csv'
configure do
set :erb, :escape_html => true
end
get "/" do
@title = "Home"
erb :front_page, layout: :layout
end
get "/coachbot" do
@title = "CoachBot"
erb :coachbot, layout: :layout
end
get "/masterarabic" do
@title = "Master Arabic"
erb :masterarabic, layout: :layout
end
get "/coaching" do
@title = "Coaching"
erb :coaching, layout: :layout
end
get "/podcast" do
@title = "Podcast"
erb :podcast, layout: :layout
end
get "/about" do
@title = "About"
erb :about, layout: :layout
end
get "/howmuchtime" do
@title = "Coachbot - How much time do you have?"
erb :howmuchtime, layout: :layout
end
get "/fivemintask" do
@task_length = '5'
@title = "Five Minute Task"
show_task
end
get "/tenmintask" do
@task_length = '10'
@title = "Ten Minute Task"
show_task
end
get "/twentymintask" do
@task_length = '20'
@title = "Twenty Minute Task"
show_task
end
get "/thirtymintask" do
@task_length = '30'
@title = "Thirty Minute Task"
show_task
end
get "/sixtymintask" do
@task_length = '60'
@title = "Sixty Minute Task"
show_task
end
def show_task
filename = "./public/tasks" + @task_length + "mins.csv"
task = CSV.read(filename).shuffle.first
@task_name = task[0]
@task_extra_information = task[1]
@refresh_task_path = %w(fivemintask tenmintask twentymintask
thirtymintask sixtymintask).shuffle.first
erb :task, layout: :layout
end