views: refactor post flag and appeal reasons.
* Prefer partials over helpers. * Add css classes to flag/appeal reason lists. * Wrap dtext in span.prose container.
This commit is contained in:
@@ -14,8 +14,8 @@
|
||||
<tr>
|
||||
<td><%= PostPresenter.preview(post, show_deleted: true) %></td>
|
||||
<td><%= mod_link_to_user post.uploader, :negative %></td>
|
||||
<td><%= post_flag_reasons(post) %></td>
|
||||
<td><%= post_appeal_reasons(post) %></td>
|
||||
<td><%= render "post_flags/reasons", flags: post.flags %></td>
|
||||
<td><%= render "post_appeals/reasons", appeals: post.appeals %></td>
|
||||
<td><%= post.score %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
</li>
|
||||
<li><strong>Uploader</strong>: <%= link_to_user(post.uploader) %> <%= time_ago_in_words_tagged(post.created_at) %></li>
|
||||
<% if post.is_flagged? %>
|
||||
<li><strong>Flagged</strong>: <%= post_flag_reasons(post) %></li>
|
||||
<li><strong>Flagged</strong>: <%= render "post_flags/reasons", flags: post.flags %></li>
|
||||
<% end %>
|
||||
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
|
||||
<li><strong>Appeals</strong>: <%= post_appeal_reasons(post) %></li>
|
||||
<li><strong>Appeals</strong>: <%= render "post_appeals/reasons", appeals: post.appeals %></li>
|
||||
<% end %>
|
||||
<li>
|
||||
<strong>Hidden</strong>: <%= render "post_disapprovals/compact_counts", :disapprovals => post.disapprovals, :post => post %>
|
||||
|
||||
15
app/views/post_appeals/_reasons.html.erb
Normal file
15
app/views/post_appeals/_reasons.html.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
<ul class="post-appeal-reasons">
|
||||
<% appeals.each do |appeal| %>
|
||||
<li class="post-appeal-reason">
|
||||
<span class="prose"><%= format_text(appeal.reason, inline: true) %></span>
|
||||
|
||||
- <%= link_to_user(appeal.creator) %>
|
||||
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
(<%= link_to_ip(appeal.creator_ip_addr) %>)
|
||||
<% end %>
|
||||
|
||||
- <%= time_ago_in_words_tagged(appeal.created_at) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
21
app/views/post_flags/_reasons.html.erb
Normal file
21
app/views/post_flags/_reasons.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<ul class="post-flag-reasons">
|
||||
<% flags.each do |flag| %>
|
||||
<li class="post-flag-reason">
|
||||
<span class="prose"><%= format_text(flag.reason, inline: true) %></span>
|
||||
|
||||
<% if CurrentUser.can_view_flagger_on_post?(flag) %>
|
||||
- <%= link_to_user(flag.creator) %>
|
||||
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
(<%= link_to_ip(flag.creator_ip_addr) %>)
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
- <%= time_ago_in_words_tagged(flag.created_at) %>
|
||||
|
||||
<% if flag.is_resolved? %>
|
||||
<span class="resolved">RESOLVED</span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="post-notice post-notice-flagged">
|
||||
<p>This post was flagged for review (<%= link_to "learn more", wiki_pages_path(:title => "howto:flag") %>): </p>
|
||||
|
||||
<%= post_flag_reasons(post) %>
|
||||
<%= render "post_flags/reasons", flags: post.flags %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<div class="post-notice post-notice-deleted">
|
||||
<% if post.flags.any? %>
|
||||
<p>This post was deleted for the following reasons: </p>
|
||||
<%= post_flag_reasons(post) %>
|
||||
<%= render "post_flags/reasons", flags: post.flags %>
|
||||
<% else %>
|
||||
<p>This post was deleted</p>
|
||||
<% end %>
|
||||
@@ -50,7 +50,7 @@
|
||||
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
|
||||
<div class="post-notice post-notice-appealed">
|
||||
<p>This post was appealed:</p>
|
||||
<%= post_appeal_reasons(post) %>
|
||||
<%= render "post_appeals/reasons", appeals: post.appeals %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user