Just decorate.

openid
Marcin Kulik 12 years ago
parent 560ab8362a
commit 44e23bf003

@ -40,7 +40,7 @@ class AsciicastsController < ApplicationController
respond_to do |format|
format.html do
@asciicast_author = UserDecorator.new(@asciicast.user)
@title = @asciicast.smart_title
@title = @asciicast.title
respond_with @asciicast
end

@ -64,13 +64,13 @@ class AsciicastDecorator < ApplicationDecorator
end
end
def shell_name
File.basename(shell.to_s)
def shell
File.basename(asciicast.shell.to_s)
end
def smart_title
if title.present?
title
def title
if asciicast.title.present?
asciicast.title
elsif command.present?
"$ #{command}"
else
@ -98,8 +98,8 @@ class AsciicastDecorator < ApplicationDecorator
@thumbnail
end
def formatted_description
text = model.description.to_s
def description
text = asciicast.description.to_s
markdown(text)
end

@ -8,7 +8,7 @@ class UserMailer < ActionMailer::Base
@asciicast = AsciicastDecorator.new(@comment.asciicast)
to = "~#{user.nickname} <#{user.email}>"
subject = %(New comment for #{@asciicast.smart_title})
subject = %(New comment for #{@asciicast.title})
mail :to => to, :subject => subject
end
end

@ -7,7 +7,7 @@
<div class="info">
<h3>
<%= link_to preview.smart_title, preview %>
<%= link_to preview.title, preview %>
</h3>
<p class="date">

@ -7,10 +7,10 @@
<section class="supplimental">
<div class="wrapper">
<div class="main">
<h1><%= @asciicast.smart_title %></h1>
<h1><%= @asciicast.title %></h1>
<div class="description">
<% if @asciicast.description.present? -%>
<%= @asciicast.formatted_description %>
<%= @asciicast.description %>
<% else -%>
<em>No description.</em>
<% end -%>
@ -49,7 +49,7 @@
OS: <%= @asciicast.os %>
</li>
<li>
SHELL: <%= @asciicast.shell_name %>
SHELL: <%= @asciicast.shell %>
</li>
<li>
TERM: <%= @asciicast.terminal_type || '?' %>

@ -1,6 +1,6 @@
Howdy!
~<%= @author.nickname %> (<%= profile_url(@author) %>) commented on your asciicast "<%= @asciicast.smart_title %>":
~<%= @author.nickname %> (<%= profile_url(@author) %>) commented on your asciicast "<%= @asciicast.title %>":
<%= indented @comment.body, 4 %>

Loading…
Cancel
Save