benetech / Imageshare

MIT License
0 stars 0 forks source link

Resource File Groups Order #268

Closed clapierre closed 3 years ago

clapierre commented 3 years ago

In the Resources - File Groups section (right panel, of associated file groups) We can order the file groups including the default file group however the UI always shows the order as the order they were created.

The UI ordering of the groups should match the order in the Resource File Group

I am also fine if the admin moves the default group in the middle of two groups, let me know if that causes any issues, but I would think you would just go down the list populating the UI as you go

Group Color Labels default Group Braille Labels

or

default Group Color Labels Group Braille Labels

or

Group Braille Labels Group Color Labels default

Whatever the Resource File group order is will be the order on the UI.

jkva commented 3 years ago

The current logic explicitly renders the default group first because it has no heading -- how are you expecting the visual distinction to look when you go from the last file in Group Color Labels to the first file in default, for instance? Right now that would visually be only background color since default groups have no heading or expand/collapse functionality.

clapierre commented 3 years ago

Maybe in addition to just the background color difference there could be a boarder around the entire grouping to help make it a little more distinct.

I am fine with the default always being first, but the ordering of the rest really should match what the order is on the back end and ideally not allow you to move the default from the first position, but I am less worried about that, its just confusing when you go in and move the groups around on the Wordpress Resource "groups" panel and it doesn't change the order of the groups in the UI.

jkva commented 3 years ago

Ordering and border color addressed in dff2c303c023845c8a65b2df90cd2403a77bc861 and 5c2278a3e787ec1965306657d056f4b1c6a99205

clapierre commented 3 years ago

Can we increase the separation between file groups Hard to see where one ends and the other beings with the minimal spacing

screen shot of resource page showing a minimal gap between groups

sinabahram commented 3 years ago

Quick a11y note. Please put alt text on the images :). Thanks much

jkva commented 3 years ago

@clapierre sure thing, sorted in a5dab96.

@sinabahram which images specifically? I don't always have alt text available, not for resource files, where I render an empty alt. When a description exists (for the main resource image) it's rendered as the image alt. Did I overlook something?

jkva commented 3 years ago

Ah sorry - was this to @clapierre? I misunderstood.

clapierre commented 3 years ago

Ya not sure @sinabahram What alt texts are needed. We didn't change anything as far as the images were concerned.

jkva commented 3 years ago

I think @sinabahram meant the screenshot you posted in this thread.

clapierre commented 3 years ago

All images in these groupS are really described by the surrounding text so should be marked decorative I believe

sinabahram commented 3 years ago

That's not possible as they are links, so must have appropriate alt text.

sinabahram commented 3 years ago

And, yes, I'm talking about screenshots in the thread. Sorry for confusion there.

jkva commented 3 years ago

@clapierre please close the issue if you're happy with the modifications I made to the styling 👍

clapierre commented 3 years ago

Lets try 1.5em. Added the alt text Sina above, missed that.

jkva commented 3 years ago

It's at 1.5em now 👍

clapierre commented 3 years ago

The 1.5em looks great, however seems we have lost the ability to order the associated resource file groups which the original comment of this ticket was requesting. I believe that was fixed but somewhere along the way we lost that associated panel in the Resource File of associated file groups which we could order.

If default always appears first then I would be fine to omit that from the sortable list an all additional resource groups could be ordered.

Currently in the Frog Dissection there are 3 groups + default which would be great to order so that all the Braille groups are together etc. This would be customized by the admin like we previously had.

Frog Dissection Color Labels Frog Dissection Braille No Labels Frog Dissection Braille Labels

jkva commented 3 years ago

This is difficult since the relationship has been inverted; file groups have a parent resources relationship instead of parent resources having file group relationships.

If this is to be done without a bunch of custom work, may I suggest the following:

1) the "file group" edit page gets an integer field: order 2) this is not a required field (if it's not set, order of 1 is assumed) 3) a default group has implicit order of 0 4) sorting goes by increasing value of this property

Would that work for you @clapierre?

clapierre commented 3 years ago

Yes this could work, but what would happen if we have 5 resource file groups for a resource default 0 group A 1 group B 2 group D 3 group E 4 group C 5

Then I realized that the last group I just made Group C should be at level 3, can I just change the position 5 to a 3 and groups D and E will get the new values of 4 & 5 automatically?

If thats the case yes that will work.

jkva commented 3 years ago

can I just change the position 5 to a 3 and groups D and E will get the new values of 4 & 5 automatically?

It adds a bit of logic, but I can work on that. Thanks for the clarification.

jkva commented 3 years ago

@clapierre I've done some work on this. File groups now have a "Display order" field that is also reflected in the admin overview. Basically:

1) you can give any number starting at 1. [1, 10, 20, 25, 234234], etc. 2) when you save the group, any groups for the parent resource become reordered. So the example sequence above would become [0 (default), 2, 3, 4, 5, 6]. 3) when you change the order of a group, the groups around it become re-ordered. 4) when you create a new group for that resource, and say, give it order 3, the existing order 3 becomes 4 and so on.

Can you play around with this and tell me what you think?

clapierre commented 3 years ago

Yes this seems to be working however its weird that the default groups says 1 not 0? Also the instructions say The display order of this group in the list of groups. From low-to-high. [0, 1, 2], 0 = first, 2 = last.

But if I put 0 and try to save it says the value is invalid it must be 1 or greater.

jkva commented 3 years ago

That's a good catch! The value for default groups is effectively ignored. I'll add a condition that hides that input field when the group is a default group. And I'll update the description.

jkva commented 3 years ago

Addressed via d54d62abfddf8f87c380a052a1a66b1c4a53bbcd

clapierre commented 3 years ago

Looks good.