-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
// 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); |
There was a problem hiding this comment.
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 %>" |
There was a problem hiding this comment.
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 Report
@@ 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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
// textAreas | ||
$('.text-input').on('click', function(e) { | ||
$E.setState(e.currentTarget.dataset.formId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Video of setState
when clicking into a comment form: https://user-images.githubusercontent.com/4361605/106988941-d9c5c580-6725-11eb-964c-6aa81728aeb7.mov
Code Climate has analyzed commit 0811c5e and detected 0 issues on this pull request. View more on Code Climate. |
Looks super!!! |
Thank you!!! |
* 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
* 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
* 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
* 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
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.
(This issue is part of the larger Comment Editor Overhaul Project with Outreachy. Refer to Planning Issue #9069 for more context)