Add episode names, split the constants out into a separate data file.
This commit is contained in:
parent
78a98deb26
commit
4b9a5c83e6
2 changed files with 406 additions and 9 deletions
|
@ -1,12 +1,10 @@
|
|||
require 'camping'
|
||||
|
||||
# Camping is a great small framework.
|
||||
Camping.goes :StargateRando
|
||||
|
||||
# This holds all our constant data.
|
||||
module StargateRando::Data
|
||||
SERIES_SHORT_NAMES = ['SG-1', 'SGA', 'SGU']
|
||||
SERIES_NAMES = { 'SG-1' => 'Stargate SG-1', 'SGA' => 'Stargate Atlantis', 'SGU' => 'Stargate Universe'}
|
||||
SEASONS_PER_SERIES = { 'SG-1' => 10, 'SGA' => 5, 'SGU' => 2}
|
||||
end
|
||||
# Data was moved out to stargaterando-data.rb to keep this file clean
|
||||
require './stargaterando-data'
|
||||
|
||||
# This holds our (currently there's only one) controllers.
|
||||
module StargateRando::Controllers
|
||||
|
@ -34,8 +32,8 @@ module StargateRando::Controllers
|
|||
|
||||
chosen_episode = 1 + rand(num_episodes)
|
||||
|
||||
@episode_code = "#{chosen_season}x#{chosen_episode}"
|
||||
@episode_and_season = "Season #{chosen_season}: Episode #{chosen_episode}"
|
||||
@episode_and_season = "Season #{chosen_season} Episode #{chosen_episode}"
|
||||
@episode_name = Data::EPISODES["#{chosen_series_id}|#{chosen_season}x#{chosen_episode}"]
|
||||
render :results
|
||||
end
|
||||
end
|
||||
|
@ -57,7 +55,8 @@ module StargateRando::Views
|
|||
end
|
||||
|
||||
def results
|
||||
h1 "You should watch #{@series}: #{@episode_and_season}"
|
||||
h1 "You should watch: "
|
||||
h2 "#{@series}: #{@episode_and_season}: #{@episode_name}"
|
||||
button :onclick => "document.location.reload()", :id => "reload" do
|
||||
"Get a new episode"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue