pet-rescue icon indicating copy to clipboard operation
pet-rescue copied to clipboard

App Root Page: when I click the CTA buttons I am directed to a new organization request form

Open kasugaijin opened this issue 1 year ago • 8 comments

The CTA buttons on the app root page should take the user to a form for organizations to fill out so they can request access to the app (see how we implemented the Feedback form available in the footer and on dashboards). When the user submits this form, it should send an email to the dev email account (TDB) with a title New Organization Request and provide the details from the form, below.

This email will inform the devs that they need to vet the organization, discuss their preferred slug, and then run the service to create a new organization.

The form should collect this information:

  • Organization Name
  • Your name (the person filling out the form) (we don't need to separate first and last, it's just for conversational purposes)
  • Organization Phone Number
  • Organization email
  • Country
  • City/Town
  • Province State

Please also change the CTA button text to Request an account Please also update the Org footer link to point to this new form Image

App root page CTA buttons x 3 Image Image

kasugaijin avatar Sep 25 '24 15:09 kasugaijin

I'm interested ✋🏻

DreamVenerable avatar Sep 28 '24 19:09 DreamVenerable

@DreamVenerable all yours

kasugaijin avatar Sep 28 '24 20:09 kasugaijin

@DreamVenerable how's this going? Let me know if you have questions.

kasugaijin avatar Oct 06 '24 01:10 kasugaijin

@kasugaijin Honestly I've been a bit busy, hence the lack of progress.

If I find myself stuck or unable to complete it I'll inform you.

DreamVenerable avatar Oct 06 '24 16:10 DreamVenerable

@kasugaijin Should I create a new model or handle it from the controller?

If we are going to to end up using the data then I think we should have a model for it, if not, then we don't need to persist the data

DreamVenerable avatar Oct 08 '24 19:10 DreamVenerable

@DreamVenerable please add a new controller - see app/controllers/contacts_controller.rb for an example. We don't need a model as the data will be sent to email.

I think we can call it something like app/controllers/organization_account_requests_controller.rb unless you can think of a better name. Please also add the route organization_account_requests, and view for this.

I also note that this will be the third contact form we are adding to the app/controller scope. I think there is a good argument to add a module like contact_forms in the controllers and views so we can keep these controllers and views together. We can move all three controllers/views to this module. Let me know if you want to tackle that also...or we can put in a new issue.

e.g.

scope module: 'contact_forms' do
  resources X
  resources y
  resources Z
end

kasugaijin avatar Oct 08 '24 19:10 kasugaijin

I made a new controller called OrganizationRequestsController, but I like your naming better as it's more clear.

Regarding the refactoring, I'll see to it after finishing this issue.

DreamVenerable avatar Oct 08 '24 19:10 DreamVenerable

@DreamVenerable sounds good! FYI @Aaryanpal as you are working on one of the contacts controllers

kasugaijin avatar Oct 08 '24 19:10 kasugaijin

@kasugaijin Hey, sorry I've been busy lately. Can you keep it open so that if someone wants to work on it can get assigned?

DreamVenerable avatar Oct 13 '24 21:10 DreamVenerable

@DreamVenerable For sure. Issue is ready for someone to be assigned.

kasugaijin avatar Oct 13 '24 21:10 kasugaijin

hi, @kasugaijin maybe i could start working on this one once the other pr is merged?

Meri-MG avatar Oct 16 '24 08:10 Meri-MG

@Meri-MG for sure!

kasugaijin avatar Oct 16 '24 13:10 kasugaijin

@Meri-MG let me know if you have any questions :)

kasugaijin avatar Oct 23 '24 00:10 kasugaijin

@Meri-MG let me know if you have any questions :)

Thank you, nothing major yet, i wrote a system test to drive my changes and had to have a separate controller for the create and new actions, but I'm not sure if that will be the case at the end. maybe i just need to have everything in one, organizations controller. but since its a new organization request the organization isnt set and I'm getting "no organization found" error.

Meri-MG avatar Oct 23 '24 10:10 Meri-MG

Ah right. There is this middleware in lib/middleware/organization_middleware.rb that sets the tenant on each request. So I think, providing there is no org slug in the URL e.g., /baja there should not be an org scope to worry about. We shouldn't need an org scope for this route either. Ideally this is handled by a single OrganizationAccountRequestsController scoped outside of the organization context.

Also I forgot to add, ensure the route you add is outside of the organization scope in routes.rb

kasugaijin avatar Oct 23 '24 15:10 kasugaijin

Ah right. There is this middleware in lib/middleware/organization_middleware.rb that sets the tenant on each request. So I think, providing there is no org slug in the URL e.g., /baja there should not be an org scope to worry about. We shouldn't need an org scope for this route either. Ideally this is handled by a single OrganizationAccountRequestsController scoped outside of the organization context.

Also I forgot to add, ensure the route you add is outside of the organization scope in routes.rb

Great, so I'm on the right path, i do have it in a separate controller outside of staff and organization modules, i just thought i would need to change that approach. Thank you, will carry on.

Meri-MG avatar Oct 24 '24 08:10 Meri-MG

Hello, @kasugaijin, I think I misunderstood something here... so on my current branch i was creating an organization, was getting slug null error so i added one more field where slug is populated automatically by stimulus, but then, today i read the description of the issue again and figured i didn't have to do any of these... For now, I'm wondering if i create a new model instead of creating an Organization and then the dev team creates an organization based on the provided info in the email?

here is my branch with the current changes

Meri-MG avatar Oct 29 '24 08:10 Meri-MG

@Meri-MG yes all this needs to do is show a form that when submitted sends an email to the devs. The organization is created later by the devs!

kasugaijin avatar Oct 29 '24 13:10 kasugaijin

Hello, @kasugaijin! I'm having trouble passing the nested location attributes from the controller to the mailer. I'm planning to open a draft PR, and if you have time, could you have a look? Another issue I'm having is with the system test. Choosing a province managed by the stimulus controller isn't working in the test.

Meri-MG avatar Oct 31 '24 05:10 Meri-MG

@Meri-MG for sure put up a draft and I can take a look. I’m also happy with an integration test over a system test. We should be able to pass params easily in a request.

kasugaijin avatar Oct 31 '24 13:10 kasugaijin