Today
+ <% @today.each do |item| %> +<%= item.first %>: <%= item.last %>
+ <% end %> +Tomorrow
--
<% @tomorrow.each do |item| %>
-
- <%= item.first %>: <%= item.last %> +
<%= item.first %>: <%= item.last %>
<% end %> -diff --git a/Gemfile b/Gemfile old mode 100644 new mode 100755 diff --git a/Gemfile.lock b/Gemfile.lock old mode 100644 new mode 100755 diff --git a/Procfile b/Procfile old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 diff --git a/app.rb b/app.rb old mode 100644 new mode 100755 index 68e111c..b52d31f --- a/app.rb +++ b/app.rb @@ -3,15 +3,22 @@ class App < Sinatra::Base get '/' do @error = params['error'] + @full_name = params['full_name'] + @city = params['city'] erb :home end + get '/home' do + redirect to('/') + end + post '/subscribe' do @full_name = params[:full_name] @email = params[:email] + @city = params[:city] if !@email.match(/.+@.+/) - redirect to('/?error=email') + redirect to('/?error=email&full_name='+@full_name+'&city='+@city) end erb :subscribe @@ -49,8 +56,12 @@ class App < Sinatra::Base erb :schedule end -end + get '/rainbow' do + erb :rainbow + end + +end class App < Sinatra::Base get '/fib/:n' do # TODO: implement an algorithm to calculate the fibonacci sequence at @@ -63,8 +74,29 @@ class App < Sinatra::Base # separated names. Randomize this list of names and display it as an # ordered list (
Please enter a valid email
+<%= @full_name %>, please enter a valid email
+<%= item.first %>: <%= item.last %>
+ <% end %> +<%= item.first %>: <%= item.last %>
<% end %> -Thanks for subscribing <%= @full_name %>
- +Your city is <%=@city%>
Home diff --git a/views/training.erb b/views/training.erb new file mode 100755 index 0000000..f945050 --- /dev/null +++ b/views/training.erb @@ -0,0 +1,2 @@ +