diff --git a/app/presenters/asciicast_page_presenter.rb b/app/presenters/asciicast_page_presenter.rb
index 99a6096..5c015c6 100644
--- a/app/presenters/asciicast_page_presenter.rb
+++ b/app/presenters/asciicast_page_presenter.rb
@@ -1,4 +1,6 @@
class AsciicastPagePresenter
+ include ActionView::Helpers::SanitizeHelper
+ include ActionView::Helpers::TextHelper
attr_reader :routes, :asciicast, :current_user, :policy, :playback_options
@@ -100,6 +102,14 @@ class AsciicastPagePresenter
asciicast.description
end
+ def short_text_description
+ if asciicast.description.present?
+ truncate(strip_tags(asciicast.description).gsub(/\n+/, ' '), length: 200)
+ else
+ "Recorded by #{asciicast.user.display_name}"
+ end
+ end
+
def show_other_asciicasts_by_author?
author.asciicast_count > 1
end
diff --git a/app/views/asciicasts/_discovery_tags.html.erb b/app/views/asciicasts/_discovery_tags.html.erb
index f2e50b7..ad00f77 100644
--- a/app/views/asciicasts/_discovery_tags.html.erb
+++ b/app/views/asciicasts/_discovery_tags.html.erb
@@ -7,5 +7,5 @@
-
+