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

update users migration to make :work col json #1125

Merged

Conversation

PhilipDeFraties
Copy link
Collaborator

@PhilipDeFraties PhilipDeFraties commented Nov 15, 2024

JIRA issue link

https://agile6.atlassian.net/browse/DM-5338

Description - what does this code do?

Adds logic and updates views to allow for management and display of users' work entries as hyperlinks

Testing done - how did you test it/steps on how can another person can test it

  1. update a user to granted_public_bio: true, nav to /edit-profile
  2. add text and valid url to the empty fields in the "Work" section, verify they persist upon form submission
  3. verify you can add another by clicking the "Add Another Work Link" button, wherein a blank set of fields appear and the "Add Another Work Link" button moves to be below the empty fields.
  4. Verify that added links persist, and that links removed with the "Remove" button persist as being removed.
  5. Verify that when you remove all links a blank set of fields appears and that the data persists as expected when the form is submitted.
  6. Verify that a work entry with an empty "Text" or "Link" field will prevent form submission with an error indicating which field is invalid over the field.
  7. Verify that a link formatted as "www.google.com" or "google.com" persists, but that anything missing a TLD results in a form error and prevents submission. Links saved without a "http" protocol should automatically save with "https" protocol inserted in the link text.
  8. Verify that persisted links render as hyperlinks on the bio page (`/bios/{user.id}"), links saved with no text will just list the link itself.

Screenshots, Gifs, Videos from application (if applicable)

Screenshot 2024-11-14 at 5 22 24 PM Screenshot 2024-11-14 at 5 22 36 PM Screenshot 2024-11-14 at 5 23 08 PM

Link to mock-ups/mock ups (image file if you have it) (if applicable)

Acceptance criteria

  • [ ]

Definition of done

  • Unit tests written (if applicable)
  • e2e/accessibility tests written (if applicable)
  • Events are logged appropriately
  • Documentation has been updated, if applicable
  • A link has been provided to the originating JIRA issue
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs

@PhilipDeFraties PhilipDeFraties force-pushed the dm-5089-dynamic-user-work-field branch from 4e0bb77 to 5b5a06e Compare November 19, 2024 00:48
@camillevilla camillevilla merged commit 2d31885 into user-public-bio-feature-branch Nov 20, 2024
@camillevilla camillevilla deleted the dm-5089-dynamic-user-work-field branch November 20, 2024 01:19
camillevilla pushed a commit that referenced this pull request Nov 20, 2024
* update users migration to make :work col json

* update users profile partial to expect new json datatype for :work attribute

* update user profile js to add logic for dynamic work link management

* update UsersController to handle changes to user's :work attribute

* update User model

adds #work method that returns values of work entries

adds validation method #validate_work_links to detect invalid links and store with proper protocol

* update user bio page to list user's work links as hyperlinks

* add feature and unit specs for user work management and display

* update user profile form work fields to include placeholder texts

* update schema with new json data type for :work col on users table

* update styling of "work" section in user's edit_profile partial

* refactor user_profile_utilities js to use modern class-based structure w/ arrow functions

* remove avatar cropping logic from UsersController

* remove UsersController#sanitize_work_links

redundant as per User model validation callback for the col

* update User#validate_work_links to use html_escape to sanitize links

* update User bio partial to utilize work link for display if text not present

* add before_validate method to User model to clear empty work values

* update edit_profile partial

adds  disable_with: false to submit button

* update user_profile_utilities js to validate work text fields upon form submission

* update "Add" button for work entries in user profile form to use kebab case
PhilipDeFraties added a commit that referenced this pull request Nov 21, 2024
* update users migration to make :work col json

* update users profile partial to expect new json datatype for :work attribute

* update user profile js to add logic for dynamic work link management

* update UsersController to handle changes to user's :work attribute

* update User model

adds #work method that returns values of work entries

adds validation method #validate_work_links to detect invalid links and store with proper protocol

* update user bio page to list user's work links as hyperlinks

* add feature and unit specs for user work management and display

* update user profile form work fields to include placeholder texts

* update schema with new json data type for :work col on users table

* update styling of "work" section in user's edit_profile partial

* refactor user_profile_utilities js to use modern class-based structure w/ arrow functions

* remove avatar cropping logic from UsersController

* remove UsersController#sanitize_work_links

redundant as per User model validation callback for the col

* update User#validate_work_links to use html_escape to sanitize links

* update User bio partial to utilize work link for display if text not present

* add before_validate method to User model to clear empty work values

* update edit_profile partial

adds  disable_with: false to submit button

* update user_profile_utilities js to validate work text fields upon form submission

* update "Add" button for work entries in user profile form to use kebab case
camillevilla pushed a commit that referenced this pull request Nov 28, 2024
* update users migration to make :work col json

* update users profile partial to expect new json datatype for :work attribute

* update user profile js to add logic for dynamic work link management

* update UsersController to handle changes to user's :work attribute

* update User model

adds #work method that returns values of work entries

adds validation method #validate_work_links to detect invalid links and store with proper protocol

* update user bio page to list user's work links as hyperlinks

* add feature and unit specs for user work management and display

* update user profile form work fields to include placeholder texts

* update schema with new json data type for :work col on users table

* update styling of "work" section in user's edit_profile partial

* refactor user_profile_utilities js to use modern class-based structure w/ arrow functions

* remove avatar cropping logic from UsersController

* remove UsersController#sanitize_work_links

redundant as per User model validation callback for the col

* update User#validate_work_links to use html_escape to sanitize links

* update User bio partial to utilize work link for display if text not present

* add before_validate method to User model to clear empty work values

* update edit_profile partial

adds  disable_with: false to submit button

* update user_profile_utilities js to validate work text fields upon form submission

* update "Add" button for work entries in user profile form to use kebab case
PhilipDeFraties added a commit that referenced this pull request Dec 2, 2024
* update users migration to make :work col json

* update users profile partial to expect new json datatype for :work attribute

* update user profile js to add logic for dynamic work link management

* update UsersController to handle changes to user's :work attribute

* update User model

adds #work method that returns values of work entries

adds validation method #validate_work_links to detect invalid links and store with proper protocol

* update user bio page to list user's work links as hyperlinks

* add feature and unit specs for user work management and display

* update user profile form work fields to include placeholder texts

* update schema with new json data type for :work col on users table

* update styling of "work" section in user's edit_profile partial

* refactor user_profile_utilities js to use modern class-based structure w/ arrow functions

* remove avatar cropping logic from UsersController

* remove UsersController#sanitize_work_links

redundant as per User model validation callback for the col

* update User#validate_work_links to use html_escape to sanitize links

* update User bio partial to utilize work link for display if text not present

* add before_validate method to User model to clear empty work values

* update edit_profile partial

adds  disable_with: false to submit button

* update user_profile_utilities js to validate work text fields upon form submission

* update "Add" button for work entries in user profile form to use kebab case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants