From d228607e5096b1acd55e834acfd031c12a56c785 Mon Sep 17 00:00:00 2001 From: Lorin Werthen Date: Thu, 20 Apr 2017 23:06:45 +0200 Subject: [PATCH] blog previews update --- Gemfile | 2 +- Gemfile.lock | 8 ++-- .../assets/stylesheets/includes/blogpost.scss | 14 +++++++ layouts/archive_page.erb | 39 +++++++------------ layouts/partials/_blog_preview.erb | 18 +++++++++ 5 files changed, 50 insertions(+), 31 deletions(-) create mode 100644 layouts/partials/_blog_preview.erb diff --git a/Gemfile b/Gemfile index 00056f9..82c4ae3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ # frozen_string_literal: true source 'https://rubygems.org' -gem 'nanoc', '4.7.4' +gem 'nanoc', '4.7.7' # General filtering gem 'coffee-script' diff --git a/Gemfile.lock b/Gemfile.lock index 6d6ad1e..6b96971 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,7 +13,7 @@ GEM coffee-script-source (1.12.2) colored (1.2) concurrent-ruby (1.0.5) - cri (2.7.1) + cri (2.8.0) colored (~> 1.2) css_press (0.3.2) csspool-st (= 3.1.2) @@ -60,8 +60,8 @@ GEM css_press multi_js (0.1.0) uglifier (~> 2) - nanoc (4.7.4) - cri (~> 2.3) + nanoc (4.7.7) + cri (~> 2.8) ddplugin (~> 1.0) hamster (~> 3.0) ref (~> 2.0) @@ -111,7 +111,7 @@ DEPENDENCIES html_press icalendar kramdown - nanoc (= 4.7.4) + nanoc (= 4.7.7) sass terminal-notifier terminal-notifier-guard diff --git a/content/assets/stylesheets/includes/blogpost.scss b/content/assets/stylesheets/includes/blogpost.scss index b0274c7..41827bb 100644 --- a/content/assets/stylesheets/includes/blogpost.scss +++ b/content/assets/stylesheets/includes/blogpost.scss @@ -71,3 +71,17 @@ dl { background: $zeus-orange; } } + +.blog-preview { + position: relative; + + &::after { + content: ''; + position: absolute; + bottom: 20px; + left: 0; + background: linear-gradient(to bottom, transparent, white); + height: 100px; + width: 100%; + } +} diff --git a/layouts/archive_page.erb b/layouts/archive_page.erb index 756c39f..a77b803 100644 --- a/layouts/archive_page.erb +++ b/layouts/archive_page.erb @@ -22,31 +22,18 @@
- <% posts_in_year(item[:academic_year]).each do |post| %> - -
-
-
-

<%= post[:title] %>

-

- <% if post[:author] %> - door <%= post[:author] %> - <% end %> -

-
- <%= post[:description] %> -
- <%= post[:created_at] %> -
-
-
-
- <%= excerptize(post.reps[:text].compiled_content, length: 200).tr("\n", ' ')%> -
-
-
-
-
- <% end %> +
+
+ <% posts_in_year(item[:academic_year]).each_with_index.select {|e, i| i.even?}.map(&:first).each do |post| %> + <%= render '/partials/_blog_preview.*', post: post %> + <% end %> +
+ +
+ <% posts_in_year(item[:academic_year]).each_with_index.reject {|e, i| i.even?}.map(&:first).each do |post| %> + <%= render '/partials/_blog_preview.*', post: post %> + <% end %> +
+
diff --git a/layouts/partials/_blog_preview.erb b/layouts/partials/_blog_preview.erb new file mode 100644 index 0000000..c6bcfeb --- /dev/null +++ b/layouts/partials/_blog_preview.erb @@ -0,0 +1,18 @@ + +
+
+

<%= post[:title] %>

+

+ <%= post[:description] %> +

+
+ <% if post[:author] %> + door <%= post[:author] %> + <% end %> +
+ <%= post[:created_at] %> +
+ <%= excerptize(post.reps[:text].compiled_content, length: 200).tr("\n", ' ')%> +
+
+