adds styles to related content score

This commit is contained in:
decabeza
2017-12-19 17:52:43 +01:00
parent 03aaa82d86
commit bf073d8535
3 changed files with 70 additions and 7 deletions

View File

@@ -2424,11 +2424,24 @@ table {
li {
border-bottom: 1px solid $border;
padding: $line-height / 4;
margin-bottom: 0 !important;
padding: $line-height / 2;
&:first-child {
border-top: 1px solid $border;
}
.score-actions {
display: none;
}
&:hover {
background: #f9f9f9;
.score-actions {
display: block;
}
}
}
h3 {
@@ -2436,7 +2449,7 @@ table {
font-weight: normal;
}
span:not(.icon-flag) {
.related-content-title {
color: #4f4f4f;
font-size: rem-calc(12);
text-transform: uppercase;
@@ -2447,6 +2460,44 @@ table {
}
}
.relate-content-score {
display: block;
text-align: center;
a {
font-weight: bold;
margin-right: $line-height;
padding-left: rem-calc(20);
position: relative;
text-decoration: none;
&.score-positive:before,
&.score-negative:before {
font-family: 'icons';
left: 0;
position: absolute;
}
&.score-positive {
color: $color-success;
&:before {
color: $color-success;
content: '\6c';
}
}
&.score-negative {
color: $color-alert;
&:before {
color: $color-alert;
content: '\76';
}
}
}
}
// 22. Images
// -----------------

View File

@@ -2,12 +2,12 @@
<% @related_contents.each do |related| %>
<li>
<% if current_user %>
<span id="<%= dom_id(related.relate_content(relationable)) %>" class="js-score-actions float-right">
<span id="<%= dom_id(related.relate_content(relationable)) %>" class="js-score-actions score-actions float-right">
<%= render 'relationable/score', related: related.relate_content(relationable) %>
</span>
<% end %>
<span><%= t("related_content.content_title.#{related.class.name.downcase}") %></span><br>
<span class="related-content-title"><%= t("related_content.content_title.#{related.class.name.downcase}") %></span><br>
<h3 class="inline-block">
<%= link_to related.title, eval("#{related.class.name.downcase}_path(related)") %>
</h3>

View File

@@ -1,5 +1,17 @@
<span><%= t('related_content.is_related') %></span>
<small><%= t("related_content.is_related") %></small>
<%= link_to t('related_content.score_positive'), score_positive_related_content_path(related), method: :put, remote: true, id: "score-positive-related-#{ related.id }" %>
<span class="relate-content-score">
<%= link_to t("related_content.score_positive"),
score_positive_related_content_path(related),
method: :put,
remote: true,
id: "score-positive-related-#{ related.id }",
class: "score-positive" %>
<%= link_to t('related_content.score_negative'), score_negative_related_content_path(related), method: :put, remote: true, id: "score-negative-related-#{ related.id }" %>
<%= link_to t("related_content.score_negative"),
score_negative_related_content_path(related),
method: :put,
remote: true,
id: "score-negative-related-#{ related.id }",
class: "score-negative" %>
</span>