Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor & Add Comments to create.js.erb; Style Fixes for Question Comments & Toolbar Buttons #9195

Merged
merged 3 commits into from
Feb 15, 2021

Conversation

noi5e
Copy link
Contributor

@noi5e noi5e commented Feb 14, 2021

  1. Attach image upload functionality ONLY to edit comment form in comment responses.
  2. Style fixes for toolbar buttons (make colors all the same, cursor: pointer;
  3. Correct the width of comments on question/show partial

(This issue is part of the larger Comment Editor Overhaul Project with Outreachy. Refer to Planning Issue #9069 for more context)

@gitpod-io
Copy link

gitpod-io bot commented Feb 14, 2021

@codeclimate
Copy link

codeclimate bot commented Feb 14, 2021

Code Climate has analyzed commit a29e2c6 and detected 0 issues on this pull request.

View more on Code Climate.

@codecov
Copy link

codecov bot commented Feb 14, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@7e9321d). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #9195   +/-   ##
=======================================
  Coverage        ?   82.05%           
=======================================
  Files           ?      100           
  Lines           ?     5939           
  Branches        ?        0           
=======================================
  Hits            ?     4873           
  Misses          ?     1066           
  Partials        ?        0           

@@ -1,23 +1,43 @@
// this code runs after a new comment is posted.
// 1. it inserts the new comment into the DOM
// 2. it also creates image upload functionality for the new comment form (see /app/assets/javascripts/editorToolbar.js)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanatory comment.

selector: '#dropzone-small-reply-<%= @comment.cid %>',
isButton: true
}
]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder that this code is for attaching image upload functionality to fresh comments.

I realized that a fresh comment can either:

  1. Be a comment NOT responding to another comment (will have both an edit form and a reply form).
  2. Be in response to another comment (will have ONLY an edit form).

Therefore, if a comment is a response, image upload functionality should only be attached to the edit form (the reply form doesn't exist).

That's the main change I'm making in this PR.

<% comments.includes([:node, :replied_comments]).order("timestamp ASC").each do |comment| %>
<% if comment.reply_to.nil? %>
<%= render :partial => "notes/comment", :locals => {:comment => comment} %>
<div id="legacy-editor-container" class="col-lg-10">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style fix here to shrink the width of question comment container to 75%... That's what it used to be before recent changes I can't track.

The partials for question/show, wiki/show, and notes/show could use some serious clean-up!

@jywarren jywarren merged commit abcb004 into publiclab:main Feb 15, 2021
@jywarren
Copy link
Member

Nicely done. And, agree about the cleanup in the views; that code has seen MANY iterations!

@noi5e noi5e deleted the refactor-followup branch February 15, 2021 20:19
lagunasmel pushed a commit to lagunasmel/plots2 that referenced this pull request Mar 2, 2021
…mments & Toolbar Buttons (publiclab#9195)

* stop instantiating fileupload for non-existent elements; add comments

* style fixes for toolbar buttons

* shorten width of comment container
reginaalyssa pushed a commit to reginaalyssa/plots2 that referenced this pull request Oct 16, 2021
…mments & Toolbar Buttons (publiclab#9195)

* stop instantiating fileupload for non-existent elements; add comments

* style fixes for toolbar buttons

* shorten width of comment container
billymoroney1 pushed a commit to billymoroney1/plots2 that referenced this pull request Dec 28, 2021
…mments & Toolbar Buttons (publiclab#9195)

* stop instantiating fileupload for non-existent elements; add comments

* style fixes for toolbar buttons

* shorten width of comment container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants