* Change int to float for more granular admin controls * Change int to float for more granular admin controls * Add details to /mod for admins
84 lines
No EOL
3.6 KiB
Text
84 lines
No EOL
3.6 KiB
Text
<style>
|
|
.reaction-button{
|
|
position: relative;
|
|
width: 60px;
|
|
height: 60px;
|
|
background: white;
|
|
border-color: white;
|
|
margin: 100px 40px;
|
|
border-radius:200px;
|
|
}
|
|
.reaction-button img {
|
|
position: absolute;
|
|
top: 0;
|
|
width: 60px;
|
|
left: 0;
|
|
}
|
|
.reaction-button .reacted-emoji {
|
|
display: none;
|
|
}
|
|
.reaction-button.reacted .reacted-emoji {
|
|
display: block;
|
|
}
|
|
</style>
|
|
|
|
<div class="container" style="text-align: center">
|
|
<h2>MODERATE: <a href="<%= @moderatable.path %>" rel="nofollow"><%= @moderatable.title %></a></h2>
|
|
|
|
<button class="reaction-button <%= Reaction.cached_any_reactions_for?(@moderatable, current_user, "thumbsdown") ? "reacted" : "" %>" data-reactable-id="<%= @moderatable.id %>" data-category="thumbsdown" data-reactable-type="<%= @moderatable.class.name %>">
|
|
<%= image_tag "emoji/emoji-one-thumbs-down-gray.png" %>
|
|
<img class="reacted-emoji" src="<%= asset_path("emoji/emoji-one-thumbs-down.png") %>"/>
|
|
</button>
|
|
<button class="reaction-button <%= Reaction.cached_any_reactions_for?(@moderatable, current_user, "vomit") ? "reacted" : "" %>" data-reactable-id="<%= @moderatable.id %>" data-category="vomit" data-reactable-type="<%= @moderatable.class.name %>">
|
|
<%= image_tag "emoji/emoji-one-nausea-face-gray.png" %>
|
|
<img class="reacted-emoji" src="<%= asset_path("emoji/emoji-one-nausea-face.png") %>"/>
|
|
</button>
|
|
|
|
<% if current_user.has_role?(:super_admin) && @moderatable.class.name == "Article" %>
|
|
<h1> Admin: <a href="<%= @moderatable.path %>/edit">Edit</a> | <a href="/internal/articles/<%= @moderatable.id %>" data-no-instant>Content Moderation</a> | <a href="/admin/articles/<%= @moderatable.id %>" data-no-instant>Article Admin</a></h1>
|
|
<% elsif current_user.has_role?(:super_admin) && @moderatable.class.name == "Comment" %>
|
|
<h1> ADMIN: <a href="/admin/comments/<%= @moderatable.id %>" data-no-instant>Comment Admin</a> | <a href="/admin/users/<%= @moderatable.user_id %>" data-no-instant>User Admin</a></h1>
|
|
<% else %>
|
|
<p style="width: 90%;margin:50px auto;text-align:left">
|
|
<b style="font-size:1.3em">All negative reactions are 100% private.</b>
|
|
<br><br>Use the <b>thumbsdown(👎)</b> to move something "down" for any reason (quality, usefulness, code of conduct grey area).
|
|
<br><br>The <b>vomit(🤢)</b> is for code of conduct violations (harassment, being an asshole, spam, etc.).
|
|
<br><br>The DEV team will be notified about vomits and take appropriate action, but leaving a level-headed comment addressing the behavior is welcome if you feel up for it.
|
|
</p>
|
|
<% end %>
|
|
</div>
|
|
|
|
<script defer>
|
|
setTimeout(function(){
|
|
var butts = document.getElementsByClassName('reaction-button');
|
|
for (var i = 0; i < butts.length; i++) {
|
|
var butt = butts[i];
|
|
butt.onclick = function (event) {
|
|
event.preventDefault();
|
|
var thisButt = this;
|
|
thisButt.classList.add('reacted');
|
|
|
|
function successCb(response) {
|
|
if (response.result === 'create') {
|
|
thisButt.classList.add('reacted');
|
|
} else {
|
|
thisButt.classList.remove('reacted');
|
|
}
|
|
}
|
|
|
|
var formData = new FormData();
|
|
formData.append('reactable_type', thisButt.dataset.reactableType);
|
|
formData.append('category', thisButt.dataset.category);
|
|
formData.append('reactable_id', thisButt.dataset.reactableId);
|
|
|
|
getCsrfToken()
|
|
.then(sendFetch('reaction-creation', formData))
|
|
.then(function (response) {
|
|
if (response.status === 200) {
|
|
response.json().then(successCb);
|
|
}
|
|
});
|
|
};
|
|
}
|
|
}, 200)
|
|
</script> |