Skip to content

Commit 3b2e081

Browse files
seurosvagrant
authored and
vagrant
committed
Added timestamp to protip.
I'm not happy about the style, but we will fix it later.
1 parent 02150f9 commit 3b2e081

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ gem 'sanitize'
132132
gem 'simple_form'
133133
gem 'tweet-button'
134134
gem 'mail_view'
135+
gem 'local_time'
135136

136137
# Mongo
137138
gem 'mongoid'

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ GEM
340340
celluloid (>= 0.15.2)
341341
rb-fsevent (>= 0.9.3)
342342
rb-inotify (>= 0.9)
343+
local_time (1.0.0)
344+
coffee-rails
343345
loofah (2.0.0)
344346
nokogiri (>= 1.5.9)
345347
lumberjack (1.0.9)
@@ -745,6 +747,7 @@ DEPENDENCIES
745747
launchy
746748
letter_opener!
747749
linkedin
750+
local_time
748751
mail
749752
mail_view
750753
memcachier

app/assets/javascripts/protips.js.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#= require blur
66
#= require jquery.filedrop
77
#= require vendor/jquery.textselection
8+
#= require local_time
89

910
window.handle_redirect = (response)->
1011
window.location = response.to if (response.status == "redirect")

app/assets/stylesheets/protip.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,6 @@ body.protip-single {
562562
color: #757575;
563563
background: #e6e6e6;
564564
text-align: center;
565-
padding: 0;
566565
height: 25px;
567566
line-height: 25px;
568567
@include border-radius(4px);
@@ -623,6 +622,7 @@ body.protip-single {
623622
//share-this-tip
624623

625624
.tip-header {
625+
position: relative;
626626
max-width: inherit;
627627
.tip-title {
628628
width: 75%;
@@ -635,7 +635,14 @@ body.protip-single {
635635
color: #333;
636636
}
637637
}
638-
//h1
638+
//TODO fix this
639+
.timestamp {
640+
position:absolute;
641+
right: 9px;
642+
bottom: -29px;
643+
font-size: 1.1em;
644+
color: #a2a2a2;
645+
}
639646
}
640647

641648
.views {
@@ -758,6 +765,7 @@ body.protip-single {
758765

759766
.tip-content {
760767
max-width: inherit;
768+
margin-top: 20px;
761769

762770
.links {
763771
float: right;

app/views/protips/_protip.html.haml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.inside.cf.x-protip-pane
2-
//.blur-screen
32
.tip-container.cf.x-protip-content.protip-single#x-protip{:class => mode}
43
%aside.tip-sidebar
54
.user-box
@@ -92,13 +91,17 @@
9291
- if is_admin?
9392
=link_to 'delete', delete_tag_protip_path(protip.public_id, CGI.escape(tag)), :method => :post, :class => "delete"
9493

94+
//Time stamp
95+
%div.timestamp.cf
96+
= local_time_ago(protip.created_at)
97+
9598
- if is_admin?
9699
%ul.admin-tag-links.cf
97100
%li=link_to 'flag', flag_protip_path(protip), :method => :post, :remote => true, :class => (protip.flagged? ? 'flagged' : "") + " flag"
98101
%li=link_to 'feature', feature_protip_path(protip), :method => :post, :remote => true, :class => (protip.featured? ? 'featured' : "") + " feature"
99102
%li=link_to('delete', protip_path(protip.public_id), :method => :delete, :class => 'delete-tip del', :rel => 'nofollow', :title => 'remove protip', :confirm => "Are you sure you permanently want to remove this pro tip?")
100103

101-
//.tip-body.tip-content
104+
%hr
102105
%div.tip-content
103106
=raw sanitize(protip.to_html)
104107

0 commit comments

Comments
 (0)