From 66db199aab14687eb882d45b9998bba7390d5b20 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 4 Mar 2012 20:59:53 +0100 Subject: [PATCH] Display asciicast author and creation time --- app/assets/stylesheets/asciicasts.css.scss | 9 +++++++++ app/helpers/asciicasts_helper.rb | 10 ++++++++++ app/views/asciicasts/show.html.erb | 8 ++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/asciicasts.css.scss b/app/assets/stylesheets/asciicasts.css.scss index de86a4e..eaff551 100644 --- a/app/assets/stylesheets/asciicasts.css.scss +++ b/app/assets/stylesheets/asciicasts.css.scss @@ -659,6 +659,15 @@ $color5: #EDC951; .bg254 { background-color: #e4e4e4 } .bg255 { background-color: #eeeeee } + .meta { + .avatar { + width: 24px; + padding: 1px; + background-color: white; + border: 1px solid #ccc; + } + } + .description { color: #3e3e3e; font-family: arial, helvetica; diff --git a/app/helpers/asciicasts_helper.rb b/app/helpers/asciicasts_helper.rb index 0f69e5f..e39daf8 100644 --- a/app/helpers/asciicasts_helper.rb +++ b/app/helpers/asciicasts_helper.rb @@ -10,6 +10,16 @@ module AsciicastsHelper end end + def asciicast_author(asciicast) + if asciicast.user + link_to avatar_img(asciicast.user) + " #{asciicast.user.nickname}", '#' + end + end + + def asciicast_time(asciicast) + time_ago_in_words(asciicast.created_at) + " ago" + end + def player_script(asciicast) return < diff --git a/app/views/asciicasts/show.html.erb b/app/views/asciicasts/show.html.erb index eb3935d..956e877 100644 --- a/app/views/asciicasts/show.html.erb +++ b/app/views/asciicasts/show.html.erb @@ -1,6 +1,10 @@ -

<%= asciicast_title(@asciicast) %>

-
+

<%= asciicast_title(@asciicast) %>

+

+ <%= asciicast_author(@asciicast) %> + <%= asciicast_time(@asciicast) %> +

+