diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/blogs/_blog.html.haml | 2 | ||||
-rw-r--r-- | app/views/blogs/show.html.haml | 5 | ||||
-rw-r--r-- | app/views/comments/_comment.html.haml | 13 | ||||
-rw-r--r-- | app/views/comments/_form.html.haml | 23 | ||||
-rw-r--r-- | app/views/comments/_layout.html.haml | 6 |
5 files changed, 44 insertions, 5 deletions
diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index 26657e7..8972c2e 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml | |||
@@ -15,4 +15,4 @@ | |||
15 | %cite.bubble | 15 | %cite.bubble |
16 | %strong Hatkirby | 16 | %strong Hatkirby |
17 | on | 17 | on |
18 | = blog.published_at.strftime("%m-%d-%Y") | 18 | = blog.published_at.strftime("%B #{blog.published_at.day.ordinalize}, %Y at %-I:%M:%S%P") |
diff --git a/app/views/blogs/show.html.haml b/app/views/blogs/show.html.haml index 9bff12b..0c549ac 100644 --- a/app/views/blogs/show.html.haml +++ b/app/views/blogs/show.html.haml | |||
@@ -1,7 +1,4 @@ | |||
1 | - title @blog.title | 1 | - title @blog.title |
2 | .breadcrumb= link_to "← Back to home page", root_path | 2 | .breadcrumb= link_to "← Back to home page", root_path |
3 | = render @blog, short: false | 3 | = render @blog, short: false |
4 | %footer#blog-footer | 4 | = show_comments(@blog) |
5 | This entry was posted on | ||
6 | = succeed "." do | ||
7 | %time= @blog.published_at.strftime("%B #{@blog.published_at.day.ordinalize}, %Y at %-I:%M:%S%P") | ||
diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml new file mode 100644 index 0000000..3e10759 --- /dev/null +++ b/app/views/comments/_comment.html.haml | |||
@@ -0,0 +1,13 @@ | |||
1 | .blog-comment | ||
2 | %blockquote.bubble.rounded.bottom | ||
3 | = image_tag comment.gravatar_url, class: "comment-avatar" | ||
4 | = markdown(comment.body, { restricted: true }) | ||
5 | .clear | ||
6 | %cite.bubble | ||
7 | %strong | ||
8 | - if comment.website.empty? | ||
9 | = comment.username | ||
10 | - else | ||
11 | = link_to comment.username, comment.website | ||
12 | on | ||
13 | = comment.published_at.strftime("%B #{comment.published_at.day.ordinalize}, %Y at %-I:%M:%S%P") | ||
diff --git a/app/views/comments/_form.html.haml b/app/views/comments/_form.html.haml new file mode 100644 index 0000000..f6df807 --- /dev/null +++ b/app/views/comments/_form.html.haml | |||
@@ -0,0 +1,23 @@ | |||
1 | = form_for @comment || blog.comments.new, html: { id: "comment-form" } do |f| | ||
2 | %fieldset#comment-body-field | ||
3 | %blockquote.bubble.rounded.bottom | ||
4 | = f.label :body | ||
5 | = f.text_area :body | ||
6 | %cite.bubble Feel free to post a comment! You may use Markdown. | ||
7 | - if @comment and @comment.errors.any? | ||
8 | %ul#form-errors | ||
9 | - @comment.errors.full_messages.each do |msg| | ||
10 | %li= msg | ||
11 | %fieldset#comment-other-fields | ||
12 | .comment-name-field.comment-field | ||
13 | .comment-field-label= f.label :username | ||
14 | .comment-field-input= f.text_field :username | ||
15 | .comment-email-field.comment-field | ||
16 | .comment-field-label= f.label :email | ||
17 | .comment-field-input= f.text_field :email, type: :email | ||
18 | .comment-website-field.comment-field | ||
19 | .comment-field-label= f.label :website, "Website (Optional)" | ||
20 | .comment-field-input= f.text_field :website, type: :url | ||
21 | .comment-submit-button.comment-field | ||
22 | .comment-field-label | ||
23 | .comment-field-input= f.submit "Post" | ||
diff --git a/app/views/comments/_layout.html.haml b/app/views/comments/_layout.html.haml new file mode 100644 index 0000000..9acf6b0 --- /dev/null +++ b/app/views/comments/_layout.html.haml | |||
@@ -0,0 +1,6 @@ | |||
1 | %a{ name: "comments" } | ||
2 | #comments | ||
3 | %h2 Comments | ||
4 | - blog.comments.published_and_ordered.each do |comment| | ||
5 | = render comment | ||
6 | = render "comments/form", blog: blog | ||