volontariat/voluntary_scholarship

View on GitHub
app/views/scholarship/programs/_actions.html.erb

Summary

Maintainability
Test Coverage
<% if can?(:destroy, program) || can?(:edit, program) %>
<div class="dropdown">
  <a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= t('general.actions') %></a>
  <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
  <% if can? :destroy, program %>    
    <li>
      <%= link_to(
        t('general.destroy'), scholarship_program_path(program.id), id: "program_#{program.id}", method: :delete, 
        data: { confirm: t('general.questions.are_you_sure') },
        onclick: "delete_link('program_#{program.id}'); return false;"
      ) %>
    </li>
  <% end %>
  <% if can? :edit, program %>    
    <li><%= link_to t('general.edit'), eval("edit_scholarship_program_path(program)") %></li>
  <% end %>
  </ul>
</div>
<% end %>