From 2c006d5fdf2a3cf09ba9daafc316361f7eb33e84 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sat, 8 Dec 2012 18:21:24 +0100 Subject: [PATCH] Improve AsciicastDecorator#description --- app/decorators/asciicast_decorator.rb | 8 ++++++-- app/views/asciicasts/show.html.erb | 6 +----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/decorators/asciicast_decorator.rb b/app/decorators/asciicast_decorator.rb index 7d8de7d..066b4d0 100644 --- a/app/decorators/asciicast_decorator.rb +++ b/app/decorators/asciicast_decorator.rb @@ -107,8 +107,12 @@ class AsciicastDecorator < ApplicationDecorator end def description - text = asciicast.description.to_s - markdown(text) + if asciicast.description.present? + text = asciicast.description.to_s + markdown(text) + else + h.content_tag :em, 'No description.' + end end def author_profile_link(options = {}) diff --git a/app/views/asciicasts/show.html.erb b/app/views/asciicasts/show.html.erb index 9ef45bb..35bf16a 100644 --- a/app/views/asciicasts/show.html.erb +++ b/app/views/asciicasts/show.html.erb @@ -9,11 +9,7 @@

<%= @asciicast.title %>

- <% if @asciicast.description.present? -%> - <%= @asciicast.description %> - <% else -%> - No description. - <% end -%> + <%= @asciicast.description %>