mix-rails-contact-us 0.26.1 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/contacts_controller.rb +19 -0
- data/app/models/contact.rb +17 -0
- data/app/views/contacts/show.haml +24 -0
- data/app/views/templates/contacts/show.haml +1 -0
- data/config/locales/contact.pt-BR.yml +7 -0
- data/config/routes.rb +7 -0
- data/lib/mix-rails-contact-us/version.rb +1 -1
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e48ce8399e6c5655116a8ebcb599992b8bcfc25
|
4
|
+
data.tar.gz: 5eabdebeec82f118ccea2bc97bfc13db0b2e2035
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a087399339a9832b80f28c573d81d819b8680c72dd8b0985a2543d32ef70a373b2a0af91d8e16dd9c9954781ed25c7c421adba2eb81d2a622f29ad7fbbed010
|
7
|
+
data.tar.gz: fe131c52739e951844a246a81dc893c6bb09528855b279226bb6576942de634fcde5d7608448cab2fde790326b061a5d5e4f5d4dccb3ed71c232c3e5be7fea59
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class ContactsController < ApplicationController
|
2
|
+
|
3
|
+
def show
|
4
|
+
@form = Contact.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def create
|
8
|
+
@form = Contact.new(params[:contact])
|
9
|
+
|
10
|
+
if @form.valid?
|
11
|
+
@form.deliver
|
12
|
+
redirect_to contact_path, notice: t('contact.notice.success')
|
13
|
+
else
|
14
|
+
flash[:warn] = t('contact.notice.error')
|
15
|
+
render 'show'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Contact < MailForm::Base
|
2
|
+
|
3
|
+
attribute :name, validate: true
|
4
|
+
attribute :email, :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
|
5
|
+
attribute :subject
|
6
|
+
attribute :phone
|
7
|
+
attribute :message, validate: true
|
8
|
+
|
9
|
+
def headers
|
10
|
+
{
|
11
|
+
to: Setting.app_email,
|
12
|
+
subject: "Contato via site #{Setting.app_title}",
|
13
|
+
from: %("#{name}" <#{email}>)
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
- content_for :contact_content do
|
2
|
+
- if flash[:notice]
|
3
|
+
.alert.alert-success
|
4
|
+
= flash[:notice]
|
5
|
+
- if flash[:warn]
|
6
|
+
.alert.alert-warn
|
7
|
+
= flash[:warn]
|
8
|
+
= simple_form_for @form, url: contact_path do |f|
|
9
|
+
.row-fluid
|
10
|
+
.span12
|
11
|
+
= f.input :name, input_html: {class: 'span24'}
|
12
|
+
.span12
|
13
|
+
= f.input :email, input_html: {class: 'span24'}
|
14
|
+
.row-fluid
|
15
|
+
.span12
|
16
|
+
= f.input :phone, as: 'phone', input_html: {class: 'span24'}
|
17
|
+
.span12
|
18
|
+
= f.input :subject, input_html: {class: 'span24'}
|
19
|
+
.row-fluid
|
20
|
+
.span24
|
21
|
+
= f.input :message, as: :text, input_html: {class: 'span24'}
|
22
|
+
.ta-r
|
23
|
+
%button{:type => "sumit"} Enviar
|
24
|
+
= render template: 'templates/contacts/show'
|
@@ -0,0 +1 @@
|
|
1
|
+
= content_for(:contact_content)
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mix-rails-contact-us
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.
|
4
|
+
version: 0.26.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadjow Leão
|
@@ -31,6 +31,11 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- app/controllers/contacts_controller.rb
|
35
|
+
- app/models/contact.rb
|
36
|
+
- app/views/templates/contacts/show.haml
|
37
|
+
- app/views/contacts/show.haml
|
38
|
+
- config/locales/contact.pt-BR.yml
|
34
39
|
- config/routes.rb
|
35
40
|
- lib/tasks/mix-rails-contact-us_tasks.rake
|
36
41
|
- lib/mix-rails-contact-us.rb
|