noesya/osuny

View on GitHub
app/views/extranet/experiences/_list.html.erb

Summary

Maintainability
Test Coverage
<%
edit ||= false
%>
<div class="experiences mt-4">
  <ul class="list-unstyled">
    <% if person&.experiences&.any? %>
      <% @person.experiences.ordered.each do |experience| %>
        <%
        l10n = experience.best_localization_for(current_language)
        organization_l10n = experience.organization.best_localization_for(current_language)
        %>
        <li class="experiences__experience py-4 border-top">
          <div class="row">
            <div class="col-md-6">
              <p class="mb-0">
                <b><%= l10n.description %></b><br>
                <%= "#{experience.from_year} —" if experience.from_year %>
                <%= experience.to_year || t('today') %>
              </p>
              <%= link_to University::Person::Experience.human_attribute_name('edit'),
                          edit_experience_path(experience),
                          class: 'btn btn-sm btn-primary mt-2' if edit %>
            </div>
            <div class="col-md-6 text-end">
              <% if experience.organization.present? %>
                <% if organization_l10n.logo.attached? %>
                  <%= link_to organization_path(experience.organization) do %>
                    <%= kamifusen_tag organization_l10n.logo, width: 100, class: 'img-fluid experience__organization__logo' %>
                  <% end %>
                <% else %>
                  <p class="text-end">
                    <%= link_to organization_l10n,
                                organization_path(experience.organization) %>
                  </p>
                <% end %>
              <div>
            <% end %>
          </div>
        </li>

      <% end %>
    <% end %>
  </ul>
</div>