Mark private and featured asciicasts

This commit is contained in:
Marcin Kulik 2015-05-15 17:36:12 +00:00
parent d9a754685a
commit 6f0d55b22a
6 changed files with 30 additions and 1 deletions

View File

@ -105,3 +105,13 @@
font-size: 12px
margin-bottom: 5px
padding: 6px
.special-label
font-size: 12px
background-color: rgb(255, 239, 198)
color: rgb(161, 136, 43)
margin-left: 6px
padding: 2px 5px
border-radius: 4px
vertical-align: middle
cursor: help

View File

@ -126,6 +126,14 @@ class AsciicastPagePresenter
routes.oembed_url(url: routes.asciicast_url(asciicast), format: format)
end
def show_private_label?
asciicast.private?
end
def show_featured_label?
asciicast.featured?
end
private
def author

View File

@ -0,0 +1 @@
<span class="special-label" title="This is a *featured* asciicast - it's listed on the homepage too.">featured</span>

View File

@ -10,6 +10,10 @@
.info.clearfix
h2
= link_to asciicast.title, asciicast
- if asciicast.private?
= render 'asciicasts/private_label'
- if asciicast.featured?
= render 'asciicasts/featured_label'
span.duration = asciicast.formatted_duration
span.author-avatar = asciicast.author_img_link
small by #{asciicast.author_link} #{time_ago_tag asciicast.created_at}

View File

@ -0,0 +1 @@
<span class="special-label" title="Private asciicasts are not listed on the site and are hidden from search engines. However they're visible to anyone you give the URL.">private</span>

View File

@ -14,7 +14,12 @@
.row
.col-md-8.col-xs-8
span.author-avatar = page.author_img_link
h2 = page.asciicast_title
h2
= page.asciicast_title
- if page.show_private_label?
= render 'private_label'
- if page.show_featured_label?
= render 'featured_label'
small by #{page.author_link} #{time_ago_tag page.asciicast_created_at}
.col-md-4.col-xs-4.text-right