publiclab/plots2

View on GitHub
app/views/questions/_questions.html.erb

Summary

Maintainability
Test Coverage
<% questions = questions || @questions # accept local if present, default to instance %>
<div class="card-view questions-page row">
    <% questions.each_with_index do |node,i| %>
        <div class="<% if @widget %>col-xs-4 col-sm-4 col-md-4 <% end %>col-lg-4" style="margin-top:20px;">
      <div class="card bg-white rounded<% if node.status == 4 %> moderated<% end %>">
        <div class="card-header">
          <%= render partial: 'dashboard/node_moderate', locals: { node: node } %>
          <h4><a <% if @widget %>target="_blank"<% end %> href="<%= node.path(:question) %>"><%= node.title %></a></h4>
        </div>
        <div class="card-footer">
          <p class="meta"><%= render partial: "dashboard/node_meta", locals: { node: node } %></p>
        </div>
      </div>
    </div>

    <% unless @widget %><hr class="d-lg-none" /><% end %>
    <% if ((i+1)/3.0).to_i == ((i+1)/3.0) %>
    <% unless @widget %><hr class="d-lg-none grid" /><% end %>
    <% end %>
  <% end %>
</div>
<div class="text-center mt-3">
  <% if @pagy %>
    <%== pagy_bootstrap_nav @pagy %>
  <% else %>
    <%= will_paginate questions, :renderer => WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated || questions.empty? %>
  <% end %>
</div>