Move dashboard poll partial to component
This commit is contained in:
@@ -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;
|
||||
|
||||
21
app/assets/stylesheets/dashboard/poll.scss
Normal file
21
app/assets/stylesheets/dashboard/poll.scss
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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">
|
||||
13
app/components/dashboard/poll_component.rb
Normal file
13
app/components/dashboard/poll_component.rb
Normal 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
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user