mix-rails-contact-us 0.26.1 → 0.26.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf0a0a399f76557fe3f03bcc5b4e963bff93fa81
4
- data.tar.gz: 6b6ed1779fcea86f76188a95fba7af47759a7823
3
+ metadata.gz: 0e48ce8399e6c5655116a8ebcb599992b8bcfc25
4
+ data.tar.gz: 5eabdebeec82f118ccea2bc97bfc13db0b2e2035
5
5
  SHA512:
6
- metadata.gz: bce2082a3f7ddeeedd9dd3ed277b43a69ec613c0e59060ef71ffa6b1880d23f40fd46f49c30cd8cdd6d34893f93ee4284f5586e31a47f40fdd68813c812413e2
7
- data.tar.gz: 7aca1af8e1f1ea68b2d33d1ca538bccb6360e99b26d39493bcfddd86bc3a075f00ac77d6dabf8189a5646899c5a1163aa6c39bbd7f51dca75bde379953e5045c
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)
@@ -0,0 +1,7 @@
1
+ pt-BR:
2
+ resource:
3
+ contact: "contato"
4
+ contact:
5
+ notice:
6
+ success: "Email enviado com sucesso"
7
+ error: "Por favor, corrija os erros abaixo"
data/config/routes.rb CHANGED
@@ -1,2 +1,9 @@
1
1
  Rails.application.routes.draw do
2
+
3
+ localized do
4
+ resource :contact, only: [:show, :create]
5
+ end
6
+
7
+ # get '/contato' => "contact#index", as: 'contact'
8
+ # post '/contato' => "contact#send_mail"
2
9
  end
@@ -2,7 +2,7 @@ module MixRailsContactUs
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 26
5
- TINY = 1
5
+ TINY = 2
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
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.1
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