Permalink
Browse files

Add date & client to tweets.

  • Loading branch information...
1 parent d3c0f2c commit adcc31560184f069e06a47f61be69b15e4de13b7 @paulmillr paulmillr committed Apr 9, 2012
Showing with 767 additions and 15 deletions.
  1. +8 −0 app/lib/view_helper.coffee
  2. +14 −14 app/styles/main.styl
  3. +10 −1 app/views/templates/tweet.hbs
  4. +735 −0 vendor/scripts/moment.js
@@ -54,3 +54,11 @@ Handlebars.registerHelper 'with_user', (options) ->
Handlebars.registerHelper 'auto_link', (options) ->
new Handlebars.SafeString twttr.txt.autoLink options.fn this
+
+Handlebars.registerHelper 'format_date', (options) ->
+ date = new Date options.fn this
+ new Handlebars.SafeString moment(date).fromNow()
+
+Handlebars.registerHelper 'unless_source_is_web', (source, options) ->
+ string = if source is 'web' then '' else options.fn this
+ new Handlebars.SafeString string
View
@@ -1,9 +1,9 @@
@import 'nib'
-black = #000
-lightblack = #333
-gray = #999
-white = #fff
+$black = #000
+$lightblack = #333
+$gray = #999
+$white = #fff
*
box-sizing: border-box
@@ -18,7 +18,7 @@ body
border: 1px solid rgba(0, 0, 0, .1)
border-radius: 6px
border-top-left-radius: 13
- background-color: white
+ background-color: $white
background-clip: padding-box
.avatar
@@ -33,9 +33,6 @@ body
width: 32px
height: 32px
-.username
- color: gray
-
.navbar-fixed-top .container, .navbar-fixed-bottom .container, .container
width: 885px
@@ -106,7 +103,7 @@ h1
font-size: 14px
&-metadata
font-size: 11px
- color: gray
+ color: $gray
.stats
margin: 0
@@ -121,7 +118,7 @@ h1
font-size: 10px
line-height: 16px
text-transform: uppercase
- color: gray
+ color: $gray
border: solid #e8e8e8
border-width: 0 1px 0 0
&:first-child
@@ -131,7 +128,7 @@ h1
strong
display: block
font-size: 14px
- color: lightblack
+ color: $lightblack
.status
padding: 12px
@@ -142,7 +139,7 @@ h1
&-text
padding: 10px
&-character-count
- color: gray
+ color: $gray
&-invalid
color: #b83535
@@ -166,11 +163,14 @@ h1
&-content
margin-left: 58px
&-author-full-name
- color: lightblack
+ color: $lightblack
&-author-username
- color: gray
+ color: $gray
&-text
-webkit-margin-after: 0
word-wrap: break-word
&-footer
overflow: hidden
+ color: $gray
+ a, a:visited
+ color: $gray
@@ -8,5 +8,14 @@
</a>
</header>
<p class="tweet-text">{{#auto_link}}{{text}}{{/auto_link}}</p>
- <footer class="tweet-footer"></footer>
+ <footer class="tweet-footer">
+ <a href="http://twitter.com/{{user.screen_name}}/status/{{id_str}}">
+ <time datetime="{{created_at}}">
+ {{#format_date}}{{created_at}}{{/format_date}}
+ </time>
+ </a>
+ {{#unless_source_is_web source}}
+ via <span class="tweet-client">{{{source}}}</span>
+ {{/unless_source_is_web}}
+ </footer>
</div>
Oops, something went wrong.

0 comments on commit adcc315

Please sign in to comment.