-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch to container-fluid to stretch background colors across page
- Loading branch information
Showing
13 changed files
with
234 additions
and
149 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,22 @@ | ||
class MessagesController < ApplicationController | ||
def new | ||
@message = Message.new | ||
end | ||
|
||
def create | ||
@message = Message.new(message_params) | ||
if @message.valid? | ||
MessageMailer.contact(@message).deliver_now | ||
redirect_to new_message_url | ||
flash[:notice] = "Thanks! We have received your message and will be in touch soon." | ||
else | ||
flash[:danger] = "There was an error in sending your message. Please try again." | ||
render :new | ||
end | ||
end | ||
|
||
private | ||
def message_params | ||
params.require(:message).permit(:name, :phone_number, :body) | ||
end | ||
end |
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,4 @@ | ||
class MessagesMailer < ApplicationMailer | ||
def contact(@message) | ||
end | ||
end |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class Message | ||
include ActiveModel::Model | ||
attr_accessor :name, :phone_number, :body | ||
validates :name, :phone_number, :body, presence: true | ||
validates :name, :phone_number, presence: true | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div class="container"> | ||
<div class="row"> | ||
|
||
<div class="col-md-8 col-md-offset-2"> | ||
|
||
<h1> Contact Fox Decorating</h1> | ||
|
||
<p class="center"> Drop us a line and we will be in touch soon!</p><br/> | ||
|
||
<%= form_for @message, url: contact_path, method: :post do |f| %> | ||
<%= f.label :name, "Name:" %> | ||
<%= f.text_field :name, class: 'form-control' %> | ||
<%= f.label :phone_number, "Contact Phone:" %> | ||
<%= f.email_field :phone_number, class: 'form-control' %> | ||
<%= f.label :body, "Optional Message:" %> | ||
<%= f.email_field :body, class: 'form-control' %> | ||
<% end %> | ||
<br/> | ||
<%= submit_tag("Contact Us", class: "btn btn-primary col-md-12") %> | ||
|
||
</div> | ||
</div> | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe MessagesController, type: :controller do | ||
|
||
end |
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,5 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe MessagesMailer, type: :mailer do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |
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,4 @@ | ||
# Preview all emails at http:https://localhost:3000/rails/mailers/messages_mailer | ||
class MessagesMailerPreview < ActionMailer::Preview | ||
|
||
end |