volontariat/voluntary_classified_advertisement

View on GitHub
app/views/products/types/classified_advertisement/tasks/_state_switch.html.erb

Summary

Maintainability
Test Coverage
<% if signed_up %>
  <% if task.vacancy.resource_type == 'Thing' %>
    <%= link_to t('tasks.show.change_signing'), change_signing_task_path(task.id), class: 'btn btn-warning btn-xs remote_modal_link' %>
  <% end %>
  
  <%= link_to t('general.sign_out'), sign_out_task_path(task.id), method: :delete, remote: true, data: { confirm: t('general.questions.are_you_sure') }, class: 'btn btn-danger btn-xs sign_out_task_link' %>
<% else %>
  <% if (task.vacancy.limit.blank? || accepted_candidatures_amount < task.vacancy.limit) && !task.vacancy.ended? %>
    <% if task.vacancy.resource_type == 'User' %>
      <%= link_to t('general.sign_up'), sign_up_task_path(task.id), method: :put, remote: true, class: 'btn btn-success btn-xs sign_up_task_link' %>
    <% else %>
      <%= link_to t('general.sign_up'), sign_up_task_path(task.id), class: 'btn btn-success btn-xs remote_modal_link' %>
    <% end %>
  <% else %>
    <%= link_to t('general.sign_up'), '#', class: 'btn btn-danger btn-xs disabled' %></a>
  <% end %>
<% end %>