fix blog index and links

This commit is contained in:
Torsten Ruger 2018-04-10 22:48:23 +03:00
parent d233cb0dca
commit c143b5bbd0
5 changed files with 21 additions and 18 deletions

View File

@ -1,2 +1,9 @@
module ApplicationHelper module ApplicationHelper
def post_link(index)
post = Post.posts.values[index]
return "" unless post
link = post.date.to_s + " "
link += link_to( post.title , blog_post_url(post.slug))
link.html_safe
end
end end

View File

@ -1,9 +1,9 @@
.blog.blog_index .blog.blog_index
- @pages.each do |slug , page| - @posts.each do |slug , post|
.row .row
.col-md-2 .col-md-2
.col-md-8 .col-md-8
%h2= link_to page.title , blog_page_url(page.slug) %h2= link_to post.title , blog_post_url(post.slug)
= render( page.template_name )[0 ... 350].html_safe = render( "posts/#{post.template_name}" )[0 ... 350].html_safe
%span.whole= link_to ". . . .Read whole post" , blog_page_url(page.slug) %span.whole= link_to ". . . .Read whole post" , blog_post_url(post.slug)
.col-md-2 .col-md-2

View File

@ -77,13 +77,8 @@
%a{:href => "https://groups.google.com/forum/#!forum/ruby-x"} mail %a{:href => "https://groups.google.com/forum/#!forum/ruby-x"} mail
%h2.center News %h2.center News
%p %p
Last but not least, i try to get recent developments down on paper when they are still fresh. Last but not least, i try to get recent developments down on paper when they are
%p still fresh.
{{ site.posts[0].date | date: "%d.%m.%y" }}: %p=post_link(0)
%a{:href => "{{ site.posts[0].url }}"} {{ site.posts[0].title }} %p=post_link(1)
%p %p=post_link(2)
{{ site.posts[1].date | date: "%d.%m.%y" }}:
%a{:href => "{{ site.posts[1].url }}"} {{ site.posts[1].title }}
%p
{{ site.posts[2].date | date: "%d.%m.%y" }}:
%a{:href => "{{ site.posts[2].url }}"} {{ site.posts[2].title }}

View File

@ -7,10 +7,11 @@
The The
%a{:href => "/rubyx/layers.html"} architecture %a{:href => "/rubyx/layers.html"} architecture
document outlines this in more detail, but in short: document outlines this in more detail, but in short:
\- types are immutable %ul
\- every object has a type (which may change) %li types are immutable
\- a type implements the interface of a class at a given time %li every object has a type (which may change)
\- a type is defined by a list of attribute names %li a type implements the interface of a class at a given time
%li a type is defined by a list of attribute names
%p %p
%img{:alt => "Types diagram", :src => "/assets/types.jpg"}/ %img{:alt => "Types diagram", :src => "/assets/types.jpg"}/
%h3#how-classes-work How classes work %h3#how-classes-work How classes work