Use asciicast title in page title

openid
Marcin Kulik 12 years ago
parent 1e2e8bfcc3
commit 8b504d8fea

@ -15,6 +15,7 @@ class AsciicastsController < ApplicationController
end
def show
@title = @asciicast.smart_title
respond_with @asciicast
end

@ -1,15 +1,5 @@
module AsciicastsHelper
def asciicast_title(asciicast)
if asciicast.title.present?
asciicast.title
elsif asciicast.command.present?
"$ #{asciicast.command}"
else
"##{asciicast.id}"
end
end
def profile_link(asciicast, options = {})
if asciicast.user
if options[:avatar]

@ -83,4 +83,14 @@ class Asciicast < ActiveRecord::Base
end
end
end
def smart_title
if title.present?
title
elsif command.present?
"$ #{command}"
else
"##{id}"
end
end
end

@ -1,6 +1,6 @@
<li class="asciicast-preview">
<h3>
<%= link_to asciicast_title(asciicast), asciicast %>
<%= link_to asciicast.smart_title, asciicast %>
<span class="meta">
<% if asciicast.user || asciicast.username %>

@ -1,6 +1,6 @@
<div class="page-header asciicast-heading">
<h1>
<span class="title"><%= asciicast_title(@asciicast) %></span>
<span class="title"><%= @asciicast.smart_title %></span>
<% if current_user && @asciicast.user == current_user %>
<% if @asciicast.title.blank? %>

@ -36,7 +36,7 @@
</p>
<div class="featured-asciicast">
<h3><%= asciicast_title(@asciicast) %></h3>
<h3><%= @asciicast.smart_title %></h3>
<%= render :partial => 'asciicasts/asciicast',
:object => @asciicast,

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>ascii.io</title>
<title><% if @title %><%= @title + " - "%><% end %>ascii.io</title>
<%= airbrake_javascript_notifier %>
<%= csrf_meta_tags %>

Loading…
Cancel
Save