Move dashboard poll partial to component

This commit is contained in:
taitus
2025-06-30 11:22:37 +02:00
committed by Javi Martín
parent 150af75e3e
commit fc0d79b47b
7 changed files with 98 additions and 88 deletions

View File

@@ -372,28 +372,6 @@
padding: $line-height;
}
.poll-card {
background: #e7f3fd;
border-radius: rem-calc(4);
margin-bottom: $line-height;
min-height: $line-height * 9;
padding: $line-height;
position: relative;
text-align: center;
.button {
font-weight: bold;
}
button {
cursor: pointer;
&:hover {
text-decoration: underline;
}
}
}
.community-poll {
border-bottom: 1px solid $border;
margin-bottom: $line-height;

View File

@@ -0,0 +1,21 @@
.dashboard-poll .poll-card {
background: #e7f3fd;
border-radius: rem-calc(4);
margin-bottom: $line-height;
min-height: $line-height * 9;
padding: $line-height;
position: relative;
text-align: center;
.button {
font-weight: bold;
}
button {
cursor: pointer;
&:hover {
text-decoration: underline;
}
}
}

View File

@@ -1,4 +1,4 @@
<div id="<%= dom_id(poll) %>" class="small-12 medium-6 large-4 column end">
<div id="<%= dom_id(poll) %>" class="dashboard-poll small-12 medium-6 large-4 column end">
<div class="poll-card" data-equalizer-watch="poll-cards">
<h4><%= link_to poll.title, proposal_poll_path(proposal, poll) %></h4>
<span class="small">

View File

@@ -0,0 +1,13 @@
class Dashboard::PollComponent < ApplicationComponent
attr_reader :poll
def initialize(poll)
@poll = poll
end
private
def proposal
poll.related
end
end

View File

@@ -5,7 +5,9 @@
<% if @polls.any? %>
<div class="row expanded margin-top" data-equalizer="poll-cards" data-equalize-on="medium">
<%= render @polls %>
<% @polls.each do |poll| %>
<%= render Dashboard::PollComponent.new(poll) %>
<% end %>
</div>
<% end %>
</div>