Permalink
Browse files

Added embedly support.

  • Loading branch information...
1 parent 5f52b4a commit a8e886b67e68c0d8544abed972a05750e3e44ccd @bnolan bnolan committed Dec 5, 2010
@@ -9,5 +9,10 @@ def header_tab(text, path)
("<li class='#{(url == request.request_uri) and 'active'}'>" + link_to(text, url) + "</li>").html_safe
end
-
+
+ def content_format(c)
+ auto_link(c, :html => { :class => 'external' }) do |text|
+ truncate(text.sub(/^http...www./,''), :length => 25)
+ end
+ end
end
@@ -5,7 +5,7 @@
</div>
<div class="grid_5">
<h4><%= link_to a.user.name, a.user %></h4>
- <p class="content"><%= a.content %></p>
+ <p class="content"><%= content_format a.content %></p>
<p class="meta">
About <%= time_ago_in_words a.created_at %> ago |
<% if a.likes.collect(&:user).include? current_user %>
@@ -30,7 +30,9 @@ a.likes.length > 1 ? "like" : "likes" %> this.
<% a.comments.each do |c| %>
<div class="comment">
<%= image_tag 'avatar.png', :class => 'micro avatar' %>
- <%= link_to c.user.name, c.user %> <%= c.content %><br />
+ <p class="content">
+ <%= link_to c.user.name, c.user %> <%= content_format c.content %>
+ </p>
<span class="meta"><%= time_ago_in_words c.created_at %> ago</span>
</div>
<% end %>
@@ -3,7 +3,7 @@
<head>
<title>Diaspora*x <%= (t = yield(:title).present?) ? " :: #{t}" : "" %></title>
<%= stylesheet_link_tag :all %>
- <%= javascript_include_tag 'jquery','jquery-ui', 'rails','application' %>
+ <%= javascript_include_tag 'jquery','jquery-ui', 'rails', 'jquery.embedly', 'application' %>
<%= csrf_meta_tag %>
</head>
<body>
@@ -41,4 +41,6 @@ app.initialize = function(){
$(document).ready(function(){
app.initialize();
+
+ $('p.content a').embedly({ maxWidth : 360, 'method' : 'afterParent' });
});
Oops, something went wrong.

0 comments on commit a8e886b

Please sign in to comment.