diff options
Diffstat (limited to 'app/views/blogs')
| -rw-r--r-- | app/views/blogs/_blog.html.haml | 31 | ||||
| -rw-r--r-- | app/views/blogs/_list.html.haml | 5 | ||||
| -rw-r--r-- | app/views/blogs/index.atom.builder | 15 | ||||
| -rw-r--r-- | app/views/blogs/index.html.haml | 9 | ||||
| -rw-r--r-- | app/views/blogs/show.html.haml | 16 | ||||
| -rw-r--r-- | app/views/blogs/summary.html.haml | 1 | ||||
| -rw-r--r-- | app/views/blogs/voted.js.erb | 12 |
7 files changed, 80 insertions, 9 deletions
| diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index 91b1d20..34b343f 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml | |||
| @@ -1,3 +1,28 @@ | |||
| 1 | %article#blog-post | 1 | %article.blog-post.h-entry |
| 2 | %h2#blog-title= blog.title | 2 | %data.u-url{ value: url_for(blog) } |
| 3 | %section#blog-content.entry-content= blog.body.html_safe | 3 | %header |
| 4 | .post-calendar{ class: "post-date-#{(blog.visible_date.year - 2007) % 4 + 1}" } | ||
| 5 | %span.post-month= blog.visible_date.strftime("%^b") | ||
| 6 | %span.post-day= blog.visible_date.day | ||
| 7 | .blog-title | ||
| 8 | %h2.p-name= link_to_unless_current blog.title, blog | ||
| 9 | .post-author= blog.user.login.capitalize | ||
| 10 | %ul.post-tag-3 | ||
| 11 | - blog.tags.each do |tag| | ||
| 12 | %li= link_to tag, tag_url(tag.name), class: "p-category" | ||
| 13 | %blockquote#blog-content.entry-content.bubble.rounded.bottom.e-content | ||
| 14 | - if short and blog.has_read_more | ||
| 15 | = markdown(blog.short_body) | ||
| 16 | = link_to "Read more...", blog | ||
| 17 | - else | ||
| 18 | = markdown(blog.body) | ||
| 19 | %cite.bubble.blog-cite | ||
| 20 | %span.p-author.h-card | ||
| 21 | %strong.p-name= blog.user.login.capitalize | ||
| 22 | %data.u-url{ value: root_url } | ||
| 23 | on | ||
| 24 | %time.dt-published{ datetime: blog.visible_date.strftime("%Y-%m-%dT%H:%M:%SZ%z") }= blog.visible_date.strftime("%B #{blog.visible_date.day.ordinalize}, %Y at %-I:%M:%S%P") | ||
| 25 | .post-vote{ id: "blog-vote-section-#{blog.id}" } | ||
| 26 | %span.vote-link{ id: "blog-upvote-link-#{blog.id}" }= link_to_unless (not blog.published or blog.already_upvoted?(request.remote_ip)), "👍", upvote_blog_path(blog), remote: true, rel: "nofollow", class: "blog-upvote-link", method: :post | ||
| 27 | %span.post-rating{ id: "blog-rating-#{blog.id}" }= blog.upvotes | ||
| 28 | %span.vote-link{ id: "blog-downvote-link-#{blog.id}" }= link_to_unless (not blog.published or blog.already_downvoted?(request.remote_ip)), "👎", downvote_blog_path(blog), remote: true, rel: "nofollow", class: "blog-downvote-link", method: :post | ||
| diff --git a/app/views/blogs/_list.html.haml b/app/views/blogs/_list.html.haml new file mode 100644 index 0000000..3618bdb --- /dev/null +++ b/app/views/blogs/_list.html.haml | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | - if not @main_page | ||
| 2 | = will_paginate @blogs | ||
| 3 | - @blogs.each do |blog| | ||
| 4 | = render blog, short: true | ||
| 5 | = will_paginate @blogs | ||
| diff --git a/app/views/blogs/index.atom.builder b/app/views/blogs/index.atom.builder new file mode 100644 index 0000000..a05f29d --- /dev/null +++ b/app/views/blogs/index.atom.builder | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | atom_feed do |feed| | ||
| 2 | feed.title("Four Island") | ||
| 3 | feed.updated(@blogs[0].published_at) if @blogs.length > 0 | ||
| 4 | |||
| 5 | @blogs.limit(10).each do |blog| | ||
| 6 | feed.entry(blog, published: blog.published_at) do |entry| | ||
| 7 | entry.title(blog.title) | ||
| 8 | entry.content(markdown(blog.body), type: 'html') | ||
| 9 | |||
| 10 | entry.author do |author| | ||
| 11 | author.name("hatkirby") | ||
| 12 | end | ||
| 13 | end | ||
| 14 | end | ||
| 15 | end | ||
| diff --git a/app/views/blogs/index.html.haml b/app/views/blogs/index.html.haml new file mode 100644 index 0000000..75bf92f --- /dev/null +++ b/app/views/blogs/index.html.haml | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #blog-archive | ||
| 2 | %h2 Blog Archive | ||
| 3 | .bubble.rounded | ||
| 4 | - @blogs.chunk {|blog| blog.published_at.strftime("%B %Y") }.each do |chunk| | ||
| 5 | %h3= chunk[0] | ||
| 6 | - chunk[1].each do |blog| | ||
| 7 | %p.archive-link | ||
| 8 | = link_to blog.title, blog | ||
| 9 | %small= blog.published_at.strftime("%-d %b %Y") | ||
| diff --git a/app/views/blogs/show.html.haml b/app/views/blogs/show.html.haml index 8ab4523..32d44bd 100644 --- a/app/views/blogs/show.html.haml +++ b/app/views/blogs/show.html.haml | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | .breadcrumb= link_to "← Back to home page", root_path | 1 | - title @blog.title |
| 2 | = render @blog | 2 | - unless @prev.nil? |
| 3 | %footer#blog-footer | 3 | .back-post= link_to "← #{@prev.title}", @prev |
| 4 | This entry was posted on | 4 | - unless @next.nil? |
| 5 | = succeed "." do | 5 | .next-post= link_to "#{@next.title} →", @next |
| 6 | %time= @blog.published_at.strftime("%B #{@blog.published_at.day.ordinalize}, %Y at %-I:%M:%S%P") | 6 | .clear |
| 7 | = render @blog, short: false | ||
| 8 | = show_comments(@blog) | ||
| 9 | - content_for :meta_sidebar_content do | ||
| 10 | = link_to "Edit this post", edit_admin_blog_url(@blog.id) | ||
| diff --git a/app/views/blogs/summary.html.haml b/app/views/blogs/summary.html.haml new file mode 100644 index 0000000..79811b1 --- /dev/null +++ b/app/views/blogs/summary.html.haml | |||
| @@ -0,0 +1 @@ | |||
| = render "list" | |||
| diff --git a/app/views/blogs/voted.js.erb b/app/views/blogs/voted.js.erb new file mode 100644 index 0000000..951c740 --- /dev/null +++ b/app/views/blogs/voted.js.erb | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | $("#blog-rating-<%= @blog.id %>").html('<%= escape_javascript("#{@blog.upvotes - @blog.downvotes}") %>'); | ||
| 2 | |||
| 3 | <% if @blog.already_upvoted? request.remote_ip %> | ||
| 4 | $("#blog-upvote-link-<%= @blog.id %>").html("👍"); | ||
| 5 | <% elsif @blog.already_downvoted? request.remote_ip %> | ||
| 6 | $("#blog-downvote-link-<%= @blog.id %>").html("👎"); | ||
| 7 | <% else %> | ||
| 8 | $("#blog-upvote-link-<%= @blog.id %>").html('<%= escape_javascript(link_to("👍", upvote_blog_path(@blog), remote: true, rel: "nofollow", class: "blog-upvote-link", method: :post)) %>'); | ||
| 9 | $("#blog-downvote-link-<%= @blog.id %>").html('<%= escape_javascript(link_to("👎", downvote_blog_path(@blog), remote: true, rel: "nofollow", class: "blog-downvote-link", method: :post)) %>'); | ||
| 10 | <% end %> | ||
| 11 | |||
| 12 | $("#blog-vote-section-<%= @blog.id %>").effect('highlight', {}, 2000); | ||
