Skip to content

[resolves 6298] Add Custom Admin-Defined Navbar Links#6350

Merged
compwron merged 1 commit intorubyforgood:mainfrom
brodyf42:6298_add_custom_per_org_navbar_links
May 21, 2025
Merged

[resolves 6298] Add Custom Admin-Defined Navbar Links#6350
compwron merged 1 commit intorubyforgood:mainfrom
brodyf42:6298_add_custom_per_org_navbar_links

Conversation

@brodyf42
Copy link
Contributor

@brodyf42 brodyf42 commented Apr 8, 2025

What github issue is this PR for, if any?

Resolves #6298

What changed, and why?

  • Added CustomOrgLink model, controller, and views for CRUD operations
  • Added Custom Links section to Edit Organization UI
  • Added custom links section to sidebar navigation
  • Added UrlValidator class for checking link validity at a basic level

TODO: Need to discuss authorization/policy logic requirements with a more experienced casa developer

How is this tested? (please write rspec and jest tests!) 💖💪

TODO: Still need to write feature/request specs

Note: We love capybara tests! If you are writing both haml/js and ruby, please try to test your work with tests at every level including system tests like https://github.com/rubyforgood/casa/tree/main/spec/system

Screenshots please :)

image
image

Feelings gif (optional)

alt text

@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 erb labels Apr 8, 2025
@brodyf42 brodyf42 force-pushed the 6298_add_custom_per_org_navbar_links branch 2 times, most recently from 562aebc to 3129c01 Compare April 12, 2025 23:49
Copy link
Collaborator

@kcdragon kcdragon left a comment

Choose a reason for hiding this comment

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

This PR looks good. Once the rest of the specs are added, I think it will be ready to merge.

@compwron
Copy link
Collaborator

compwron commented May 2, 2025

The stakeholders are very interested in this one, they asked today :)

@brodyf42 brodyf42 force-pushed the 6298_add_custom_per_org_navbar_links branch from 3129c01 to 192b81b Compare May 6, 2025 04:20
Copy link
Collaborator

@kcdragon kcdragon left a comment

Choose a reason for hiding this comment

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

Looks good!

@bcastillo32
Copy link
Collaborator

@compwron @brodyf42 @kcdragon thanks for all the help. almost done :)

@brodyf42 brodyf42 force-pushed the 6298_add_custom_per_org_navbar_links branch from 192b81b to f90b407 Compare May 19, 2025 03:03
@brodyf42
Copy link
Contributor Author

I completed the request spec and addressed the comments left by @kcdragon and @compwron.
I believe all that remains is the system spec.

@brodyf42 brodyf42 force-pushed the 6298_add_custom_per_org_navbar_links branch from f90b407 to 60de39a Compare May 19, 2025 03:14
@brodyf42 brodyf42 force-pushed the 6298_add_custom_per_org_navbar_links branch from 60de39a to a1c76ff Compare May 20, 2025 03:16
@compwron
Copy link
Collaborator

We would love to get this merged soon!
Jocie was stessing that this would be incredibly helpful in making sure volunteers are more and more incentivized to use the tool

@compwron compwron requested a review from Copilot May 21, 2025 15:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds the functionality for custom, administrator-defined navbar links by introducing a new CustomOrgLink model, associated controller/actions, view components, and validations along with tests and policies.

  • Introduces CustomOrgLink model with validations and associations.
  • Implements CRUD operations and updates the UI to include custom links in the sidebar and organization edit views.
  • Adds new URL validation logic and corresponding tests, policies, and factory definitions.

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
spec/policies/custom_org_link_policy_spec.rb Adds policy specs for CustomOrgLink permissions
spec/models/custom_org_link_spec.rb Adds model tests for validations and associations
spec/models/casa_org_spec.rb Updates association for custom_org_links on CasaOrg
spec/factories/custom_org_links.rb Provides factory for creating CustomOrgLink instances
db/schema.rb, db/migrate/* Adds database table and migration for custom_org_links
config/routes.rb Registers routes for custom_org_links CRUD operations
app/views/layouts/_sidebar.html.erb Renders active custom links in the sidebar navigation
app/views/custom_org_links/* Creates views for new, edit, and form for CustomOrgLink records
app/views/casa_org/_custom_org_links.html.erb Implements table view to list and manage custom links in CasaOrg views
app/validators/url_validator.rb Introduces a URL validation class for CustomOrgLink
app/policies/custom_org_link_policy.rb Implements authorization policy for CustomOrgLink instances
app/models/custom_org_link.rb Defines model-level associations and validations for CustomOrgLink
app/controllers/custom_org_links_controller.rb Implements controller actions for CustomOrgLink CRUD operations
app/controllers/casa_org_controller.rb Updates CasaOrg controller to load custom_org_links for editing
.allow_skipping_tests Adds URL validator to the list of allowable skipped test files
Comments suppressed due to low confidence (2)

app/views/custom_org_links/_form.html.erb:21

  • The label for the display text field incorrectly uses the attribute :name instead of :text. Consider updating it to <%= form.label :text, "Display Text" %>.
<%= form.label :name, "Display Text" %>

app/views/custom_org_links/_form.html.erb:26

  • The label for the URL field incorrectly uses the attribute :name instead of :url. Consider updating it to <%= form.label :url, "URL" %>.
<%= form.label :name, "URL" %>

@@ -0,0 +1,12 @@
class CustomOrgLinkPolicy < ApplicationPolicy
Copy link
Collaborator

Choose a reason for hiding this comment

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

good policy

</div>
</div>
</div>
</div><!-- ==== end title ==== -->
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: comments not needed here

@@ -0,0 +1,8 @@
FactoryBot.define do
Copy link
Collaborator

Choose a reason for hiding this comment

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

good factory :)

Copy link
Collaborator

@compwron compwron left a comment

Choose a reason for hiding this comment

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

looks good, let's do it!

@compwron compwron marked this pull request as ready for review May 21, 2025 15:10
@compwron compwron merged commit c35dbff into rubyforgood:main May 21, 2025
12 of 13 checks passed
@brodyf42 brodyf42 deleted the 6298_add_custom_per_org_navbar_links branch June 8, 2025 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

erb ruby Pull requests that update Ruby code Tests! 🎉💖👏

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom Admin-Defined Navbar Links

5 participants