app/views/projects/index.html.erb
<%- model_class = Project -%>
<div class="page-header">
<h1><%=t '.title', :default => model_class.model_name.human.pluralize.titleize %></h1>
</div>
<table class="table table-striped">
<thead>
<tr>
<th><%=t '.name', :default => model_class.human_attribute_name(:name) %></th>
<th><%=t '.description', :default => model_class.human_attribute_name(:description) %></th>
<th><%=t '.link', :default => model_class.human_attribute_name(:link) %></th>
<% if can? (:edit || :destroy), Project %>
<th><%=t '.actions', :default => t("helpers.actions") %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @projects.each do |project| %>
<tr>
<td><%= link_to project.name, project_path(project) %></td>
<td><%= raw project.description_preview %></td>
<td><%= link_to t('.on_github', :default => 'View on GitHub'), project.link, class: 'btn btn-primary btn-xs' %></td>
<% if can? (:edit || :destroy), project %>
<td>
<% if can? :edit, project %>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_project_path(project), :class => 'btn btn-default btn-xs' %>
<% end %>
<% if can? :destroy, project %>
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
project_path(project),
:method => :delete,
:data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
:class => 'btn btn-xs btn-danger' %>
<% end %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<% if can? :create, Project %>
<%= link_to t('.new', :default => t("helpers.links.new")),
new_project_path,
:class => 'btn btn-primary' %>
<% end %>