<% @contracts.each do |name, contracts| %>
<%# Sort contracts by version number; unpublished contracts go at end by creation date %>
<% #contracts = contracts.sort_by {|cc| cc.version || cc.created_at.to_i} %>
- <%= name %>
<% contracts.each do |contract| %>
- <%= link_to contract.title, contract, class: 'fine_print link' %>
(<%= contract.version.nil? ? \
t('fine_print.contract.status.draft') : \
t('fine_print.contract.status.version',
version: contract.version.to_s) %>)
<% if contract.signatures.empty? %>
[<%= link_to t('fine_print.contract.actions.edit'),
edit_contract_path(contract),
class: 'fine_print link' %>]
<% if contract.is_published? %>
[<%= link_to(
t('fine_print.contract.actions.unpublish'),
unpublish_contract_path(contract),
method: :put,
data: {
confirm: t('fine_print.contract.actions.confirm.unpublish')
},
class: 'fine_print link'
) %>]
<% else %>
[<%= link_to(
t('fine_print.contract.actions.publish'),
publish_contract_path(contract),
method: :put,
data: {
confirm: t('fine_print.contract.actions.confirm.publish')
},
class: 'fine_print link'
) %>]
<% end %>
[<%= link_to(
t('fine_print.contract.actions.delete'),
contract,
method: :delete,
data: {
confirm: t('fine_print.contract.actions.confirm.delete')
},
class: 'fine_print link'
) %>]
<% else %>
[<%= link_to t('fine_print.contract.actions.new_version'),
new_version_contract_path(contract),
method: :post,
class: 'fine_print link' %>]
[<%= link_to t('fine_print.contract.actions.signatures'),
contract_signatures_path(contract),
class: 'fine_print link' %>]
<% end %>
<% end %>
<% end %>
<%= link_to 'New Contract', new_contract_path, class: 'fine_print link' %>