Fix linting issues in app/views/comments (#1853) [ci skip]
This commit is contained in:
parent
6fdcc9eb26
commit
d9ee35a421
9 changed files with 115 additions and 100 deletions
|
|
@ -2,11 +2,19 @@
|
|||
<% if comment.depth < 3 %>
|
||||
<details open>
|
||||
<summary><span> </span></summary>
|
||||
<%= render("comments/comment_proper", comment: comment, commentable: commentable,
|
||||
is_view_root: is_view_root, is_childless: is_childless, subtree_html: subtree_html) %>
|
||||
<%= render("comments/comment_proper",
|
||||
comment: comment,
|
||||
commentable: commentable,
|
||||
is_view_root: is_view_root,
|
||||
is_childless: is_childless,
|
||||
subtree_html: subtree_html) %>
|
||||
</details>
|
||||
<% else %>
|
||||
<%= render("comments/comment_proper", comment: comment, commentable: commentable,
|
||||
is_view_root: is_view_root, is_childless: is_childless, subtree_html: subtree_html) %>
|
||||
<%= render("comments/comment_proper",
|
||||
comment: comment,
|
||||
commentable: commentable,
|
||||
is_view_root: is_view_root,
|
||||
is_childless: is_childless,
|
||||
subtree_html: subtree_html) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -10,16 +10,17 @@
|
|||
<div class="inner-comment">
|
||||
<% if comment.decorate.low_quality %>
|
||||
<div class="low-quality-comment-marker">
|
||||
<%= image_tag(cl_image_path(asset_path("/assets/sloan.png"),
|
||||
type: "fetch",
|
||||
width: 50,
|
||||
height: 50,
|
||||
crop: "imagga_scale",
|
||||
quality: "auto",
|
||||
flags: "progressive",
|
||||
fetch_format: "auto",
|
||||
sign_url: true), class: "sloan", alt: "sloth-mascot") %>
|
||||
Comment marked as low quality/non-constructive by the community <a href="/code-of-conduct">View code of conduct</a>
|
||||
<%= image_tag(cl_image_path(asset_path("/assets/sloan.png"),
|
||||
type: "fetch",
|
||||
width: 50,
|
||||
height: 50,
|
||||
crop: "imagga_scale",
|
||||
quality: "auto",
|
||||
flags: "progressive",
|
||||
fetch_format: "auto",
|
||||
sign_url: true), class: "sloan", alt: "sloth-mascot") %>
|
||||
Comment marked as low quality/non-constructive by the community
|
||||
<a href="/code-of-conduct">View code of conduct</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="details <%= "low-quality-comment" if comment.decorate.low_quality %>">
|
||||
|
|
@ -41,9 +42,9 @@
|
|||
</a>
|
||||
<% end %>
|
||||
<% if commentable && (commentable.user_id == comment.user_id ||
|
||||
commentable.second_user_id == comment.user_id ||
|
||||
commentable.third_user_id == comment.user_id) &&
|
||||
commentable.decorate.cached_tag_list_array.include?("ama") %>
|
||||
commentable.second_user_id == comment.user_id ||
|
||||
commentable.third_user_id == comment.user_id) &&
|
||||
commentable.decorate.cached_tag_list_array.include?("ama") %>
|
||||
<span class="op-marker">ASK ME ANYTHING</span>
|
||||
<% end %>
|
||||
<div class="comment-date">
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<% if @comment.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:</h2>
|
||||
<ul>
|
||||
<% @comment.errors.full_messages.each do |message| %>
|
||||
<li><%= message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<br><br><br><br>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:</h2>
|
||||
<ul>
|
||||
<% @comment.errors.full_messages.each do |message| %>
|
||||
<li><%= message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<br><br><br><br>
|
||||
<% end %>
|
||||
|
||||
<%= form_for(@comment, authenticity_token: false) do |f| %>
|
||||
|
|
@ -24,26 +24,25 @@
|
|||
<% end %>
|
||||
<div class="field" id="textarea-wrapper">
|
||||
<%= f.text_area :body_markdown,
|
||||
placeholder: "Add to the discussion",
|
||||
onfocus: "handleFocus(event)",
|
||||
onblur: "handleBlur(event)",
|
||||
onkeyup: "handleKeyUp(event)",
|
||||
onkeydown: "handleKeyDown(event)",
|
||||
id: "text-area",
|
||||
autofocus: @comment.persisted?,
|
||||
required: true
|
||||
%>
|
||||
placeholder: "Add to the discussion",
|
||||
onfocus: "handleFocus(event)",
|
||||
onblur: "handleBlur(event)",
|
||||
onkeyup: "handleKeyUp(event)",
|
||||
onkeydown: "handleKeyDown(event)",
|
||||
id: "text-area",
|
||||
autofocus: @comment.persisted?,
|
||||
required: true %>
|
||||
<div class="preview-toggle comment-preview-div" id="preview-div"></div>
|
||||
</div>
|
||||
<div class="code-of-conduct" id="toggle-code-of-conduct-checkbox">
|
||||
</div>
|
||||
<div class="code-of-conduct" id="toggle-code-of-conduct-checkbox">
|
||||
</div>
|
||||
<a href="/p/editor_guide" class="markdown-guide" target="_blank" title="Markdown Guide">
|
||||
<img class="icon-image" src="<%= asset_path('info.svg') %>" />
|
||||
<img class="icon-image" src="<%= asset_path("info.svg") %>" />
|
||||
</a>
|
||||
<div class="editor-image-upload">
|
||||
<input type="file" id="image-upload-main" name="file" accept="image/*" style="display:none">
|
||||
<input type="file" id="image-upload-main" name="file" accept="image/*" style="display:none">
|
||||
<button class="image-upload-button" id="image-upload-button-main" onclick="handleImageUpload(event,'main')" title="Upload Image">
|
||||
<img class="icon-image" src="<%= asset_path('image-upload.svg') %>" />
|
||||
<img class="icon-image" src="<%= asset_path("image-upload.svg") %>" />
|
||||
</button>
|
||||
<label class="image-upload-file-label" id="image-upload-file-label-main"></label>
|
||||
<input type="submit" id='image-upload-submit-main' value="Upload" style="display:none">
|
||||
|
|
@ -54,20 +53,20 @@
|
|||
<button id="cancel-button" class="comment-action-button comment-action-cancel">CANCEL</button>
|
||||
<% end %>
|
||||
<button id="preview-button" class="comment-action-button comment-action-preview">PREVIEW</button>
|
||||
<%= f.submit "SUBMIT", onclick:"validateField(event)", class:"comment-action-button", id: "submit-button" %>
|
||||
<%= f.submit "SUBMIT", onclick: "validateField(event)", class: "comment-action-button", id: "submit-button" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @comment.persisted? %>
|
||||
|
||||
<script defer>
|
||||
if (document.getElementById("edit_comment_<%= @comment.id if @comment %>")){
|
||||
document.getElementById("edit_comment_<%= @comment.id if @comment %>").onsubmit = function(e) {
|
||||
if (document.getElementById("edit_comment_<%= @comment&.id %>")) {
|
||||
document.getElementById("edit_comment_<%= @comment&.id %>").onsubmit = function (e) {
|
||||
e.preventDefault();
|
||||
document.getElementById("submit-button").classList.add("submitting");
|
||||
document.getElementById("text-area").classList.add("submitting");
|
||||
var form = this;
|
||||
var waitingOnCSRF = setInterval(function(){
|
||||
var waitingOnCSRF = setInterval(function () {
|
||||
var metaTag = document.querySelector("meta[name='csrf-token']")
|
||||
if (metaTag) {
|
||||
clearInterval(waitingOnCSRF);
|
||||
|
|
@ -75,15 +74,15 @@
|
|||
document.getElementById("new_comment_authenticity_token").value = authToken;
|
||||
form.submit();
|
||||
}
|
||||
},1);
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script defer>
|
||||
var formElement = document.getElementById("edit_comment_<%= @comment.id if @comment %>");
|
||||
var formElement = document.getElementById("edit_comment_<%= @comment&.id %>");
|
||||
if (formElement) {
|
||||
formElement.getElementsByClassName("comment-action-cancel")[0].style.display = "inline-block";
|
||||
}
|
||||
</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
<% unless user_signed_in? %>
|
||||
<div class="comment-hash-marker" id="cta-comment-marker"></div>
|
||||
<div class="single-comment-node root comment-deep-0"
|
||||
id="cta-comment-register-now-node">
|
||||
id="cta-comment-register-now-node">
|
||||
<div class="inner-comment">
|
||||
<div class="details">
|
||||
<br/>
|
||||
<br />
|
||||
</div>
|
||||
<div class="body">
|
||||
<p>
|
||||
Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)
|
||||
</p>
|
||||
<p>
|
||||
Please consider creating an account on <a href="https://dev.to">dev.to</a>. It literally takes a few seconds and <b><em>we'd appreciate the support so much</em></b>. ❤️
|
||||
Please consider creating an account on
|
||||
<a href="https://dev.to">dev.to</a>. It literally takes a few seconds and
|
||||
<b><em>we'd appreciate the support so much</em></b>. ❤️
|
||||
</p>
|
||||
<p>Plus, no fake comments when you're signed in. 🙃</p>
|
||||
<button class="reaction-button" title="heart" style="margin-top: 20px;margin-bottom: -20px;z-index:100;">
|
||||
|
|
@ -22,4 +24,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
<%= javascript_include_tag 'application' %>
|
||||
<%= javascript_include_tag "application" %>
|
||||
|
||||
<div class="container delete-confirm">
|
||||
|
||||
<h4><%= truncate(strip_tags(@comment.processed_html.html_safe), length: 80) %></h4>
|
||||
<h1>Are you sure you want to delete this comment?</h2>
|
||||
<h2>You cannot undo this action, perhaps you just want to <a data-no-instant href="<%= @comment.path %>/edit">EDIT</a> instead?</h2>
|
||||
<h1>Are you sure you want to delete this comment?</h1>
|
||||
<h2>You cannot undo this action, perhaps you just want to
|
||||
<a data-no-instant href="<%= @comment.path %>/edit">EDIT</a> instead?</h2>
|
||||
|
||||
<h2><a class="delete-link" data-no-instant rel="nofollow" data-method="delete" href="/comments/<%= @comment.id %>">DELETE</a></h2>
|
||||
<h2>
|
||||
<a class="delete-link" data-no-instant rel="nofollow" data-method="delete" href="/comments/<%= @comment.id %>">DELETE</a>
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
|
||||
<div
|
||||
class="comments-container"
|
||||
id="comments-container"
|
||||
data-commentable-id="<%= @commentable.id %>"
|
||||
data-commentable-type="<%= @commentable.class.name %>"
|
||||
>
|
||||
data-commentable-type="<%= @commentable.class.name %>">
|
||||
<h1 style="padding-top:8%;text-align:center">Editing comment</h1>
|
||||
<%= render 'form',
|
||||
commentable: @commentable,
|
||||
commentable_type: @commentable.class.name
|
||||
%>
|
||||
<%= render "form",
|
||||
commentable: @commentable,
|
||||
commentable_type: @commentable.class.name %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -56,16 +56,17 @@
|
|||
</div>
|
||||
<% else %>
|
||||
<div class="body">
|
||||
<%= truncate(strip_tags(@commentable.processed_html), length: 150).html_safe %> <a href="<%= @commentable.path %>"><span class="read-more">[Read Full]</span></a>
|
||||
<%= truncate(strip_tags(@commentable.processed_html), length: 150).html_safe %>
|
||||
<a href="<%= @commentable.path %>"><span class="read-more">[Read Full]</span></a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="comments-container comments-dedicated-page-container"
|
||||
id="comments-container"
|
||||
data-commentable-id="<%= @commentable.id %>"
|
||||
data-commentable-type="<%= @commentable.class.name %>">
|
||||
id="comments-container"
|
||||
data-commentable-id="<%= @commentable.id %>"
|
||||
data-commentable-type="<%= @commentable.class.name %>">
|
||||
<% if @root_comment %>
|
||||
<div class="top-level-actions">
|
||||
<h3>re: <%= @commentable.title %> <a href="<%= @commentable.path %>">VIEW POST</a></h3>
|
||||
|
|
@ -78,8 +79,8 @@
|
|||
</div>
|
||||
<% else %>
|
||||
<%= render "form",
|
||||
commentable: @commentable,
|
||||
commentable_type: "Article" %>
|
||||
commentable: @commentable,
|
||||
commentable_type: "Article" %>
|
||||
<% end %>
|
||||
<div class="comment-trees" id="comment-trees-container">
|
||||
<% if @root_comment.present? %>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="container">
|
||||
<%= render 'form' %>
|
||||
<%= render "form" %>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,32 +1,36 @@
|
|||
<style>
|
||||
.pill{
|
||||
padding:8px 20px;
|
||||
border-radius:100px;
|
||||
color:white;
|
||||
margin-right:5px;
|
||||
font-size:14px;
|
||||
border: 2px solid transparent;
|
||||
margin-top: 6px;
|
||||
display: inline-block;
|
||||
}
|
||||
.mute{
|
||||
background-color: #EE7453;
|
||||
color: #ffffff;
|
||||
}
|
||||
.unmute{
|
||||
/* inverted background color */
|
||||
background-color: #1395b8;
|
||||
color: #ffffff;
|
||||
}
|
||||
.container{
|
||||
text-align: center;
|
||||
padding: 30px 0px;
|
||||
}
|
||||
@media screen and (min-width: 880px) {
|
||||
.container {
|
||||
margin-top: 100px;
|
||||
}
|
||||
}
|
||||
.pill {
|
||||
padding: 8px 20px;
|
||||
border-radius: 100px;
|
||||
color: white;
|
||||
margin-right: 5px;
|
||||
font-size: 14px;
|
||||
border: 2px solid transparent;
|
||||
margin-top: 6px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.mute {
|
||||
background-color: #EE7453;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.unmute {
|
||||
/* inverted background color */
|
||||
background-color: #1395b8;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.container {
|
||||
text-align: center;
|
||||
padding: 30px 0px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 880px) {
|
||||
.container {
|
||||
margin-top: 100px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="container">
|
||||
<h1>Comment Settings</h1>
|
||||
|
|
@ -39,7 +43,7 @@
|
|||
<% end %>
|
||||
<%= form_for(@comment, url: "/comment_mutes/#{@comment.id}", method: "patch", html: { class: "mute-form" }) do |f| %>
|
||||
<%= f.hidden_field :receive_notifications, value: !@comment.receive_notifications %>
|
||||
<%= f.submit @comment.receive_notifications ? "MUTE NOTIFICATIONS" : "NOTIFICATIONS MUTED", class: "cta pill #{@comment.receive_notifications ? "mute" : "unmute"}" %>
|
||||
<%= f.submit @comment.receive_notifications ? "MUTE NOTIFICATIONS" : "NOTIFICATIONS MUTED", class: "cta pill #{@comment.receive_notifications ? 'mute' : 'unmute'}" %>
|
||||
<% end %>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue