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 Comment Editor Save & Recover #9132

Merged
merged 15 commits into from
Feb 6, 2021

Conversation

noi5e
Copy link
Contributor

@noi5e noi5e commented Feb 5, 2021

Related to #9004 (Object-Oriented Refactor) and Partial Fix for #9131 (Save & Recover Issues)

I wrote a more detailed write-up in the above issue here: #9131 (comment)

This is ready to merge.

  • Refactor comment editor save & recover for multiple comment forms.
  • Write a new system test.

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

@noi5e noi5e added JavaScript feature explains that the issue is to add a new feature outreachy labels Feb 5, 2021
@noi5e noi5e requested review from a team as code owners February 5, 2021 04:05
@gitpod-io
Copy link

gitpod-io bot commented Feb 5, 2021

// for save & recover buttons
$('.save-button').on('click', function(e) {
$E.setState(e.currentTarget.dataset.formId); // string that is: "main", "reply-123", "edit-123" etc.
$E.save($E);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

$E.setState in three new places: save buttons, recover buttons, clicking on textareas.

id="text-input-edit-<%= comment.id%>"
class="form-control text-input"
name="body"
data-form-id="edit-<%= comment.id %>"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The editor needs this data-form-id attribute to setState.

@codecov
Copy link

codecov bot commented Feb 5, 2021

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #9132   +/-   ##
=======================================
  Coverage        ?   82.12%           
=======================================
  Files           ?      100           
  Lines           ?     5931           
  Branches        ?        0           
=======================================
  Hits            ?     4871           
  Misses          ?     1060           
  Partials        ?        0           

>
Recover
<i class="fas fa-undo"></i>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New icon for the Recover Button!

Now it looks like this:
Screen Shot 2021-02-04 at 8 13 18 PM

Before (bleh):
Screen Shot 2021-02-04 at 8 14 24 PM


// textAreas
$('.text-input').on('click', function(e) {
$E.setState(e.currentTarget.dataset.formId);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codeclimate
Copy link

codeclimate bot commented Feb 5, 2021

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

View more on Code Climate.

@jywarren
Copy link
Member

jywarren commented Feb 6, 2021

Looks super!!!

@jywarren jywarren merged commit 4f09389 into publiclab:main Feb 6, 2021
@jywarren
Copy link
Member

jywarren commented Feb 6, 2021

Thank you!!!

@noi5e noi5e deleted the refactor-editor-save-recover branch February 6, 2021 04:40
manchere pushed a commit to manchere/plots2 that referenced this pull request Feb 13, 2021
* merge branches publiclab#9104 publiclab#9107 publiclab#9108 publiclab#9110 publiclab#9118

* change #dropzone-large ID to #comment-form-body

* add comprehensive preview button test

* add text-input class, data-form-id attribute to textarea publiclab#9004 publiclab#9131

* add data-form-id to save & recover buttons publiclab#9004 publiclab#9131

* E.setState when clicking save, recover, & .text-input publiclab#9004 publiclab#9131

* refactor save & recover publiclab#9004 publiclab#9131

* add icon to recover button publiclab#9004 publiclab#9131

* restore edit button tooltip publiclab#9004 publiclab#9131

* save with window.location.pathname, not href publiclab#9004 publiclab#9131

* new system test for save & recover publiclab#9004 publiclab#9131

* update test selector publiclab#9004 publiclab#9131
lagunasmel pushed a commit to lagunasmel/plots2 that referenced this pull request Mar 2, 2021
* merge branches publiclab#9104 publiclab#9107 publiclab#9108 publiclab#9110 publiclab#9118

* change #dropzone-large ID to #comment-form-body

* add comprehensive preview button test

* add text-input class, data-form-id attribute to textarea publiclab#9004 publiclab#9131

* add data-form-id to save & recover buttons publiclab#9004 publiclab#9131

* E.setState when clicking save, recover, & .text-input publiclab#9004 publiclab#9131

* refactor save & recover publiclab#9004 publiclab#9131

* add icon to recover button publiclab#9004 publiclab#9131

* restore edit button tooltip publiclab#9004 publiclab#9131

* save with window.location.pathname, not href publiclab#9004 publiclab#9131

* new system test for save & recover publiclab#9004 publiclab#9131

* update test selector publiclab#9004 publiclab#9131
reginaalyssa pushed a commit to reginaalyssa/plots2 that referenced this pull request Oct 16, 2021
* merge branches publiclab#9104 publiclab#9107 publiclab#9108 publiclab#9110 publiclab#9118

* change #dropzone-large ID to #comment-form-body

* add comprehensive preview button test

* add text-input class, data-form-id attribute to textarea publiclab#9004 publiclab#9131

* add data-form-id to save & recover buttons publiclab#9004 publiclab#9131

* E.setState when clicking save, recover, & .text-input publiclab#9004 publiclab#9131

* refactor save & recover publiclab#9004 publiclab#9131

* add icon to recover button publiclab#9004 publiclab#9131

* restore edit button tooltip publiclab#9004 publiclab#9131

* save with window.location.pathname, not href publiclab#9004 publiclab#9131

* new system test for save & recover publiclab#9004 publiclab#9131

* update test selector publiclab#9004 publiclab#9131
billymoroney1 pushed a commit to billymoroney1/plots2 that referenced this pull request Dec 28, 2021
* merge branches publiclab#9104 publiclab#9107 publiclab#9108 publiclab#9110 publiclab#9118

* change #dropzone-large ID to #comment-form-body

* add comprehensive preview button test

* add text-input class, data-form-id attribute to textarea publiclab#9004 publiclab#9131

* add data-form-id to save & recover buttons publiclab#9004 publiclab#9131

* E.setState when clicking save, recover, & .text-input publiclab#9004 publiclab#9131

* refactor save & recover publiclab#9004 publiclab#9131

* add icon to recover button publiclab#9004 publiclab#9131

* restore edit button tooltip publiclab#9004 publiclab#9131

* save with window.location.pathname, not href publiclab#9004 publiclab#9131

* new system test for save & recover publiclab#9004 publiclab#9131

* update test selector publiclab#9004 publiclab#9131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature explains that the issue is to add a new feature JavaScript outreachy readytomerge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants