Improved front page
This commit is contained in:
parent
beb6c1e17f
commit
e6b1a49ed9
|
@ -75,14 +75,15 @@ ul.tla {
|
||||||
}
|
}
|
||||||
|
|
||||||
ol.posts {
|
ol.posts {
|
||||||
list-style-type: square;
|
list-style-type: none;
|
||||||
color: #e0e0e0;
|
|
||||||
|
|
||||||
list-style-image: none;
|
list-style-image: none;
|
||||||
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0 0 24px 0;
|
margin: 0 0 24px 0;
|
||||||
|
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -90,17 +91,7 @@ ol.posts {
|
||||||
|
|
||||||
span.date {
|
span.date {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
float: left;
|
text-align: left;
|
||||||
|
|
||||||
width: 60px;
|
|
||||||
|
|
||||||
margin-top: -1px;
|
|
||||||
margin-right: 14px;
|
|
||||||
|
|
||||||
text-align: right;
|
|
||||||
font-size: 11px;
|
|
||||||
|
|
||||||
color: #a0a0a0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,10 @@ title: Ariejan's Blog
|
||||||
%section#middle_content
|
%section#middle_content
|
||||||
|
|
||||||
#posts
|
#posts
|
||||||
- articles_by_year_for_two_columns.each do |column_articles|
|
- articles_by_year(sorted_articles).each do |year, articles|
|
||||||
.one_half
|
%ol.posts
|
||||||
- column_articles.each do |year, articles|
|
- articles.each do |article|
|
||||||
%ol.posts
|
%li
|
||||||
- articles.each do |article|
|
%span.date= get_short_date(article)
|
||||||
%li
|
–
|
||||||
%span.date= get_short_date(article)
|
= link_to article[:title], article.path, title: article[:title]
|
||||||
= link_to article[:title], article.path, title: article[:title]
|
|
||||||
|
|
|
@ -1,34 +1,26 @@
|
||||||
module PostHelper
|
module PostHelper
|
||||||
def articles_by_year(articles)
|
def articles_by_year(articles)
|
||||||
hash = Hash.new { |h, k| h[k] = [] }
|
hash = Hash.new { |h, k| h[k] = [] }
|
||||||
articles.inject(hash) do |output, article|
|
articles.inject(hash) do |output, article|
|
||||||
year = attribute_to_time(article[:created_at]).year
|
year = attribute_to_time(article[:created_at]).year
|
||||||
output[year] << article
|
output[year] << article
|
||||||
output
|
output
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def articles_by_year_for_two_columns
|
|
||||||
half_mark = sorted_articles.size / 2
|
|
||||||
half_one = sorted_articles[0..half_mark-1]
|
|
||||||
half_two = sorted_articles[half_mark..-1]
|
|
||||||
|
|
||||||
[articles_by_year(half_one), articles_by_year(half_two)]
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_short_date(post)
|
|
||||||
attribute_to_time(post[:created_at]).strftime('%Y-%m-%d')
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_pretty_date(post)
|
|
||||||
attribute_to_time(post[:created_at]).strftime('%-d %B, %Y')
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_tags(post)
|
|
||||||
if post[:tags].nil? || post[:tags].empty?
|
|
||||||
"(not tagged)"
|
|
||||||
else
|
|
||||||
post[:tags].compact.map { |tag| tag.downcase }.sort.join(", ")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_short_date(post)
|
||||||
|
attribute_to_time(post[:created_at]).strftime('%Y-%m-%d')
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_pretty_date(post)
|
||||||
|
attribute_to_time(post[:created_at]).strftime('%-d %B, %Y')
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_tags(post)
|
||||||
|
if post[:tags].nil? || post[:tags].empty?
|
||||||
|
"(not tagged)"
|
||||||
|
else
|
||||||
|
post[:tags].compact.map { |tag| tag.downcase }.sort.join(", ")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user