From d9ee35a42174c57dfa1e80f88950c159cb4987dd Mon Sep 17 00:00:00 2001 From: Glenn Carremans Date: Mon, 25 Feb 2019 19:03:31 +0100 Subject: [PATCH] Fix linting issues in app/views/comments (#1853) [ci skip] --- app/views/comments/_comment.html.erb | 18 ++++-- app/views/comments/_comment_proper.html.erb | 27 ++++---- app/views/comments/_form.html.erb | 59 +++++++++-------- .../comments/_login_cta_comment.html.erb | 10 +-- app/views/comments/delete_confirm.html.erb | 11 ++-- app/views/comments/edit.html.erb | 11 ++-- app/views/comments/index.html.erb | 13 ++-- app/views/comments/new.html.erb | 2 +- app/views/comments/settings.html.erb | 64 ++++++++++--------- 9 files changed, 115 insertions(+), 100 deletions(-) diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 273b76a82..323fc9cef 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -2,11 +2,19 @@ <% if comment.depth < 3 %>
  - <%= 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) %>
<% 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 %> \ No newline at end of file +<% end %> diff --git a/app/views/comments/_comment_proper.html.erb b/app/views/comments/_comment_proper.html.erb index 75de15164..450048445 100644 --- a/app/views/comments/_comment_proper.html.erb +++ b/app/views/comments/_comment_proper.html.erb @@ -10,16 +10,17 @@
<% if comment.decorate.low_quality %>
- <%= 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 View code of conduct + <%= 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 + View code of conduct
<% end %>
"> @@ -41,9 +42,9 @@ <% 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") %> ASK ME ANYTHING <% end %>
diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index a69ed7d13..033b6b5fe 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -1,13 +1,13 @@ <% if @comment.errors.any? %> -
-

<%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:

-
    - <% @comment.errors.full_messages.each do |message| %> -
  • <%= message %>
  • - <% end %> -
-
-



+
+

<%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:

+
    + <% @comment.errors.full_messages.each do |message| %> +
  • <%= message %>
  • + <% end %> +
+
+



<% end %> <%= form_for(@comment, authenticity_token: false) do |f| %> @@ -24,26 +24,25 @@ <% end %>
<%= 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 %>
-
-
+
+
- + " />
- + @@ -54,20 +53,20 @@ <% end %> - <%= 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" %>
<% end %> <% if @comment.persisted? %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/comments/_login_cta_comment.html.erb b/app/views/comments/_login_cta_comment.html.erb index 660270c8f..1ab66c4e5 100644 --- a/app/views/comments/_login_cta_comment.html.erb +++ b/app/views/comments/_login_cta_comment.html.erb @@ -1,17 +1,19 @@ <% unless user_signed_in? %>
+ id="cta-comment-register-now-node">
-
+

Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)

- Please consider creating an account on dev.to. It literally takes a few seconds and we'd appreciate the support so much. ❤️ + Please consider creating an account on + dev.to. It literally takes a few seconds and + we'd appreciate the support so much. ❤️

Plus, no fake comments when you're signed in. 🙃

-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/comments/delete_confirm.html.erb b/app/views/comments/delete_confirm.html.erb index ed7fe4b66..e7affda88 100644 --- a/app/views/comments/delete_confirm.html.erb +++ b/app/views/comments/delete_confirm.html.erb @@ -1,11 +1,14 @@ -<%= javascript_include_tag 'application' %> +<%= javascript_include_tag "application" %>

<%= truncate(strip_tags(@comment.processed_html.html_safe), length: 80) %>

-

Are you sure you want to delete this comment?

-

You cannot undo this action, perhaps you just want to EDIT instead?

+

Are you sure you want to delete this comment?

+

You cannot undo this action, perhaps you just want to + EDIT instead?

-

DELETE

+

+ DELETE +

diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb index 81c608483..bcc7d367e 100644 --- a/app/views/comments/edit.html.erb +++ b/app/views/comments/edit.html.erb @@ -1,13 +1,10 @@ -
+ data-commentable-type="<%= @commentable.class.name %>">

Editing comment

- <%= render 'form', - commentable: @commentable, - commentable_type: @commentable.class.name - %> + <%= render "form", + commentable: @commentable, + commentable_type: @commentable.class.name %>
diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb index 036ca93da..548cf0571 100644 --- a/app/views/comments/index.html.erb +++ b/app/views/comments/index.html.erb @@ -56,16 +56,17 @@
<% else %>
- <%= truncate(strip_tags(@commentable.processed_html), length: 150).html_safe %> [Read Full] + <%= truncate(strip_tags(@commentable.processed_html), length: 150).html_safe %> + [Read Full]
<% end %> <% end %>
<% end %>
+ id="comments-container" + data-commentable-id="<%= @commentable.id %>" + data-commentable-type="<%= @commentable.class.name %>"> <% if @root_comment %>

re: <%= @commentable.title %> VIEW POST

@@ -78,8 +79,8 @@
<% else %> <%= render "form", - commentable: @commentable, - commentable_type: "Article" %> + commentable: @commentable, + commentable_type: "Article" %> <% end %>
<% if @root_comment.present? %> diff --git a/app/views/comments/new.html.erb b/app/views/comments/new.html.erb index 419251207..1348a2ccf 100644 --- a/app/views/comments/new.html.erb +++ b/app/views/comments/new.html.erb @@ -1,4 +1,4 @@
- <%= render 'form' %> + <%= render "form" %>
diff --git a/app/views/comments/settings.html.erb b/app/views/comments/settings.html.erb index af9de4876..6dcf67c50 100644 --- a/app/views/comments/settings.html.erb +++ b/app/views/comments/settings.html.erb @@ -1,32 +1,36 @@

Comment Settings

@@ -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 %>
-
\ No newline at end of file +