diff --git a/app/controllers/public/comments_controller.rb b/app/controllers/public/comments_controller.rb index fa8c2e4..ed19e42 100644 --- a/app/controllers/public/comments_controller.rb +++ b/app/controllers/public/comments_controller.rb @@ -8,7 +8,7 @@ class Public::CommentsController < ApplicationController if @comment.save commentable = @comment.commentable - + @comment_id = @comment.id @comment = Comment.new @comment.commentable = commentable diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index c1e8abb..a9925b1 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -53,7 +53,7 @@ %footer - Sauf mention contraire, textes & photos créés par + Sauf mentions contraires, textes & photos créés par =link_to "Nicolas Bally", "mailto:info@nicolasbally.com" sous =link_to "license Creative Commons (BY-NC-ND)", "http://creativecommons.org/licenses/by-nc-nd/3.0/fr/", :target => "_blank" diff --git a/app/views/public/articles/_article.html.haml b/app/views/public/articles/_article.html.haml index f58f2eb..ea414b6 100644 --- a/app/views/public/articles/_article.html.haml +++ b/app/views/public/articles/_article.html.haml @@ -12,11 +12,21 @@ Nicolas Bally + %time.updated{:datetime => Time.now, :pubdate => true} publié ="le "+l(article.published_at, :format => :human_date) + %p{:style => "margin-top:1em;"} + -if article.comments.count == 0 + =link_to "Pas de commentaires", article_path(:slug => article.slug, :anchor => "comments") + -elsif article.comments.count == 1 + =link_to "1 commentaire", article_path(:slug => article.slug, :anchor => "comments") + -else + =link_to "#{article.comments.count} commentaires", article_path(:slug => article.slug, :anchor => "comments") + + %h1=link_to article.title, article_path(:slug => article.slug), :title => "Blog de Nicolas Bally "+article.title.to_s diff --git a/app/views/public/articles/_article_intro.html.haml b/app/views/public/articles/_article_intro.html.haml index 5aeb5e1..ffe51ee 100644 --- a/app/views/public/articles/_article_intro.html.haml +++ b/app/views/public/articles/_article_intro.html.haml @@ -16,6 +16,16 @@ publié ="le "+l(article.published_at, :format => :human_date) + %p{:style => "margin-top:1em;"} + -if article.comments.count == 0 + =link_to "Pas de commentaires", article_path(:slug => article.slug, :anchor => "comments") + -elsif article.comments.count == 1 + =link_to "1 commentaire", article_path(:slug => article.slug, :anchor => "comments") + -else + =link_to "#{article.comments.count} commentaires", article_path(:slug => article.slug, :anchor => "comments") + + + %h1=link_to article.title, article_path(:slug => article.slug), :title => "blog conseil en image : "+article.title.to_s diff --git a/app/views/public/comments/_comment.html.haml b/app/views/public/comments/_comment.html.haml index 3e355b6..f90dc24 100644 --- a/app/views/public/comments/_comment.html.haml +++ b/app/views/public/comments/_comment.html.haml @@ -1,9 +1,9 @@ -.comment - %aside=gravatar_image_tag(comment.email? ? comment.email : comment.pseudo, :gravatar => {:default => :identicon}) +.comment#comment{:class => ("author" if comment.email == "info@nicolasbally.com"), :id => comment.id} + %aside=gravatar_image_tag(comment.email? ? comment.email : comment.pseudo, :gravatar => {:default => "http://#{HOSTNAME}/assets/front/default_avatar.jpg"}) %p.header - =gravatar_image_tag(comment.email? ? comment.email : comment.pseudo, :gravatar => {:default => :identicon}) + Commentaire de %strong diff --git a/app/views/public/comments/create.js.erb b/app/views/public/comments/create.js.erb index 2960e4b..b559899 100644 --- a/app/views/public/comments/create.js.erb +++ b/app/views/public/comments/create.js.erb @@ -1,3 +1,12 @@ $("#comment_form").html("<%= escape_javascript(render(:partial => "form")) %>"); -$("#comments").html("<%= escape_javascript(render(@comment.commentable.comments.recents)) %>"); \ No newline at end of file +$("#comments").html("<%= escape_javascript(render(@comment.commentable.comments.recents)) %>"); + + + + + + +$(document.body).animate({ + 'scrollTop': ( $("#comment_<%= @comment_id %>").offset().top - 150) +}, 700); \ No newline at end of file