ecm_contact 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Roberto Vásquez Angel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1 @@
1
+ = ECM::Contact
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'EcmPictures'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1,18 @@
1
+ class Ecm::Contact::RequestsController < ApplicationController
2
+ def index
3
+ @title = I18n.t('ecm.contact.request.index.title')
4
+ @contact_request = Ecm::Contact::Request.new
5
+ end
6
+
7
+ def create
8
+ @title = I18n.t('ecm.contact.request.index.title')
9
+ @contact_request = Ecm::Contact::Request.new(params[:ecm_contact_request])
10
+
11
+ if @contact_request.deliver
12
+ redirect_to({ :action => 'index' }, :notice => I18n.t('ecm.contact.form.messages.delivered'))
13
+ else
14
+ render :index
15
+ end
16
+ end
17
+ end
18
+
@@ -0,0 +1,26 @@
1
+ module Ecm
2
+ module Contact
3
+ class Request < MailForm::Base
4
+ attribute :name
5
+ attribute :email
6
+ attribute :message
7
+ attribute :terms_of_service
8
+ attribute :nickname, :captcha => true
9
+
10
+ validates :email, :format => { :with => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i, :message => I18n.t("activerecord.errors.messages.invalid") }
11
+ validates :message, :presence => { :message => I18n.t("activerecord.errors.messages.empty") }
12
+ validates :name, :presence => { :message => I18n.t("activerecord.errors.messages.empty") }
13
+ validates :terms_of_service, :acceptance => { :message => I18n.t("activerecord.errors.messages.accepted") }
14
+
15
+ # Declare the e-mail headers. It accepts anything the mail method
16
+ # in ActionMailer accepts.
17
+ def headers
18
+ {
19
+ :subject => I18n.t('ecm.contact.request.subject', :application_name => Rails.application.class.to_s.split("::").first),
20
+ :to => I18n.t('ecm.contact.request.recipients'),
21
+ :from => %("#{name}" <#{email}>)
22
+ }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,13 @@
1
+ <%= simple_form_for @contact_request, :html_class => 'well' do |f| %>
2
+ <%= f.input :name %>
3
+ <%= f.input :email %>
4
+ <%= f.input :message, :as => :text %>
5
+ <%= f.input :terms_of_service, :as => :boolean %>
6
+
7
+ <div class="controls">
8
+ <%= button_tag(:type => 'submit', :class => 'input btn') do %>
9
+ <i class="icon-ok"></i>
10
+ <%= t('helpers.submit.create', :model => f.object.class.model_name.human) %>
11
+ <% end %>
12
+ </div>
13
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h1><%= Ecm::Contact::Request.model_name.human %></h1>
2
+
3
+ <%= render 'form' %>
@@ -0,0 +1,8 @@
1
+ de:
2
+ ecm:
3
+ contact:
4
+ request:
5
+ index:
6
+ title: Kotaktanfrage
7
+ recipients: robotex@robotex.de
8
+ subject: "[%{application_name}] Neue Kontaktanfrage"
@@ -0,0 +1,12 @@
1
+ de:
2
+ mail_form:
3
+ models:
4
+ ecm/contact/request: Kontaktanfrage
5
+ attributes:
6
+ ecm/contact/request:
7
+ email: E-Mail
8
+ name: Name
9
+ message: Nachricht
10
+ terms_of_service: Hiermit erlaube ich dem Seitenbetreiber die Nutzung meiner Daten zwecks Beantwortung dieser Kontaktanfrage.
11
+ request:
12
+ title: "Kontaktanfrage"
@@ -0,0 +1 @@
1
+ en:
@@ -0,0 +1,3 @@
1
+ de:
2
+ resources:
3
+ ecm_contact_requests: kontakt
@@ -0,0 +1,3 @@
1
+ en:
2
+ resources:
3
+ ecm_contact_requests: contact
@@ -0,0 +1,6 @@
1
+ module Ecm
2
+ module Contact
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ module Ecm
2
+ module Contact
3
+ class Routing
4
+ def self.routes(router, options = {})
5
+ options.reverse_merge!(
6
+ { :contact_request_actions => [:index, :create] }
7
+ )
8
+
9
+ router.resources :ecm_contact_requests, :only => options[:contact_request_actions], :controller => 'ecm/contact/requests'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Ecm
2
+ module Contact
3
+ VERSION = '0.0.1.pre'
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'mail_form'
2
+ require 'simple_form'
3
+
4
+ require 'ecm/contact/engine'
5
+ require 'ecm/contact/routing'
metadata ADDED
@@ -0,0 +1,285 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ecm_contact
3
+ version: !ruby/object:Gem::Version
4
+ hash: 961915968
5
+ prerelease: 6
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ - pre
11
+ version: 0.0.1.pre
12
+ platform: ruby
13
+ authors:
14
+ - Roberto Vasquez Angel
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2012-08-08 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 1
30
+ segments:
31
+ - 3
32
+ - 2
33
+ - 7
34
+ version: 3.2.7
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: mail_form
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: simple_form
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :runtime
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: thin
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ type: :development
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ name: yard
81
+ prerelease: false
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ type: :development
92
+ version_requirements: *id005
93
+ - !ruby/object:Gem::Dependency
94
+ name: capybara
95
+ prerelease: false
96
+ requirement: &id006 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ type: :development
106
+ version_requirements: *id006
107
+ - !ruby/object:Gem::Dependency
108
+ name: rspec-rails
109
+ prerelease: false
110
+ requirement: &id007 !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ~>
114
+ - !ruby/object:Gem::Version
115
+ hash: 3
116
+ segments:
117
+ - 2
118
+ - 0
119
+ version: "2.0"
120
+ type: :development
121
+ version_requirements: *id007
122
+ - !ruby/object:Gem::Dependency
123
+ name: shoulda-matchers
124
+ prerelease: false
125
+ requirement: &id008 !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ type: :development
135
+ version_requirements: *id008
136
+ - !ruby/object:Gem::Dependency
137
+ name: guard-rails
138
+ prerelease: false
139
+ requirement: &id009 !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ hash: 3
145
+ segments:
146
+ - 0
147
+ version: "0"
148
+ type: :development
149
+ version_requirements: *id009
150
+ - !ruby/object:Gem::Dependency
151
+ name: guard-rspec
152
+ prerelease: false
153
+ requirement: &id010 !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ hash: 3
159
+ segments:
160
+ - 0
161
+ version: "0"
162
+ type: :development
163
+ version_requirements: *id010
164
+ - !ruby/object:Gem::Dependency
165
+ name: guard-bundler
166
+ prerelease: false
167
+ requirement: &id011 !ruby/object:Gem::Requirement
168
+ none: false
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ hash: 3
173
+ segments:
174
+ - 0
175
+ version: "0"
176
+ type: :development
177
+ version_requirements: *id011
178
+ - !ruby/object:Gem::Dependency
179
+ name: factory_girl_rails
180
+ prerelease: false
181
+ requirement: &id012 !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ~>
185
+ - !ruby/object:Gem::Version
186
+ hash: 15
187
+ segments:
188
+ - 1
189
+ - 0
190
+ version: "1.0"
191
+ type: :development
192
+ version_requirements: *id012
193
+ - !ruby/object:Gem::Dependency
194
+ name: ffaker
195
+ prerelease: false
196
+ requirement: &id013 !ruby/object:Gem::Requirement
197
+ none: false
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ hash: 3
202
+ segments:
203
+ - 0
204
+ version: "0"
205
+ type: :development
206
+ version_requirements: *id013
207
+ - !ruby/object:Gem::Dependency
208
+ name: forgery
209
+ prerelease: false
210
+ requirement: &id014 !ruby/object:Gem::Requirement
211
+ none: false
212
+ requirements:
213
+ - - "="
214
+ - !ruby/object:Gem::Version
215
+ hash: 11
216
+ segments:
217
+ - 0
218
+ - 5
219
+ - 0
220
+ version: 0.5.0
221
+ type: :development
222
+ version_requirements: *id014
223
+ description: Basic contact form.
224
+ email:
225
+ - roberto@vasquez-angel.de
226
+ executables: []
227
+
228
+ extensions: []
229
+
230
+ extra_rdoc_files: []
231
+
232
+ files:
233
+ - app/controllers/ecm/contact/requests_controller.rb
234
+ - app/views/ecm/contact/requests/_form.erb
235
+ - app/views/ecm/contact/requests/index.html.erb
236
+ - app/mail_forms/ecm/contact/request.rb
237
+ - config/locales/ecm.contact.routes.de.yml
238
+ - config/locales/ecm.contact.de.yml
239
+ - config/locales/ecm.contact.routes.en.yml
240
+ - config/locales/ecm.contact.request.en.yml
241
+ - config/locales/ecm.contact.request.de.yml
242
+ - lib/ecm_contact.rb
243
+ - lib/ecm/contact/engine.rb
244
+ - lib/ecm/contact/version.rb
245
+ - lib/ecm/contact/routing.rb
246
+ - MIT-LICENSE
247
+ - Rakefile
248
+ - README.rdoc
249
+ homepage: https://github.com/robotex82/ecm_contact
250
+ licenses: []
251
+
252
+ post_install_message:
253
+ rdoc_options: []
254
+
255
+ require_paths:
256
+ - lib
257
+ required_ruby_version: !ruby/object:Gem::Requirement
258
+ none: false
259
+ requirements:
260
+ - - ">="
261
+ - !ruby/object:Gem::Version
262
+ hash: 3
263
+ segments:
264
+ - 0
265
+ version: "0"
266
+ required_rubygems_version: !ruby/object:Gem::Requirement
267
+ none: false
268
+ requirements:
269
+ - - ">"
270
+ - !ruby/object:Gem::Version
271
+ hash: 25
272
+ segments:
273
+ - 1
274
+ - 3
275
+ - 1
276
+ version: 1.3.1
277
+ requirements: []
278
+
279
+ rubyforge_project:
280
+ rubygems_version: 1.8.24
281
+ signing_key:
282
+ specification_version: 3
283
+ summary: Basic contact form.
284
+ test_files: []
285
+