2012-03-04 21:44:04 +00:00
|
|
|
class HomeController < ApplicationController
|
2013-05-27 20:03:53 +00:00
|
|
|
before_filter :load_asciicast
|
|
|
|
|
2012-03-04 21:44:04 +00:00
|
|
|
def show
|
2012-08-02 07:21:23 +00:00
|
|
|
@title = "Share Your Terminal With No Fuss"
|
|
|
|
|
2013-05-27 20:03:53 +00:00
|
|
|
if @asciicast
|
|
|
|
@asciicast = AsciicastDecorator.new(@asciicast)
|
2012-07-25 20:59:18 +00:00
|
|
|
end
|
|
|
|
|
2013-05-27 19:23:46 +00:00
|
|
|
@asciicasts = AsciicastDecorator.decorate_collection(
|
2012-08-21 18:25:50 +00:00
|
|
|
Asciicast.order("created_at DESC").limit(9).includes(:user)
|
2012-07-25 20:59:18 +00:00
|
|
|
)
|
2012-03-04 21:44:04 +00:00
|
|
|
end
|
2013-05-27 20:03:53 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def load_asciicast
|
|
|
|
if id = CFG['HOME_CAST_ID']
|
|
|
|
@asciicast = Asciicast.find(id)
|
|
|
|
else
|
|
|
|
@asciicast = Asciicast.order("created_at DESC").first
|
|
|
|
end
|
|
|
|
end
|
2012-03-04 21:44:04 +00:00
|
|
|
end
|