libertarian-party/partynest

View on GitHub
app/views/staffs/people/account_connection_links/show.html.erb

Summary

Maintainability
Test Coverage
<div class="container">
  <%= nav_breadcrumb(
    [translate(:staff_services), staff_root_path],
    [Person.model_name.human(count: 0), staff_people_path],
    [@person.full_name, staff_person_path(@person)],
    translate('.link_to_connect_account'),
  ) %>

  <div class="text-center">
    <p class="lead">
      <%= translate '.description' %>
    </p>

    <% if policy([:staff, @person, AccountConnectionLink.new(@person)]).show? %>
      <% if @person.account_connection_token %>
        <div class="my-4">
          <input
             type="text"
             class="form-control"
             readonly="readonly"
             value="<%= person_account_connection_link @person %>"
           >
        </div>
       <% end %>
     <% end %>

    <% if policy([:staff, @person, AccountConnectionLink.new(@person)]).create? %>
      <%= link_to translate('.generate'),
                  staff_person_account_connection_link_path(@person),
                  method: :post,
                  class: 'btn btn-primary btn-lg' %>
    <% end %>

    <% if policy([:staff, @person, AccountConnectionLink.new(@person)]).destroy? %>
      <%= link_to translate('.destroy'),
                  staff_person_account_connection_link_path(@person),
                  method: :delete,
                  class: 'btn btn-danger btn-lg' %>
    <% end %>
  </div>
</div>