Use grid instead of Equalizer in dashboard polls

This commit is contained in:
taitus
2025-06-30 16:10:16 +02:00
committed by Javi Martín
parent de303aa1df
commit 3b08fa2e05
4 changed files with 40 additions and 34 deletions

View File

@@ -1,7 +1,8 @@
.dashboard-poll .poll-card { .dashboard-poll {
background: #e7f3fd; background: #e7f3fd;
border-radius: rem-calc(4); border-radius: rem-calc(4);
margin-bottom: $line-height; display: flex;
flex-direction: column;
min-height: $line-height * 9; min-height: $line-height * 9;
padding: $line-height; padding: $line-height;
position: relative; position: relative;

View File

@@ -0,0 +1,7 @@
.dashboard-polls {
display: grid;
gap: $line-height;
grid-auto-rows: 1fr;
grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
margin-top: $line-height;
}

View File

@@ -1,36 +1,34 @@
<div id="<%= dom_id(poll) %>" class="dashboard-poll small-12 medium-6 large-4 column end"> <div id="<%= dom_id(poll) %>" class="dashboard-poll">
<div class="poll-card" data-equalizer-watch="poll-cards"> <h4><%= link_to poll.title, proposal_poll_path(proposal, poll) %></h4>
<h4><%= link_to poll.title, proposal_poll_path(proposal, poll) %></h4> <span class="small">
<span class="small"> <%= l(poll.starts_at.to_date) %> - <%= l(poll.ends_at.to_date) %>
<%= l(poll.starts_at.to_date) %> - <%= l(poll.ends_at.to_date) %> </span>
</span>
<p class="margin-top"> <p class="margin-top">
<strong><%= t("dashboard.polls.poll.responses", count: poll.answer_count) %></strong> <strong><%= t("dashboard.polls.poll.responses", count: poll.answer_count) %></strong>
</p> </p>
<div class="small-12 column small-centered margin-top"> <div class="small-12 column small-centered margin-top">
<% if poll.starts_at.to_date >= Date.current %> <% if poll.starts_at.to_date >= Date.current %>
<%= link_to t("dashboard.polls.poll.edit_poll"), <%= link_to t("dashboard.polls.poll.edit_poll"),
edit_proposal_dashboard_poll_path(proposal, poll), class: "button hollow" %> edit_proposal_dashboard_poll_path(proposal, poll), class: "button hollow" %>
<% else %> <% else %>
<%= link_to t("dashboard.polls.poll.view_results"), <%= link_to t("dashboard.polls.poll.view_results"),
results_proposal_poll_path(proposal, poll), results_proposal_poll_path(proposal, poll),
class: "button" %> class: "button" %>
<% end %>
</div>
<%= form_for poll, remote: true,
data: { type: :json },
url: proposal_dashboard_poll_path(proposal, poll) do |f| %>
<%= f.check_box :results_enabled, class: "js-submit-on-change" %>
<% end %> <% end %>
<p class="help-text"><%= t("dashboard.polls.poll.show_results_help") %></p>
<%= button_to t("dashboard.polls.poll.delete"),
proposal_dashboard_poll_path(proposal, poll),
method: :delete,
"data-confirm": t("dashboard.polls.poll.alert_notice"),
class: "delete" %>
</div> </div>
<%= form_for poll, remote: true,
data: { type: :json },
url: proposal_dashboard_poll_path(proposal, poll) do |f| %>
<%= f.check_box :results_enabled, class: "js-submit-on-change" %>
<% end %>
<p class="help-text"><%= t("dashboard.polls.poll.show_results_help") %></p>
<%= button_to t("dashboard.polls.poll.delete"),
proposal_dashboard_poll_path(proposal, poll),
method: :delete,
"data-confirm": t("dashboard.polls.poll.alert_notice"),
class: "delete" %>
</div> </div>

View File

@@ -1,4 +1,4 @@
<div class="row expanded margin-top" data-equalizer="poll-cards" data-equalize-on="medium"> <div class="dashboard-polls">
<% polls.each do |poll| %> <% polls.each do |poll| %>
<%= render Dashboard::PollComponent.new(poll) %> <%= render Dashboard::PollComponent.new(poll) %>
<% end %> <% end %>