app/views/connection_links/_connection_link.erb
<div id="index_item" class="panel panel-default connection_link">
<div class="panel-heading">
<div class="panel-title clearfix">
<% if policy(:application).write? %>
<span class="pull-right">
<%= link_to edit_referential_connection_link_path(@referential, connection_link), :class => "btn btn-default btn-sm" do %>
<span class="fa fa-pencil"></span>
<% end %>
<%= link_to referential_connection_link_path(@referential, connection_link), :method => :delete, :data => {:confirm => t('connection_links.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
<span class="fa fa-trash-o"></span>
<% end %>
</span>
<% end %>
<h5>
<%= link_to([@referential, connection_link], :class => "preview", :title => "#{Chouette::ConnectionLink.model_name.human.capitalize} #{connection_link.name}") do %>
<span class="name">
<%= truncate(connection_link.name, :length => 20) %>
</span>
<% end %>
</h5>
</div>
</div>
<div class="panel-body">
<p>
<%= t('.from') %>
<% if connection_link.departure.present? %>
<%= link_to_if connection_link.departure, truncate(connection_link.departure.name, :length => 15) , referential_stop_area_path(@referential, connection_link.departure), :title => "#{connection_link.human_attribute_name('departure')} #{connection_link.departure.name}" %>
<% else %>
<%= connection_link.human_attribute_name('undefined') %>
<% end %>
<%= t('.to') %>
<% if connection_link.arrival.present? %>
<%= link_to_if( connection_link.arrival, truncate(connection_link.arrival.name, :length => 15), referential_stop_area_path(@referential, connection_link.arrival), :title => "#{connection_link.human_attribute_name('arrival')} #{connection_link.arrival.name}" ) %>
<% else %>
<%= connection_link.human_attribute_name("undefined") %>
<% end %>
</p>
<p>
<%= connection_link.human_attribute_name('default_duration').capitalize %>: <%= connection_link.default_duration ? connection_link.default_duration.strftime('%Mm %Ss') : connection_link.human_attribute_name("undefined") %>
</p>
</div>
</div>