lespoupeesrusses/promethee

View on GitHub
app/views/promethee/components/faq_item/_show.html.erb

Summary

Maintainability
Test Coverage
<%
title = component[:attributes].dig(:title, :value)&.to_s
body = component[:attributes].dig(:body, :value)&.to_s.html_safe
special_question = component[:attributes].dig(:special_question, :value)

image_blob = blob_from_data component[:attributes].dig(:image, :value)
%>

<div  class="<%= promethee_class_for component %> <%= 'promethee__component__faq_item--special' if special_question %>"
      id="<%= promethee_id_for component %>">
  <h4 data-toggle="collapse"
      data-target="#collapse-faq-<%= component[:id] %>"
      aria-expanded="false"
      aria-controls="collapse-faq-<%= component[:id] %>">
    <%= title %>
  </h4>

  <div class="collapse" id="collapse-faq-<%= component[:id] %>">
    <% if image_blob %>
      <div class="row ">
        <div class="col-3 col-xs-3">
          <%= render 'promethee/show/image_srcset', blob: image_blob, alt: '', title: '', caption: '' %>
        </div>
        <div class="col-9 col-xs-9">
          <%= body %>
        </div>
      </div>
    <% else %>
      <%= body %>
    <% end %>
  </div>
</div>