Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ gem 'rake'
gem 'activesupport'
gem 'sinatra'
gem 'sinatra-contrib'
gem 'shotgun'
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ GEM
rack-test (0.6.1)
rack (>= 1.0)
rake (0.9.2.2)
shotgun (0.9)
rack (>= 1.0)
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
Expand All @@ -33,5 +35,6 @@ PLATFORMS
DEPENDENCIES
activesupport
rake
shotgun
sinatra
sinatra-contrib
16 changes: 13 additions & 3 deletions theweb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
require 'sinatra/reloader'
enable :sessions

get '/' do
erb :dashboard
end
#get '/' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I don't like commented out code) -- just delete it, you can always get it back through git.

# erb :dashboard
#end

post '/number' do
@number_of_randoms = session[:number_of_randoms] || 0
Expand All @@ -16,3 +16,13 @@
@the_number = rand(number_as_string)
erb :number
end

get '/' do
list = [ 'I\'m a new fan of Ice Hockey.',
'My favourite team is the Chicago Blackhawks.',
'I like Purple.',
'The next language I\'m learning is Python.'
]
@factoid = list.shuffle.first
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could also do the following -- it's literally the same thing but reads a little better.

@factoid = list.sample

erb :about
end
2 changes: 2 additions & 0 deletions views/about.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>About Me</h1>
<h2>A factoid about me - <%= @factoid %></h2>
4 changes: 2 additions & 2 deletions views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<a class="brand" href="/">Randomizer</a>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li class="active"><a href="/">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
Expand All @@ -58,7 +58,7 @@

<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<%= yield %>
<%= yield %>
</div>

<!-- Example row of columns -->
Expand Down