osunyorg/admin

View on GitHub
app/views/extranet/home/features/_alumni.html.erb

Summary

Maintainability
Test Coverage
<section class="mt-5">
  <div class="row">
    <div class="col-md-8">
      <h2 class="mb-4"><%= t('extranet.home.recent_experiences') %></h2>
      <div class="experiences">
        <ul>
            <% @experiences.ordered.each do |experience| %>
              <% l10n = experience.localization_for(current_language) %>
              <% organization_l10n = experience.organization.best_localization_for(current_language) if experience.organization.present? %>
            <li>
              <div>
                <%= link_to [:alumni, experience.person], class: "stretched-link" do %>
                  <% if experience.person.best_picture.attached? %>
                    <%= kamifusen_tag experience.person.best_picture, width: 400, class: 'img-fluid', sizes: {
                          '(max-width: 576px)': '400px',
                          '(max-width: 991px)': '200px'
                      } %>
                  <% else %>
                    <%= image_tag 'extranet/avatar.png', width: 400, class: 'img-fluid' %>
                  <% end %>
                <% end %>
              </div>
              <div>
                <div>
                  <p class="mb-md-0">
                    <%= experience.person.best_localization_for(current_language) %>
                    <br>
                    <%= [l10n&.description, organization_l10n&.to_s].compact_blank.join('-') %>
                  </p>
                  <small><%= l experience.created_at, format: :date_with_explicit_month %></small>
                </div>
                <% if organization_l10n && organization_l10n.logo.attached? %>
                    <%= link_to [:alumni, experience.organization] do %>
                      <%= kamifusen_tag organization_l10n.logo, height: 80, class: 'img-fluid' %>
                    <% end %>
                <% end %>
              </div>
            </li>
          <% end %>
        </ul>
      </div>
    </div>
    <div class="col-md-4 mt-5 mt-md-0">
      <h2 class="mb-4"><%= t('extranet.home.recent_cohorts') %></h2>
      <ul class="promotions">
        <% @cohorts.each do |cohort| 
          program_l10n = cohort.program.localization_for(current_language)
          %>
          <li>
            <%= link_to program_l10n.to_short_s, [:alumni, cohort] %>
            <b><%= cohort.academic_year %></b>
          </li>
        <% end %>
      </ul>
    </div>
  </div>
</section>