ecm_contact2 1.2.1 → 1.2.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/Rakefile +1 -2
- data/app/controllers/ecm/contact/requests_controller.rb +1 -2
- data/app/mail_forms/ecm/contact/request.rb +12 -12
- data/config/locales/ecm.contact.de.yml +1 -1
- data/lib/ecm/contact/configuration.rb +5 -5
- data/lib/ecm/contact/engine.rb +1 -1
- data/lib/ecm/contact/routing.rb +4 -4
- data/lib/ecm/contact/version.rb +1 -2
- data/lib/generators/ecm/contact/install/install_generator.rb +13 -7
- data/lib/generators/ecm/contact/install/templates/{ecm_contact.rb → initializer.rb} +3 -4
- data/lib/generators/ecm/contact/install/templates/routes.source +5 -0
- data/lib/generators/ecm/contact/locales/locales_generator.rb +5 -6
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c23440fc43b67bc00dd39c3e0a60f67f5acb0fc3
|
4
|
+
data.tar.gz: 4e47b62549a121316d6517d10ce38af3aaa90b5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23fc92a4af8b89d07a854844271be2c3d070d277c7879a9bddd9c93ce8ef03e43e571d5c17d648b9bc442dfbf9dcce82905d29afc79528aabab734924c368b7a
|
7
|
+
data.tar.gz: 073f60bbe95f05de9c2cb686accceb9246d75ba7f16ab94602861e8cedb3a1c6fbfc36023dade968c486638fe317c5dbea4e2c159ed4d8314deec50ea509f876
|
data/Rakefile
CHANGED
@@ -9,10 +9,9 @@ class Ecm::Contact::RequestsController < Ecm::Contact::Configuration.base_contro
|
|
9
9
|
@contact_request = Ecm::Contact::Request.new(params[:ecm_contact_request])
|
10
10
|
|
11
11
|
if @contact_request.deliver
|
12
|
-
redirect_to({ :
|
12
|
+
redirect_to({ action: 'index' }, notice: -> { I18n.t('ecm.contact.form.messages.delivered') }.call)
|
13
13
|
else
|
14
14
|
render :index
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
@@ -1,28 +1,28 @@
|
|
1
1
|
module Ecm
|
2
2
|
module Contact
|
3
3
|
class Request < MailForm::Base
|
4
|
-
attribute :name
|
4
|
+
attribute :name
|
5
5
|
attribute :email
|
6
6
|
attribute :phone
|
7
|
-
attribute :message
|
7
|
+
attribute :message
|
8
8
|
attribute :terms_of_service
|
9
|
-
attribute :nickname,
|
10
|
-
|
11
|
-
validates :email, :
|
12
|
-
validates :message, :
|
13
|
-
validates :name, :
|
14
|
-
validates :terms_of_service, :
|
9
|
+
attribute :nickname, captcha: true
|
10
|
+
|
11
|
+
validates :email, format: { with: /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i }, presence: true # , :message => Proc.new { I18n.t("activerecord.errors.messages.invalid") }.call }
|
12
|
+
validates :message, presence: true # { :message => Proc.new { I18n.t("activerecord.errors.messages.empty") }.call }
|
13
|
+
validates :name, presence: true # { :message => Proc.new { I18n.t("activerecord.errors.messages.empty") }.call }
|
14
|
+
validates :terms_of_service, acceptance: true # { :message => Proc.new { I18n.t("activerecord.errors.messages.accepted") }.call }
|
15
15
|
|
16
16
|
# Declare the e-mail headers. It accepts anything the mail method
|
17
17
|
# in ActionMailer accepts.
|
18
18
|
def headers
|
19
19
|
{
|
20
|
-
:
|
20
|
+
subject: proc { I18n.t('ecm.contact.request.subject', application_name: Rails.application.class.to_s.split('::').first) }.call,
|
21
21
|
# :to => I18n.t('ecm.contact.request.recipients'),
|
22
|
-
:
|
23
|
-
:
|
22
|
+
to: Ecm::Contact::Configuration.recipients[Rails.env],
|
23
|
+
from: %("#{name}" <#{email}>)
|
24
24
|
}
|
25
|
-
end
|
25
|
+
end
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -9,23 +9,23 @@ module Ecm
|
|
9
9
|
yield self
|
10
10
|
end
|
11
11
|
mattr_accessor :input_name_css_classes do
|
12
|
-
|
12
|
+
'form-control'
|
13
13
|
end
|
14
14
|
|
15
15
|
mattr_accessor :input_email_css_classes do
|
16
|
-
|
16
|
+
'form-control'
|
17
17
|
end
|
18
18
|
|
19
19
|
mattr_accessor :input_phone_css_classes do
|
20
|
-
|
20
|
+
'form-control'
|
21
21
|
end
|
22
22
|
|
23
23
|
mattr_accessor :input_message_css_classes do
|
24
|
-
|
24
|
+
'form-control'
|
25
25
|
end
|
26
26
|
|
27
27
|
mattr_accessor :input_terms_of_service_css_classes do
|
28
|
-
|
28
|
+
''
|
29
29
|
end
|
30
30
|
|
31
31
|
mattr_accessor :recipients do
|
data/lib/ecm/contact/engine.rb
CHANGED
data/lib/ecm/contact/routing.rb
CHANGED
@@ -3,11 +3,11 @@ module Ecm
|
|
3
3
|
class Routing
|
4
4
|
def self.routes(router, options = {})
|
5
5
|
options.reverse_merge!(
|
6
|
-
|
6
|
+
contact_request_actions: [:index, :create]
|
7
7
|
)
|
8
|
-
|
9
|
-
router.resources :ecm_contact_requests, :
|
8
|
+
|
9
|
+
router.resources :ecm_contact_requests, only: options[:contact_request_actions], controller: 'ecm/contact/requests'
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
13
|
-
end
|
13
|
+
end
|
data/lib/ecm/contact/version.rb
CHANGED
@@ -2,14 +2,20 @@ module Ecm
|
|
2
2
|
module Contact
|
3
3
|
module Generators
|
4
4
|
class InstallGenerator < Rails::Generators::Base
|
5
|
-
desc
|
5
|
+
desc 'Generates the intializer'
|
6
6
|
|
7
|
-
source_root File.expand_path('../templates', __FILE__)
|
8
|
-
|
9
|
-
def
|
10
|
-
copy_file
|
11
|
-
end
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
|
9
|
+
def generate_initializer
|
10
|
+
copy_file 'initializer.rb', 'config/initializers/ecm_contact.rb'
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_routes
|
14
|
+
inject_into_file 'config/routes.rb', before: "\nend" do
|
15
|
+
File.read(File.join(File.expand_path('../templates', __FILE__), 'routes.source'))
|
16
|
+
end
|
17
|
+
end
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
15
|
-
end
|
21
|
+
end
|
@@ -12,9 +12,9 @@ Ecm::Contact.configure do |config|
|
|
12
12
|
# }
|
13
13
|
#
|
14
14
|
config.recipients = {
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
15
|
+
development: %w( info@development.example.com ),
|
16
|
+
test: %w( info@test.example.com ),
|
17
|
+
production: %w( info@production.example.com )
|
18
18
|
}
|
19
19
|
|
20
20
|
# Configure your input field css classes here.
|
@@ -63,4 +63,3 @@ Ecm::Contact.configure do |config|
|
|
63
63
|
#
|
64
64
|
config.additional_contact_information = nil
|
65
65
|
end
|
66
|
-
|
@@ -2,19 +2,18 @@ module Ecm
|
|
2
2
|
module Contact
|
3
3
|
module Generators
|
4
4
|
class LocalesGenerator < Rails::Generators::Base
|
5
|
-
desc
|
5
|
+
desc 'Generates the locales'
|
6
6
|
|
7
7
|
source_root File.expand_path('../../../../../../config/locales', __FILE__)
|
8
8
|
|
9
9
|
def generate_intializer
|
10
|
-
copy_file
|
11
|
-
copy_file
|
10
|
+
copy_file 'ecm.contact.de.yml', 'config/locales/ecm.contact.de.yml'
|
11
|
+
copy_file 'ecm.contact.en.yml', 'config/locales/ecm.contact.en.yml'
|
12
12
|
|
13
|
-
copy_file
|
14
|
-
copy_file
|
13
|
+
copy_file 'ecm.contact.request.de.yml', 'config/locales/ecm.contact.request.de.yml'
|
14
|
+
copy_file 'ecm.contact.request.en.yml', 'config/locales/ecm.contact.request.en.yml'
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecm_contact2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -281,7 +281,8 @@ files:
|
|
281
281
|
- lib/ecm/contact/version.rb
|
282
282
|
- lib/ecm_contact2.rb
|
283
283
|
- lib/generators/ecm/contact/install/install_generator.rb
|
284
|
-
- lib/generators/ecm/contact/install/templates/
|
284
|
+
- lib/generators/ecm/contact/install/templates/initializer.rb
|
285
|
+
- lib/generators/ecm/contact/install/templates/routes.source
|
285
286
|
- lib/generators/ecm/contact/locales/locales_generator.rb
|
286
287
|
- lib/tasks/ecm_contact_tasks.rake
|
287
288
|
homepage: https://github.com/robotex82/ecm_contact2
|