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

Organization Request - Issue #1009 #1031

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions app/controllers/organization_requests_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class OrganizationRequestsController < ApplicationController
skip_before_action :authenticate_user!
skip_verify_authorized only: %i[new create]

def new
@organization_request = OrganizationRequest.new
end

def create
@organization_request = OrganizationRequest.new(organization_params)

if @organization_request.valid?
OrganizationMailer.with(organization_params).send_organization_request.deliver_later
redirect_to root_path, notice: "Organization request submitted successfully!"
else
render :new, status: :unprocessable_entity
end
end

private

def organization_params
params.require(:organization_request).permit(:org_name, :name, :phone, :email, :country, :city, :state)
end
end
2 changes: 2 additions & 0 deletions app/helpers/organization_requests_helper.rb
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can get rid of these empty files :)

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module OrganizationRequestsHelper
end
Empty file.
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@

resources :contacts, only: %i[new create]
resources :dev_contacts, path: "feedback", only: %i[new create]
resources :organization_request, path: "org_request", only: %i[new create]
end
7 changes: 7 additions & 0 deletions test/controllers/organization_requests_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "test_helper"

class OrganizationRequestsControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
Loading