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
Manage listing categories in dashboard #10506
Manage listing categories in dashboard #10506
Conversation
| @@ -18,6 +18,7 @@ module Role | |||
| "Resource Admin: Config", | |||
| "Resource Admin: Broadcast", | |||
| "Resource Admin: HtmlVariant", | |||
| "Resource Admin: DisplayAd"].freeze | |||
| "Resource Admin: DisplayAd", | |||
| "Resource Admin: ListingCategory"].freeze | |||
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 am not sure if it should be called Listing or ListingCategory
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.
as it's a category, I think ListingCategory is correct
|
I think some unrelated test is failing |
|
@Rafi993 restarted, cross fingers :D |
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.
Thank you for the PR @Rafi993, great job in following the sample PR from the issue!
Functionality-wise the PR is working great locally.
I have a small change I think it would be good to include and another non-blocking suggestion. I checked the sample PR from the issue and just now noticed this one slipped in there, so not your fault at all!
With this tiny change in place I'd say this looks good.
| <h2 class="fs-2xl s:fs-3xl mb-4">Listings</h2> | ||
| <a href="/admin/listings/categories" | ||
| aria-label="Listing Categories" | ||
| class="ml-auto"> |
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.
Non-blocking suggestion:
| class="ml-auto"> | |
| class="ml-auto crayons-btn"> |
| flash[:success] = "Listing Category has been deleted!" | ||
| redirect_to admin_listing_categories_path | ||
| else | ||
| flash[:danger] = "Something went wrong with deleting the Listing Category." |
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.
It's best to do the same as the update action so the error message will be descriptive
| flash[:danger] = "Something went wrong with deleting the Listing Category." | |
| flash[:danger] = @listing_category.errors.full_messages.to_sentence |
Thank you @fdoxyz I'll make those changes. |
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.
Awesome thanks again @Rafi993!
The codeclimate errors can be ignored since they're complaining about similar code in different places. So far we've considered it's best to maintain a similar approach in different admin controllers and maybe refactor later on in a way that would make this go away (or get rid of the codeclimate rule for this particular scenario).
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.
Thank you so much for adding Listing Categories management to /admin, @Rafi993! I tested everything out locally and it all worked really well. One thing that I did notice though, is that the placeholder text in the search bar, found under /admin/listings/categories, on a 15-inch screen on Google Chrome is slightly cut off (shown in the picture below). That aside, everything looked and worked great! 🎉

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.
Tested, works great!
Thank you @juliannatetreault I did try to emulate 15 inch mac with and without retina display in chrome dev tools with following values
I also tried couple of other screen resolutions too but was unable to reproduce this issue. |
|
I do get the same effect on 13 inch chrome, but also ran into this over with DisplayAds I couldn't find a way to make the input grow horizontally there (I tried a few things from https://storybook.forem.com/). A suggestion: Shortening the placeholder to "Search by name" would make it fit (like in DisplayAds) and it wouldn't be cut out. |
Thank you @fdoxyz I have changed the text to "Search by name" now. |
|
Thank you @fdoxyz should I revert the "search by name" placeholder change? |
|
So sorry @Rafi993 that's my bad! I was checking in to see if CI had failed on mobile and closed by accident 🙈 I'd love to give the opportunity for other different timezones to weigh in, we may get a suggestion for manipulating the input field a little better. It still has my approval 🙌 |
|
There's not an easy way (right now!) to manipulate easily the width of the input.. Changing the label to be shorter is a way to go IMO: "Search by name" and call it a day :) We can of course do some hacky things but I don't think it's worth it :) |
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.
Thank you for making the change to the placeholder text, @Rafi993! I think this PR is good-to-go now. Thanks again for doing this! 🎉
Thank you @juliannatetreault |

What type of PR is this?
Description
It adds ability to add/update/remove listing categories in admin panel
Related Tickets & Documents
closes #10481
QA Instructions, Screenshots, Recordings
https://vimeo.com/463735841/dfe6705dab
Added tests?
Added to documentation?