Forem Creators and Builders

Cover image for I just delivered my first Forem badge. Working great!
Lee
Lee

Posted on

I just delivered my first Forem badge. Working great!

I have just made and delivered our first badge over at thismmalife.com

Thanks Julianna for the recent updates to this :D

thismmalife badge

Manage Badges in /admin/badges #9721

What type of PR is this? (check all applicable)

  • [x] Refactor
  • [x] Feature
  • [ ] Bug Fix
  • [ ] Optimization
  • [ ] Documentation Update

Description

Overall, this PR adds additional functionality to badge management and badge awarding via /admin/badge_achievements and specs to support the additions/changes that have been made. These additions and changes give Admins the ability to create, update, and "award" badges, as well as see an overview of all of the current badges via the redesigned /admin/badges index page. Furthermore, this PR addresses the verbiage around awarding badges and fixes a bug with usernames not being downcased when awarding badges to a user.

This PR adds the following:

  • The ability to create new badges via new/create controller actions and the necessary view and routes to make this happen.
  • The ability to edit/update existing badges via new controller actions and the necessary view and routes to make this happen.
  • The ability to view all badges and click on individual badges in order to edit/update them via a redesigned index page.
  • Appropriate methods in Admin::Internal::Badges and routes for the changes made.
  • A button, "Award Badges", that sends Admins to the badge award form, where they can award badges to users.
  • A button, "Create Badges", that sends Admins to the badge creation form, where they can create new badges.
  • Updates the routes for awarding badges from /admin/badges/award_badges to /admin/badge_achievements/award_badges
  • Reverts changes made to redirecting from /admin/badges to /admin/badge_achievements (after a discussion, we decided that only awarding badges should live under the /badge_achievements route and every other action should remain living under /admin/badges).
  • Updates to the language used in the warning banner on the badge award form and above the usernames field on the form.
  • .downcase to usernames when awarding badges to ensure that they are lowercase and do not silently fail.
  • Additional specs around case-sensitive names when awarding badges, the new badge URL and its redirect, updating badges with the new edit form, and creating badges with the new form.

Related Tickets & Documents

Related to PR #9643

QA Instructions, Screenshots, Recordings

  • Navigate to /admin/badges to observe the redesigned index page for badge management:

Screen Shot 2020-08-11 at 1 58 56 PM

  • Click on an individual badge's title to navigate to the badge's edit page:

Screen Shot 2020-08-11 at 2 29 20 PM

  • Once on the edit page, update the badge by changing its title, slug, description, and/or badge_image to ensure that everything works properly (prior to updating everything, test that the "Back to All Badges" button works!):

Screen Shot 2020-08-11 at 2 31 15 PM

  • After updating the badge, you will be redirected back to the index page. You should see your newly updated badge appear in the table, as well as a confirmation that the badge was updated:

Screen Shot 2020-08-11 at 2 31 35 PM

  • Once you are redirected back to the index page, click the "Create Badge" button to navigate to the badge creation form:

Screen Shot 2020-08-11 at 2 36 06 PM

  • Fill out the form and click the "Create Badge" button to successfully create a new badge:

Screen Shot 2020-08-11 at 2 37 45 PM

  • After creating the badge, you will be redirected back to the index page. You should see your newly created badge appear in the table, as well as a confirmation that the badge was created:

Screen Shot 2020-08-11 at 2 37 58 PM

  • Once you are back on the index page, click the "Award Badge" button to navigate to the badge awarding form:

Screen Shot 2020-08-11 at 2 44 13 PM

  • Select a badge and fill out the rest of the form and to award a badge to yourself and/or another user:

Screen Shot 2020-08-11 at 2 44 56 PM

  • Once you have clicked "Award Badges", you will be redirected to the index page where you should see a confirmation message:

Screen Shot 2020-08-11 at 2 39 53 PM

  • Navigate to your notifications to ensure that you received a notification for the awarded badge:

Screen Shot 2020-08-11 at 11 15 51 AM

  • Navigate to the profiles of the users you awarded badges to and ensure that the badges were awarded:

Screen Shot 2020-08-11 at 11 59 00 AM

Screen Shot 2020-08-11 at 2 55 04 PM

  • Click on the newly awarded badge to ensure that it renders as expected with all of the badge information you provided:

Screen Shot 2020-08-11 at 11 57 41 AM

  • Finally, navigate to one of your badges using /badge/ + the slug for the badge (for example, /badge/money-sloth-award) it to ensure that navigating this way still works as well:

Screen Shot 2020-08-11 at 11 52 34 AM

  • Try to break things! 🛠️

Added tests?

  • [x] yes, in addition to updating existing specs
  • [ ] no, because they aren't needed
  • [ ] no, because I need help

Added to documentation?

  • [ ] docs.forem.com
  • [ ] readme
  • [x] no documentation needed... I think? Any ideas on whether or not these addition/changes warrant additions/changes to documentation?

[optional] Are there any post-deployment tasks we need to perform?

None that I can think of!

[optional] What gif best describes this PR or how it makes you feel?

John Legend Award

Discussion (6)

Collapse
juliannatetreault profile image
Julianna Tetreault

How exciting! I'm glad that you're loving the feature so far and cannot wait to see what other badges you create. 🎉

Collapse
lee profile image
Lee Author

Actually I am working on digital badges for belts in jiu-jitsu and other martial arts that I can award to people that have them in real life 🤓

Collapse
juliannatetreault profile image
Julianna Tetreault

That is super cool! 😎

Collapse
arun profile image
Arun

I received it. So cool! Glad to be part of the first 100. :D

Collapse
lee profile image
Lee Author

Yay!

Collapse
thomasbnt profile image
Thomas Bnt

🤩