ecm_contact 0.0.3.pre → 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -13,6 +13,13 @@ Install your bundle:
13
13
 
14
14
  > bundle install
15
15
 
16
+ Run the generator:
17
+
18
+ > ecm:contact:install
19
+
20
+ This will create an initializer file in config/initializers. You should configure
21
+ your recipients there.
22
+
16
23
  Add the routes:
17
24
 
18
25
  # config/routes.rb
@@ -18,7 +18,8 @@ module Ecm
18
18
  def headers
19
19
  {
20
20
  :subject => I18n.t('ecm.contact.request.subject', :application_name => Rails.application.class.to_s.split("::").first),
21
- :to => I18n.t('ecm.contact.request.recipients'),
21
+ # :to => I18n.t('ecm.contact.request.recipients'),
22
+ :to => Ecm::Contact::Configuration.recipients[Rails.env],
22
23
  :from => %("#{name}" <#{email}>)
23
24
  }
24
25
  end
@@ -6,7 +6,7 @@
6
6
  <%= f.input :terms_of_service, :as => :boolean %>
7
7
 
8
8
  <div class="controls">
9
- <%= button_tag(:type => 'submit', :class => 'input btn') do %>
9
+ <%= button_tag(:type => 'submit', :class => 'input btn', :id => 'ecm_contact_request_submit') do %>
10
10
  <i class="icon-ok"></i>
11
11
  <%= t('helpers.submit.create', :model => f.object.class.model_name.human) %>
12
12
  <% end %>
@@ -0,0 +1,15 @@
1
+ require 'active_support/core_ext/module/delegation'
2
+ require 'active_support/core_ext/module/attribute_accessors'
3
+
4
+ module Ecm
5
+ module Contact
6
+ module Configuration
7
+ def configure
8
+ yield self
9
+ end
10
+
11
+ mattr_accessor :recipients
12
+ @@recipients = {}
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module Contact
3
- VERSION = '0.0.3.pre'
3
+ VERSION = '1.0.0.pre'
4
4
  end
5
5
  end
data/lib/ecm_contact.rb CHANGED
@@ -3,3 +3,10 @@ require 'simple_form'
3
3
 
4
4
  require 'ecm/contact/engine'
5
5
  require 'ecm/contact/routing'
6
+ require 'ecm/contact/configuration'
7
+
8
+ module Ecm
9
+ module Contact
10
+ extend Configuration
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module Ecm
2
+ module Contact
3
+ module Generators
4
+ class InstallGenerator < Rails::Generators::Base
5
+ desc "Generates the intializer"
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def generate_intializer
10
+ copy_file "ecm_contact.rb", "config/initializers/ecm_contact.rb"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,10 @@
1
+ Ecm::Contact.configure do |config|
2
+ # Configure your contact requiest recipients here.
3
+ #
4
+ # You can specify multiple recipients and multiple environments.
5
+ config.recipients = {
6
+ :development => %w( info@development.example.com ),
7
+ :test => %w( info@test.example.com ),
8
+ :production => %w( info@production.example.com )
9
+ }
10
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_contact
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961915976
4
+ hash: 961915988
5
5
  prerelease: 6
6
6
  segments:
7
+ - 1
7
8
  - 0
8
9
  - 0
9
- - 3
10
10
  - pre
11
- version: 0.0.3.pre
11
+ version: 1.0.0.pre
12
12
  platform: ruby
13
13
  authors:
14
14
  - Roberto Vasquez Angel
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-08-28 00:00:00 Z
19
+ date: 2012-08-29 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rails
@@ -240,10 +240,13 @@ files:
240
240
  - config/locales/ecm.contact.request.en.yml
241
241
  - config/locales/ecm.contact.en.yml
242
242
  - config/locales/ecm.contact.request.de.yml
243
+ - lib/generators/ecm/contact/install/install_generator.rb
244
+ - lib/generators/ecm/contact/install/templates/ecm_contact.rb
243
245
  - lib/ecm_contact.rb
244
246
  - lib/ecm/contact/engine.rb
245
247
  - lib/ecm/contact/version.rb
246
248
  - lib/ecm/contact/routing.rb
249
+ - lib/ecm/contact/configuration.rb
247
250
  - MIT-LICENSE
248
251
  - Rakefile
249
252
  - README.rdoc