Permalink
Browse files

Add author and last updated fields (closes #47 and #40)

  • Loading branch information...
1 parent 99b4682 commit 1447dbcd3f79f8184f5307740f849375e092e59c @judofyr judofyr committed Jan 11, 2011
View
1 content/simplicity-is-difficult
@@ -1,5 +1,6 @@
Title: Simplicity is difficult
Subtitle: Do the minimum, 'cuz YAGNI
+Author: Steve Klabnik
Advice is really easy to give to others, but really hard to take yourself.
View
1 content/there-is-no-talent
@@ -1,5 +1,6 @@
Title: There is no talent
Subtitle: ... only passion
+Author: Magnus Holm
I'm good with computers. At least compared with others at my age. And believe
me, I've heard it a lot: "Wow, you really have a talent there!" Well,
View
1 content/why-there-is-no-talent
@@ -1,5 +1,6 @@
Title: Why there is no talent
Subtitle: ... and there's still only passion
+Author: Magnus Holm
*Note: This is a more scientific follow-up to another essay called ["There is
no talent"](/there-is-no-talent). I recommend you to read that essay first,
View
9 public/style.css
@@ -16,9 +16,12 @@ h1, h2, h3, h4, h5, h6 {
line-height: 1.2;
}
+header {
+ margin-bottom: 20px;
+}
+
h1 {
font-size: 36px;
- margin-bottom: 20px;
}
p, ul, ol, pre, hr {
@@ -113,6 +116,10 @@ h1 strong {
color: #A40802;
}
+header p {
+ color: #999;
+}
+
/* ARTICLE */
article {
View
13 timeless/models/entry.rb
@@ -40,6 +40,19 @@ def title
def subtitle
file? ? "" : maruku.get_setting(:subtitle) || ""
end
+
+ def author
+ maruku.get_setting(:author) unless file?
+ end
+
+ def last_updated
+ if defined?(@last_updated)
+ @last_updated
+ else
+ str = maruku.get_setting(:last_updated)
+ @last_updated = Time.parse(str)
+ end
+ end
def to_snip
Maruku.new(content(true)).to_html
View
7 timeless/views/entry.haml
@@ -1,4 +1,9 @@
%header
%h1= @entry.title
-
+ %p
+ - if @entry.author
+ Written by #{@entry.author}.
+ - if @entry.last_updated
+ Last updated in #{@entry.last_updated.strftime("%B %Y")}.
+
%p!= @entry.to_html

0 comments on commit 1447dbc

Please sign in to comment.