Created
May 25, 2015 10:23
-
-
Save nwshane/c5fa7ce7a784eb8ac9e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%- model_class = Article -%> | |
<% page_title "#{model_class.model_name.human.pluralize.titleize}" %> | |
<p><%= link_to "#{model_class.model_name.human.pluralize.titleize} CSV Download", articles_path(format: :csv) %></p> | |
<table class="table table-striped"> | |
<thead> | |
<tr> | |
<th><%= model_class.human_attribute_name(:id) %></th> | |
<th><%= model_class.human_attribute_name(:number) %></th> | |
<th><%= model_class.human_attribute_name(:criminal_code_id) %></th> | |
<th><%= model_class.human_attribute_name(:created_at) %></th> | |
<% if_can_edit_or_destroy?(Article) { %><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><%= link_to article.number, article_path(article) %></td> | |
<td><%= link_to article.criminal_code.name, criminal_code_path(article.criminal_code) %></td> | |
<td><%= article.created_at %></td> | |
<% if_can_edit_or_destroy?(Article) { %> | |
<td> | |
<%= if can? :edit, article | |
link_to t('.edit', :default => t("helpers.links.edit")), | |
edit_article_path(article), :class => 'btn btn-default btn-xs' | |
end %> | |
<%= if can? :destroy, article | |
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' | |
end %> | |
</td> | |
<% } %> | |
</tr> | |
<% end %> | |
</tbody> | |
</table> | |
<%= if can? :new, Article | |
link_to t('.new', :default => t("helpers.links.new")), | |
new_article_path, | |
:class => 'btn btn-primary' | |
end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment