index.html.erb
1.73 KB
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
40
41
42
43
44
45
46
47
48
49
50
<h3 class="title">
文章管理
<small>
<%= link_to '去首页', root_path %>
/
<%= link_to '注销', sign_out_path %>
/
<%= link_to '发布文章', new_post_path(schan: params[:schan], scate: params[:scate], screa: params[:screa], page: params[:page]) %>
</small>
</h3>
<table class="list">
<tr>
<th width="3%">
ID
</th>
<th width="25%">
<!-- <input> -->
标题
</th>
<th width="16%">
<%= link_to "类别#{params[:scate] == 'desc' ? '△' : '▽'}", posts_path(scate: params[:scate] == 'desc' ? 'asc' : 'desc') %>
</th>
<th width="16%">
<%= link_to "频道#{params[:schan] == 'desc' ? '△' : '▽'}", posts_path(schan: params[:schan] == 'desc' ? 'asc' : 'desc') %>
</th>
<th width="10%">
<%= link_to "日期#{params[:screa] == 'desc' ? '▽' : '△'}", posts_path(screa: params[:screa] == 'desc' ? 'asc' : 'desc') %>
</th>
<th width="10%">别名</th>
<th width="20%">操作</th>
</tr>
<% @posts.each do |post| %>
<tr>
<td><%= post.id %></td>
<td><%= post.title %></td>
<td><%= Post::CATE[post.chan][:cate][post.cate] %></td>
<td><%= Post::CATE[post.chan][:name] %></td>
<td><%= post.created_at.to_date %></td>
<td><%= post.flag %></td>
<td>
<%= link_to '详细', post_path(post, schan: params[:schan], scate: params[:scate], screa: params[:screa], page: params[:page]) %>
/
<%= link_to '编辑', edit_post_path(post, schan: params[:schan], scate: params[:scate], screa: params[:screa], page: params[:page]) %>
/
<%= link_to '删除', post, method: :delete, data: { confirm: '确定删除?' } %>
</tr>
<% end %>
</table>
<%= paginate @posts %>