/
index.html.erb
39 lines (35 loc) · 941 Bytes
/
index.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<section>
<h1><%= t('.title') %></h1>
<p>
<%= t('.description') %>
</p>
</section>
<section>
<table>
<thead>
<tr>
<th></th>
<th><%= Blog.human_attribute_name(:title) %></th>
<th><%= Blog.human_attribute_name(:user_id) %></th>
<th></th>
</tr>
</thead>
<tbody>
<% @blogs.each do |blog| %>
<tr>
<td><%= l(blog.created_at.to_date, format: :nengetsu) %></td>
<td><%= link_to(blog.title, blog) %></td>
<td><%= link_to(blog.user.name, blog.user) %></td>
<td>
<% if blog.author?(current_user) %>
<%= link_to(t('edit'), edit_blog_path(blog)) %>
<%= link_to(t('destroy'), blog, method: :delete, data: { confirm: t('are_you_sure?') }) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</section>
<br>
<%= link_to(t('new'), new_blog_path) %>