Permalink
Browse files

Improve visualization of links to youtube videos

  • Loading branch information...
1 parent 814c0b7 commit b167e0ffc6f92be972affa0c592487c79580c515 @rrrene committed May 21, 2012
View
3 app/assets/javascripts/links.js.coffee
@@ -28,12 +28,15 @@ OUT.links =
if matched
video_id = matched[1]
insert_link_here.html youtube_thumb_template.replace(/%{video_id}/g, video_id)
+ content_item.addClass "content-item-link-with-thumb"
$('a[data-convert-into="youtube_embed_player"]').live "click", (event) ->
video_id = $(this).data("video-id")
$(this).replaceWith youtube_embed_template.replace(/%{video_id}/g, video_id)
false
$ ->
+ OUT.registerCreatedHandler "link", OUT.links.thumbnailizeVideoLinks
+ OUT.registerUpdatedHandler "link", OUT.links.thumbnailizeVideoLinks
OUT.links.thumbnailizeVideoLinks()
OUT.contentItems.highlightQueryIn(".content-items .content-item-link .content-item-body")
View
26 app/assets/stylesheets/application/links.css.sass
@@ -23,11 +23,27 @@
.content-item-link
.content-item-body
- small.href
- a
- color: #aaa
- &:hover
- text-decoration: none
+ .text,
+ .thumb
+ margin-top: 10px
+ .text
+ h2
+ line-height: 16px
+ small.href
+ a
+ color: #aaa
+ &:hover
+ text-decoration: none
+
+.content-item-link-with-thumb
+ .content-item-body
+ .text
+ float: left
+ width: 75%
+ .thumb
+ float: left
+ img
+ margin-right: 10px
form.link-edit
.controls
View
12 app/views/links/_show.html.haml
@@ -1,11 +1,11 @@
= render :partial => "content_items/timestamp", :locals => {:resource => resource}
-%h2= link_to inline_user_text(resource.title.presence || resource.href_without_protocol), resource.href, {:rel => :external, :class => :external, :target => '_blank'}
-%small.href= link_to resource.href, resource.href, {:rel => :external, :class => :external}
-
.thumb
-.clearboth
+.text
+ %h2= link_to inline_user_text(resource.title.presence || resource.href_without_protocol), resource.href, {:rel => :external, :class => :external, :target => '_blank'}
+ %small.href= link_to resource.href, resource.href, {:rel => :external, :class => :external}
+ - if resource.text.present?
+ %p= user_text resource.text
-- if resource.text.present?
- %p= user_text resource.text
+.clearboth

0 comments on commit b167e0f

Please sign in to comment.