Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/assets/stylesheets/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,9 @@ $font-sizes: (
xl: 1.5em
);

$gap-sizes: (
sm: 0.5em,
md: 1em
);

$text-aligns: left, center, right, justify;
19 changes: 18 additions & 1 deletion app/assets/stylesheets/users.scss
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,31 @@ $sizes: (16, 32, 40, 48, 64, 128, 256);


.item-list--item {
flex-wrap: nowrap;
padding: 0 !important;

.item-list--number-value {
width: 60px !important;
width: max-content !important;
}

.grid {
align-items: center;
}
}

.vote-summary-item--counts {
justify-content: end;
display: flex;
flex-wrap: wrap;
gap: 0.25em;
padding: 5px;
}

.vote-summary-item--tags {
display: flex;
gap: 0.35em;
flex-grow: 1;
justify-content: end;
max-width: max-content;
}
}
6 changes: 6 additions & 0 deletions app/assets/stylesheets/utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ span.spoiler {
white-space: nowrap;
}

@each $size in $gap-sizes {
.gap-#{$size} {
gap: $size;
}
}

@each $side in $sides {
.border-#{$side}-none {
border-#{$side}: none;
Expand Down
96 changes: 49 additions & 47 deletions app/views/users/vote_summary.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,64 @@
<p class="is-lead">A daily summary of votes received for posts.</p>

<% @votes.each do |day, vote_list, net_votes| %>
<details class="user-vote-summary" <%= 'open' unless day < SiteSetting['VoteSummaryAutoExpandLastNrOfDays'].days.ago%>>
<summary>
<h2><%= day.strftime('%b %e, %Y') %>:
<% if net_votes > 0 %>
<span class="has-color-green-800 has-font-weight-bold">+<%= net_votes %></span>
<% elsif net_votes < 0 %>
<span class="has-color-red-800 has-font-weight-bold"><%= net_votes %></span>
<% else %>
<span class="has-color-tertiary-600">0</span>
<% end %></h2>
</summary>
<div class="item-list">
<% vote_list.each do |post, vote_data| %>
<% vote_data = { -1 => [], 1 => [] }.merge(vote_data.group_by { |vd| vd.vote_type }) %>
<div class="item-list--item">
<div class="item-list--number-value">
<span class="item-list--number">
<details class="user-vote-summary" <%= 'open' unless day < SiteSetting['VoteSummaryAutoExpandLastNrOfDays'].days.ago%>>
<summary>
<h2><%= day.strftime('%b %e, %Y') %>:
<% if net_votes > 0 %>
<span class="has-color-green-800 has-font-weight-bold">+<%= net_votes %></span>
<% elsif net_votes < 0 %>
<span class="has-color-red-800 has-font-weight-bold"><%= net_votes %></span>
<% else %>
<span class="has-color-tertiary-600">0</span>
<% end %></h2>
</summary>
<div class="item-list">
<% vote_list.each do |post, vote_data| %>
<% vote_data = { -1 => [], 1 => [] }.merge(vote_data.group_by { |vd| vd.vote_type }) %>
<div class="item-list--item">
<div class="vote-summary-item--counts">
<div class="item-list--number-value">
<span class="item-list--number">
<% if vote_data[+1].count == 0 %>
<span class="has-color-tertiary-600 has-font-size-subheading">+0</span>
<span class="has-color-tertiary-600 has-font-size-subheading">+0</span>
<% else %>
<span class="has-color-green-800 has-font-weight-bold has-font-size-subheading">+<%= vote_data[+1].first.vote_count %></span>
<span class="has-color-green-800 has-font-weight-bold has-font-size-subheading">+<%= vote_data[+1].first.vote_count %></span>
<% end %>
</span>
</div>
<div class="item-list--number-value">
<span class="item-list--number">
</span>
</div>
<div class="item-list--number-value">
<span class="item-list--number">
<% if vote_data[-1].count == 0 %>
<span class="has-color-tertiary-600 has-font-size-subheading">&minus;0</span>
<span class="has-color-tertiary-600 has-font-size-subheading">&minus;0</span>
<% else %>
<span class="has-color-red-800 has-font-weight-bold has-font-size-subheading">&minus;<%= vote_data[-1].first.vote_count %></span>
<% end %>
</span>
</div>
<div class="item-list--text-value is-primary grid">
<div class="grid grid--cell is-12">
<% if post.present? %>
<div class="grid--cell is-flexible">
<%= link_to generic_share_link(post) do %>
<%= post.post_type.is_top_level ? post.title : post.parent.title %>
<% end %>
</div>
<div class="grid--cell">
<span class="badge is-tag is-muted is-filled"><%= post.post_type.name %></span>
<a href="<%= category_path(post.category) %>" class="badge is-tag is-muted"><%= post.category.name %></a>
</div>
<% else %>
<div class="grid--cell">
<%= I18n.t('votes.summary.post_missing') %>
</div>
<span class="has-color-red-800 has-font-weight-bold has-font-size-subheading">&minus;<%= vote_data[-1].first.vote_count %></span>
<% end %>
</span>
</div>
</div>
<div class="item-list--text-value is-primary grid">
<div class="grid grid--cell is-12 gap-sm">
<% if post.present? %>
<div class="grid--cell is-flexible is-12-sm is-8-md is-9-lg">
<%= link_to generic_share_link(post) do %>
<%= post.post_type.is_top_level ? post.title : post.parent.title %>
<% end %>
</div>
<div class="vote-summary-item--tags grid--cell is-12-sm is-4-md is-3-lg">
<span class="badge is-tag is-muted is-filled"><%= post.post_type.name %></span>
<a href="<%= category_path(post.category) %>" class="badge is-tag is-muted"><%= post.category.name %></a>
</div>
<% else %>
<div class="grid--cell">
<%= I18n.t('votes.summary.post_missing') %>
</div>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</details>
</details>
<% end %>

<div class="has-padding-top-4">
Expand Down