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

Manage listing categories in dashboard #10506

Merged
merged 13 commits into from Oct 2, 2020
Merged

Manage listing categories in dashboard #10506

merged 13 commits into from Oct 2, 2020

Conversation

Rafi993
Copy link
Contributor

@Rafi993 Rafi993 commented Oct 1, 2020

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

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?

  • yes
  • no, because they aren't needed
  • no, because I need help

Added to documentation?

  • docs.forem.com
  • readme
  • no documentation needed

@pr-triage pr-triage bot added the PR: draft bot applied label for PR's that are a work in progress label Oct 1, 2020
@@ -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
Copy link
Contributor Author

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

Copy link
Contributor

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

@Rafi993 Rafi993 marked this pull request as ready for review October 1, 2020 08:33
@Rafi993 Rafi993 requested a review from a team October 1, 2020 08:33
@Rafi993 Rafi993 requested a review from a team as a code owner October 1, 2020 08:33
@Rafi993 Rafi993 requested review from juliannatetreault and removed request for a team October 1, 2020 08:33
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: draft bot applied label for PR's that are a work in progress labels Oct 1, 2020
@rhymes rhymes requested review from fdocr and removed request for a team October 1, 2020 08:52
@rhymes rhymes changed the title Rafi993/manage listing in dashboard Manage listings in dashboard Oct 1, 2020
@rhymes rhymes changed the title Manage listings in dashboard Manage listing categories in dashboard Oct 1, 2020
@Rafi993
Copy link
Contributor Author

Rafi993 commented Oct 1, 2020

I think some unrelated test is failing

@rhymes
Copy link
Contributor

rhymes commented Oct 1, 2020

@Rafi993 restarted, cross fingers :D

Copy link
Contributor

@fdocr fdocr left a 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">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking suggestion:

Suggested change
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."
Copy link
Contributor

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

Suggested change
flash[:danger] = "Something went wrong with deleting the Listing Category."
flash[:danger] = @listing_category.errors.full_messages.to_sentence

@pr-triage pr-triage bot added PR: reviewed-changes-requested bot applied label for PR's where reviewer requests changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 1, 2020
@Rafi993
Copy link
Contributor Author

Rafi993 commented Oct 1, 2020

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.

Thank you @fdoxyz I'll make those changes.

@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: reviewed-changes-requested bot applied label for PR's where reviewer requests changes labels Oct 1, 2020
Copy link
Contributor

@fdocr fdocr left a 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).

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 1, 2020
Copy link
Contributor

@juliannatetreault juliannatetreault left a 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! 🎉
Screen Shot 2020-10-01 at 12 54 38 PM

Copy link
Contributor

@mstruve mstruve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works great!

@pr-triage pr-triage bot added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 1, 2020
@Rafi993
Copy link
Contributor Author

Rafi993 commented Oct 2, 2020

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!
Screen Shot 2020-10-01 at 12 54 38 PM

Thank you @juliannatetreault I did try to emulate 15 inch mac with and without retina display in chrome dev tools with following values

  • size 2880 x 1800
  • I tried device pixel ration 1, 2 and 3 (default value for my screen is 2)
  • My screen size is 14 inches hdpi screen

I also tried couple of other screen resolutions too but was unable to reproduce this issue.

@fdocr
Copy link
Contributor

fdocr commented Oct 2, 2020

I do get the same effect on 13 inch chrome, but also ran into this over with DisplayAds

Screen Shot 2020-10-01 at 20 39 54

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.
Maybe nice to have: A fix for the element to grow horizontally (could also be used to enhance other dashboards like this one)

@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Oct 2, 2020
@Rafi993
Copy link
Contributor Author

Rafi993 commented Oct 2, 2020

I do get the same effect on 13 inch chrome, but also ran into this over with DisplayAds

Screen Shot 2020-10-01 at 20 39 54

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.
Maybe nice to have: A fix for the element to grow horizontally (could also be used to enhance other dashboards like this one)

Thank you @fdoxyz I have changed the text to "Search by name" now.

@fdocr fdocr closed this Oct 2, 2020
@Rafi993
Copy link
Contributor Author

Rafi993 commented Oct 2, 2020

Thank you @fdoxyz should I revert the "search by name" placeholder change?

@fdocr fdocr reopened this Oct 2, 2020
@fdocr
Copy link
Contributor

fdocr commented Oct 2, 2020

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 🙌

@ludwiczakpawel
Copy link
Contributor

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 :)

Copy link
Contributor

@juliannatetreault juliannatetreault left a 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! 🎉

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 2, 2020
@Rafi993
Copy link
Contributor Author

Rafi993 commented Oct 2, 2020

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

@Zhao-Andy Zhao-Andy merged commit 4a9f271 into forem:master Oct 2, 2020
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to manage Listing Categories in /admin
7 participants