devblog/app/views/articles/index.html.erb

45 lines
1.8 KiB
Plaintext

<%- model_class = Article -%>
<div class="page-header">
<h1><%=t 'articles' %></h1>
</div>
<table class="table table-striped">
<thead>
<tr>
<th><%= model_class.human_attribute_name(:id) %></th>
<th><%= model_class.human_attribute_name(:title) %></th>
<th><%= model_class.human_attribute_name(:content) %></th>
<th><%= model_class.human_attribute_name(:rate) %></th>
<th><%= model_class.human_attribute_name(:active) %></th>
<th><%= model_class.human_attribute_name(:created_by) %></th>
<th><%=t '.actions', :default => t("helpers.actions") %></th>
</tr>
</thead>
<tbody>
<% @articles.each do |article| %>
<tr>
<td><%= link_to article.id, article_path(article) %></td>
<td><%= article.title %></td>
<td><%= article.content %></td>
<td><%= article.rate %></td>
<td><%= article.active %></td>
<td><%= article.created %></td>
<td>
<%= link_to t('.more', :default => t("helpers.links.more")),
article_path(article), :class => 'btn btn-info btn-xs' %>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_article_path(article), :class => 'btn btn-default btn-xs' %>
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
article_path(article),
:method => :delete,
:data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
:class => 'btn btn-xs btn-danger' %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= link_to t('.new', :default => t("helpers.links.new")),
new_article_path,
:class => 'btn btn-primary' %>