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

USER STORY: Create task without image #21

Closed
4 tasks done
blahosyl opened this issue Jul 30, 2024 · 2 comments
Closed
4 tasks done

USER STORY: Create task without image #21

blahosyl opened this issue Jul 30, 2024 · 2 comments
Assignees
Labels
e: ux tasks Epic: UX for Tasls p: could have Priority: Nice to have tutoring Consulted tutoring on this issue

Comments

@blahosyl
Copy link
Owner

blahosyl commented Jul 30, 2024

As a User,

I want to create task without an image,

so that I can focus on the task description instead

Acceptance Criteria

  1. The TaskCreateForm accepts inputs without an image file
  2. The API does not add a placeholder image to the Task object
  3. Tasks without images are shown without a placeholder

Tasks

The TaskCreateForm accepts inputs without an image file

  • allow FE validation to upload a new task without an image:
    image && formData.append("image", imageInput.current.files[0]);

The API does not add a placeholder image to the Task object

  • remove default image from API Task model image field & allow null as a value
  • change task serializer in API to only validate the image field if there is an input

Tasks without images are shown without a placeholder

  • change Task.js in FE to only show the image field if there is an image
@blahosyl blahosyl self-assigned this Jul 30, 2024
@blahosyl blahosyl added p: could have Priority: Nice to have tutoring Consulted tutoring on this issue labels Jul 30, 2024
@blahosyl blahosyl moved this to Backlog in Task Manager Jul 30, 2024
This was referenced Jul 30, 2024
blahosyl added a commit that referenced this issue Jul 31, 2024
@blahosyl blahosyl added e: ux comments Epic: UX for Comments e: ux tasks Epic: UX for Tasls and removed e: ux comments Epic: UX for Comments labels Aug 1, 2024
@blahosyl blahosyl added this to the Sprint 2 milestone Aug 4, 2024
@blahosyl
Copy link
Owner Author

blahosyl commented Aug 8, 2024

Tried and failed

  • Workaround suggested by tutor Rebecca did not lead to success, as it is about changing the value of an empty field, not allowing an empty field. It also doe not deal with file upload.
  • add null=True to the Post model in the API (DRF walkthough repo)
  • in FE, add conditional: to handleChange():
    image !== ""
        ? formData.append("image", imageInput.current.files[0])
        : formData.append("image", "")
    
  • tried the above with
    • image != ""
    • image
    • formData.append("image", null)

Progress

  • deleting formData.append("image", "") altogether creates a post with a placeholder image, proving that the validation is in the FE.

Success

image && formData.append("image", imageInput.current.files[0]);

@blahosyl blahosyl added the blocked Waiting for input or for another work phase to finish label Aug 8, 2024
@blahosyl blahosyl moved this from In Progress to Blocked/Ongoig in Task Manager Aug 8, 2024
@blahosyl blahosyl removed the blocked Waiting for input or for another work phase to finish label Aug 8, 2024
@blahosyl blahosyl moved this from Blocked/Ongoig to In Progress in Task Manager Aug 8, 2024
@blahosyl blahosyl closed this as completed Aug 8, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Task Manager Aug 8, 2024
blahosyl added a commit that referenced this issue Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e: ux tasks Epic: UX for Tasls p: could have Priority: Nice to have tutoring Consulted tutoring on this issue
Projects
Status: Done/Won't do
Development

No branches or pull requests

1 participant