-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7740 from fjordllc/feature/corporate_training_for…
…m_create 企業研修の申し込みフォームを作成(修正)
- Loading branch information
Showing
18 changed files
with
135 additions
and
140 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
app/controllers/corporate_training_inquiries_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# frozen_string_literal: true | ||
|
||
class CorporateTrainingInquiriesController < ApplicationController | ||
include Recaptchable::V3 | ||
skip_before_action :require_active_user_login, raise: false | ||
|
||
def new | ||
@corporate_training_inquiry = CorporateTrainingInquiry.new | ||
end | ||
|
||
def create | ||
@corporate_training_inquiry = CorporateTrainingInquiry.new(corporate_training_inquiry_params) | ||
|
||
result = valid_recaptcha?('corporate_training_inquiry') | ||
if result && @corporate_training_inquiry.save | ||
CorporateTrainingInquiryMailer.incoming(@corporate_training_inquiry).deliver_later | ||
redirect_to new_corporate_training_inquiry_url, notice: 'お問い合わせを送信しました。' | ||
else | ||
flash.now[:alert] = 'Bot対策のため送信を拒否しました。しばらくしてからもう一度送信してください。' unless result | ||
render :new | ||
end | ||
end | ||
|
||
private | ||
|
||
def corporate_training_inquiry_params | ||
params.require(:corporate_training_inquiry).permit( | ||
:company_name, | ||
:name, | ||
:email, | ||
:meeting_date1, | ||
:meeting_date2, | ||
:meeting_date3, | ||
:participants_count, | ||
:training_duration, | ||
:how_did_you_hear, | ||
:additional_information, | ||
:privacy_policy | ||
) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class CorporateTrainingInquiryMailer < ApplicationMailer | ||
def incoming(corporate_training_inquiry) | ||
@corporate_training_inquiry = corporate_training_inquiry | ||
mail to: '[email protected]', reply_to: @corporate_training_inquiry.email, subject: '[FBC] 企業研修の申し込み' | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
app/models/corporate_training.rb → app/models/corporate_training_inquiry.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
test/fixtures/corporate_training.yml → test/fixtures/corporate_training_inquiry.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
|
||
require 'test_helper' | ||
|
||
class CorporateTrainingMailerTest < ActionMailer::TestCase | ||
class CorporateTrainingInquiryMailerTest < ActionMailer::TestCase | ||
test 'incoming' do | ||
corporate_training = CorporateTraining.new( | ||
corporate_training_inquiry = CorporateTrainingInquiry.new( | ||
company_name: '株式会社ロッカ', | ||
name: '駒形真幸', | ||
email: '[email protected]', | ||
|
@@ -16,7 +16,7 @@ class CorporateTrainingMailerTest < ActionMailer::TestCase | |
how_did_you_hear: 'インターネットで知った', | ||
additional_information: 'よろしくお願いします。' | ||
) | ||
mail = CorporateTrainingMailer.incoming(corporate_training) | ||
mail = CorporateTrainingInquiryMailer.incoming(corporate_training_inquiry) | ||
assert_equal '[FBC] 企業研修の申し込み', mail.subject | ||
assert_equal ['[email protected]'], mail.to | ||
assert_equal ['[email protected]'], mail.from | ||
|
Oops, something went wrong.