Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Display status of item locations by status priority. #3758
base: dev-11.0
Are you sure you want to change the base?
Display status of item locations by status priority. #3758
Changes from 11 commits
2e917b0
9c07778
4d74ee2
8cf1ee9
cc13f9d
f257af4
5fc5bac
92b5022
0a56e68
04ee7cf
239c360
cfaa055
2c46f8e
34cc7be
3f6a1fb
c3d3ef6
cc00199
264487b
47d57da
4d5522b
72ad7e4
d1711b7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Should we have fallback behavior if
availabilityClasses[availability]
is undefined for some reason (either the AJAX handler returns an unexpected value, or the scripts setting the underlying data get broken)? It might be helpful to log something to the console, or at least avoid a Javascript error caused by an illegal array access.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.
Or alternatively, would it make sense to just pass the class as part of the AJAX response, and move some of the logic currently added to results-scripts.phtml into GetItemStatuses.php instead?
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.
I think returning the class and icon in GetItemStatuses.php would be cleaner and is easier to customize. Also the whole availabilityClasses would be unnecessary (I wasn't really happy with how I added it).
We could also directly return the rendered HTML. We have customized the HTML a bit, so returning rendered HTML would be appreciated. :-)
@ThoWagen what do you think?
Regarding the priority: For now I would leave it as is. I think this is a somewhat individual desicion for the libraries, so maybe a little survey would be good to determine what should be used as default.
Also, if we move this to 11.0, I would change the
true
andfalse
inHelper\Root\AvailabilityStatus:availabilityAsString()
to more descriptive terms. Previously I reverted that change in case you wanted to include this PR in 10.1There 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.
@GrothTobias I just remembered that we had this discussion already here #3585 (review) . So yes, I think moving the logic from JS to GetItemStatuses.php would make sense.
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.
I wasn't clear if server-side rendering of the location list is wanted, so the classes and icons for each location are now returned in
GetItemStatuses.php
. I added the icon names (not sure what to call it) toHelper\Root\AvailabilityStatus.php
, similar to the classes.With this the field
availability
is not needed for locations but I'm unsure if I should remove it - it could be useful if someone wants to customize this in the JS.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.
I think at this point I've gone ahead and moved this to the 11.0 milestone, so you can feel free to make larger changes if you like. I don't mind doing more server-side rendering in the AJAX handler as long as it properly accounts for the theme system (e.g. use a template to render where appropriate). Less Javascript code constructing HTML is probably a good thing, for readability and customization. :-)
I'm going to hold off on further review/testing until you're done making the changes you wish to make, so please let me know when you are ready for me to take a closer look again!
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
GetItemStatuses
handler now returns rendered HTML. As mentioned in the@TODO
there is still something to do but I don't have time for it next week.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.
Thanks for the progress; since this is now scheduled for release 11, there's no huge rush to finish -- just please let me know when you're ready for another review.