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

[BUU] Columns broken after cloning #12636

Open
dacook opened this issue Jul 1, 2024 · 1 comment
Open

[BUU] Columns broken after cloning #12636

dacook opened this issue Jul 1, 2024 · 1 comment
Labels
bug-s4 The bug is annoying, but doesn't prevent from using the platform. Not so many users are impacted.

Comments

@dacook
Copy link
Member

dacook commented Jul 1, 2024

Description

On the new Bulk Edit Products screen (/admin/products with admin_style_v3),
And I have hidden some columns using the "Columns" dropdown,

When I select the product action Clone,
A new product appears in the table, but
An extra grey column appears to the side of the table (see picture)

Expected Behavior

The column sizes should remain as they were.

Actual Behaviour

as above

Steps to Reproduce

as above

Animated Gif/Screenshot

Screenshot 2024-07-02 at 7 47 50

Workaround

Select all columns for display, or reload the page.

Severity

bug-s4: it's annoying, but you can use it

https://github.com/openfoodfoundation/openfoodnetwork/wiki/Bug-severity

Your Environment

  • Version used:
  • Browser name and version:
  • Operating System and version (desktop or mobile):

Possible Fix

@dacook dacook added the bug-s4 The bug is annoying, but doesn't prevent from using the platform. Not so many users are impacted. label Jul 1, 2024
@dacook dacook added this to the [BUU2] Product List uplift milestone Jul 1, 2024
@dacook
Copy link
Member Author

dacook commented Jul 2, 2024

For developer reference, the code adjusting the colspans is here: https://github.com/openfoodfoundation/openfoodnetwork/blob/master/app/webpacker/controllers/column_preferences_controller.js

The problem is that the newly cloned product has a "new variant" cell that spans multiple columns. Other "new variant" cells have been adjusted by ColumnPreferencesController, but this one hasn't yet:
Screenshot 2024-07-02 at 9 47 37 am
![Screenshot 2024-07-02 at 9 48 05 am]
(https://github.com/openfoodfoundation/openfoodnetwork/assets/4188088/21c0bdc3-b30b-45f3-b14f-34a213d2a0ca)

I guess we need to tell ColumnPreferencesController to re-register the new colSpanCells.
I think we might be able to add a trigger similar to BulkFormController.registerElements(). See:

action: 'rails-nested-form:add->bulk-form#registerElements rails-nested-form:remove->bulk-form#toggleFormChanged' },


Some other thoughts:

Will it work better if we make the "new variant" cell span the entire row? We can easily give it a left padding to maintain its placement. Hmm, still need to make the colspan adjustment anyway.

It would be awesome if we could remove the need for the colspan adjustment entirely, but I don't think that will work:

  • the "new variant" button could exist on the left-most column, but what if that column is hidden..
    • maybe it could exist on every column, but invisible, and only visible for the left-most column that is showing
  • also what if that column isn't wide enough? we could try breaking out of the column, but last time I tried I couldn't get that to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s4 The bug is annoying, but doesn't prevent from using the platform. Not so many users are impacted.
Projects
Status: All the things 💤
Development

No branches or pull requests

1 participant