You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/app/controllers/home_controller.rb

40 lines
708 B
Ruby

class HomeController < ApplicationController
def show
@title = "Share Your Terminal With No Fuss"
render locals: {
asciicast: asciicast,
featured_asciicasts: featured_asciicasts,
latest_asciicasts: latest_asciicasts
}
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.latest_featured_limited(3).decorate
end
def asciicast_repository
Asciicast
end
end