asciinema.org/app/controllers/home_controller.rb

38 lines
659 B
Ruby
Raw Normal View History

2012-03-04 21:44:04 +00:00
class HomeController < ApplicationController
2012-03-04 21:44:04 +00:00
def show
render locals: {
asciicast: asciicast,
featured_asciicasts: featured_asciicasts,
latest_asciicasts: latest_asciicasts
}
2012-03-04 21:44:04 +00:00
end
private
def asciicast
id = CFG['HOME_CAST_ID']
asciicast = if id
asciicast_repository.find(id)
else
asciicast_repository.last
end
asciicast && asciicast.decorate
end
def latest_asciicasts
asciicast_repository.latest_limited(3).decorate
end
def featured_asciicasts
asciicast_repository.random_featured_limited(3).decorate
end
def asciicast_repository
Asciicast
end
2012-03-04 21:44:04 +00:00
end