Skip to content

Commit

Permalink
Add author and last updated fields (closes #47 and #40)
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr committed Jan 11, 2011
1 parent 99b4682 commit 1447dbc
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions 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.

Expand Down
1 change: 1 addition & 0 deletions 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,
Expand Down
1 change: 1 addition & 0 deletions 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,
Expand Down
9 changes: 8 additions & 1 deletion public/style.css
Expand Up @@ -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 {
Expand Down Expand Up @@ -113,6 +116,10 @@ h1 strong {
color: #A40802;
}

header p {
color: #999;
}

/* ARTICLE */

article {
Expand Down
13 changes: 13 additions & 0 deletions timeless/models/entry.rb
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion 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.