comfy_imprint 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.md +59 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/comfy_imprint/application.js +15 -0
- data/app/assets/javascripts/comfy_imprint/contacts.js +2 -0
- data/app/assets/stylesheets/comfy_imprint/application.css +13 -0
- data/app/assets/stylesheets/comfy_imprint/contacts.css +4 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/comfy_imprint/application_controller.rb +2 -0
- data/app/controllers/comfy_imprint/contacts_controller.rb +49 -0
- data/app/helpers/comfy_imprint/application_helper.rb +4 -0
- data/app/helpers/comfy_imprint/contacts_helper.rb +4 -0
- data/app/mailers/comfy_imprint/contact_mailer.rb +11 -0
- data/app/models/comfy_imprint/contact.rb +44 -0
- data/app/validators/clean_text_validator.rb +7 -0
- data/app/validators/company_name_validator.rb +7 -0
- data/app/validators/contact_method_validator.rb +7 -0
- data/app/validators/email_validator.rb +7 -0
- data/app/validators/name_validator.rb +7 -0
- data/app/validators/phone_validator.rb +7 -0
- data/app/validators/url_validator.rb +7 -0
- data/app/views/admin/comfy_imprint/contacts/edit.html.haml +3 -0
- data/app/views/admin/comfy_imprint/contacts/index.html.haml +15 -0
- data/app/views/admin/comfy_imprint/contacts/new.html.haml +3 -0
- data/app/views/admin/comfy_imprint/contacts/show.html.haml +6 -0
- data/app/views/comfy_imprint/contact_mailer/contact_email.html.haml +7 -0
- data/app/views/comfy_imprint/contact_mailer/contact_email.text.plain.haml +4 -0
- data/app/views/comfy_imprint/contacts/_form.html.haml +13 -0
- data/app/views/comfy_imprint/contacts/_submission.html.haml +8 -0
- data/app/views/comfy_imprint/contacts/new.html.haml +3 -0
- data/app/views/comfy_imprint/contacts/show.html.haml +4 -0
- data/config/initializers/comfy_imprint.rb +26 -0
- data/config/initializers/simple_form.rb +199 -0
- data/config/locales/comfy_imprint.en.yml +55 -0
- data/config/locales/comfy_imprint.ru.yml +55 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20130711211512_create_comfy_imprint_contacts.rb +16 -0
- data/lib/comfy_imprint.rb +13 -0
- data/lib/comfy_imprint/engine.rb +26 -0
- data/lib/comfy_imprint/version.rb +3 -0
- data/lib/tasks/comfy_imprint_tasks.rake +13 -0
- data/test/comfy_imprint_test.rb +7 -0
- data/test/controllers/comfy_imprint/contacts_controller_test.rb +51 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130718151203_create_comfy_imprint_contacts.comfy_imprint.rb +17 -0
- data/test/dummy/db/schema.rb +30 -0
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- data/test/fixtures/comfy_imprint/contacts.yml +11 -0
- data/test/helpers/comfy_imprint/contacts_helper_test.rb +6 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/mailers/comfy_imprint/contact_mailer_test.rb +9 -0
- data/test/models/comfy_imprint/contact_test.rb +9 -0
- data/test/test_helper.rb +15 -0
- metadata +291 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
= simple_form_for(@contact) do |f|
|
2
|
+
- if @contact.errors.any?
|
3
|
+
#error_explanation
|
4
|
+
%h2
|
5
|
+
= pluralize(@contact.errors.count, "error")
|
6
|
+
prohibited this contact from being saved:
|
7
|
+
%ul
|
8
|
+
- @contact.errors.full_messages.each do |msg|
|
9
|
+
%li= msg
|
10
|
+
- ComfyImprint.configuration.attributes_to_display.each do |field|
|
11
|
+
= f.input field
|
12
|
+
|
13
|
+
= f.button :submit, class: 'button small'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
ComfyImprint.configure do |config|
|
2
|
+
|
3
|
+
# Remove attributes you don't want displayed. If you add new attributes, specify them here as well.
|
4
|
+
# Order is important, young grasshopper! This is the order they will be rendered in in the view.
|
5
|
+
# Keep in mind that :is_subscribed is a general purpose boolean. It's up to you what meaning you attach to it.
|
6
|
+
# You can use it to indicate if use aggreed to be contacted or to have their email sold to NSA or whatever.
|
7
|
+
# Unless you really need to add more checkboxes - I suggest you don't as it make more cumbersome for people
|
8
|
+
# to contact you!
|
9
|
+
config.attributes_to_display = [:name, :email, :phone, :url, :company, :is_subscribed, :message]
|
10
|
+
|
11
|
+
# These attributes will be required to be filled in before form submission.
|
12
|
+
# This is used in models/comfy_imprint/contact.rb to set 'presence: true' or 'allow_blank: true' in validations.
|
13
|
+
config.attributes_to_require = [:email, :message] # :name, :phone, :url, :company, :is_subscribed
|
14
|
+
|
15
|
+
# Email you will be sending submission from. Most likely the same as what you put in email.rb initializer
|
16
|
+
config.mail_from = 'system@death-star.space'
|
17
|
+
|
18
|
+
# Email you want to recieve emails to. Sometimes it's the same as mail_from, but doesn't have to be.
|
19
|
+
config.mail_to = 'r2.d2@galactic-republic.space'
|
20
|
+
|
21
|
+
# Leave it alone or change to what makes sence to you so it's easy to filter in your email
|
22
|
+
config.mail_subject = "Contact us form submission from #{Rails.application.class.parent_name}"
|
23
|
+
|
24
|
+
# Number of contacts per page in the admin interface. Default is 10
|
25
|
+
config.contacts_per_page = 25
|
26
|
+
end
|
@@ -0,0 +1,199 @@
|
|
1
|
+
require 'simple_form'
|
2
|
+
|
3
|
+
# Use this setup block to configure all options available in SimpleForm.
|
4
|
+
SimpleForm.setup do |config|
|
5
|
+
# Wrappers are used by the form builder to generate a
|
6
|
+
# complete input. You can remove any component from the
|
7
|
+
# wrapper, change the order or even add your own to the
|
8
|
+
# stack. The options given below are used to wrap the
|
9
|
+
# whole input.
|
10
|
+
#config.wrappers :default, :class => :input,
|
11
|
+
# :hint_class => :field_with_hint, :error_class => :errors do |b|
|
12
|
+
# ## Extensions enabled by default
|
13
|
+
# # Any of these extensions can be disabled for a
|
14
|
+
# # given input by passing: `f.input EXTENSION_NAME => false`.
|
15
|
+
# # You can make any of these extensions optional by
|
16
|
+
# # renaming `b.use` to `b.optional`.
|
17
|
+
|
18
|
+
# # Determines whether to use HTML5 (:email, :url, ...)
|
19
|
+
# # and required attributes
|
20
|
+
# b.use :html5
|
21
|
+
|
22
|
+
# # Calculates placeholders automatically from I18n
|
23
|
+
# # You can also pass a string as f.input :placeholder => "Placeholder"
|
24
|
+
# b.use :placeholder
|
25
|
+
|
26
|
+
# ## Optional extensions
|
27
|
+
# # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
|
28
|
+
# # to the input. If so, they will retrieve the values from the model
|
29
|
+
# # if any exists. If you want to enable the lookup for any of those
|
30
|
+
# # extensions by default, you can change `b.optional` to `b.use`.
|
31
|
+
|
32
|
+
# # Calculates maxlength from length validations for string inputs
|
33
|
+
# b.optional :maxlength
|
34
|
+
|
35
|
+
# # Calculates pattern from format validations for string inputs
|
36
|
+
# b.optional :pattern
|
37
|
+
|
38
|
+
# # Calculates min and max from length validations for numeric inputs
|
39
|
+
# b.optional :min_max
|
40
|
+
|
41
|
+
# # Calculates readonly automatically from readonly attributes
|
42
|
+
# b.optional :readonly
|
43
|
+
|
44
|
+
# ## Inputs
|
45
|
+
# b.use :label_input
|
46
|
+
# b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
|
47
|
+
# b.use :error, :wrap_with => { :tag => :small, :class => :error }
|
48
|
+
#end
|
49
|
+
|
50
|
+
config.wrappers :default, class: 'input row',
|
51
|
+
hint_class: :field_with_hint, error_class: :errors do |b|
|
52
|
+
## Extensions enabled by default
|
53
|
+
# Any of these extensions can be disabled for a
|
54
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
55
|
+
# You can make any of these extensions optional by
|
56
|
+
# renaming `b.use` to `b.optional`.
|
57
|
+
|
58
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
59
|
+
# and required attributes
|
60
|
+
b.use :html5
|
61
|
+
|
62
|
+
# Calculates placeholders automatically from I18n
|
63
|
+
# You can also pass a string as f.input :placeholder => "Placeholder"
|
64
|
+
b.use :placeholder
|
65
|
+
|
66
|
+
## Optional extensions
|
67
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
|
68
|
+
# to the input. If so, they will retrieve the values from the model
|
69
|
+
# if any exists. If you want to enable the lookup for any of those
|
70
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
71
|
+
|
72
|
+
# Calculates maxlength from length validations for string inputs
|
73
|
+
b.optional :maxlength
|
74
|
+
|
75
|
+
# Calculates pattern from format validations for string inputs
|
76
|
+
b.optional :pattern
|
77
|
+
|
78
|
+
# Calculates min and max from length validations for numeric inputs
|
79
|
+
b.optional :min_max
|
80
|
+
|
81
|
+
# Calculates readonly automatically from readonly attributes
|
82
|
+
b.optional :readonly
|
83
|
+
|
84
|
+
## Inputs
|
85
|
+
b.wrapper tag: :div, class: 'large-16 small-16 columns' do |c|
|
86
|
+
c.wrapper tag: :div, class: 'row collapse' do |d|
|
87
|
+
d.wrapper tag: :div, class: 'large-4 small-4 columns' do |e|
|
88
|
+
e.use :label, wrap_with: {tag: :span, class: :prefix}
|
89
|
+
end
|
90
|
+
d.wrapper tag: :div, class: 'large-12 small-12 columns' do |e|
|
91
|
+
e.use :input
|
92
|
+
end
|
93
|
+
end
|
94
|
+
c.wrapper tag: :div, class: 'row collapse' do |d|
|
95
|
+
d.wrapper tag: :div, class: 'large-16 small-16 columns' do |e|
|
96
|
+
e.use :hint, wrap_with: { tag: :span, class: :hint }
|
97
|
+
e.use :error, wrap_with: { tag: :small, class: :error }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
# The default wrapper to be used by the FormBuilder.
|
105
|
+
config.default_wrapper = :default
|
106
|
+
|
107
|
+
# Define the way to render check boxes / radio buttons with labels.
|
108
|
+
# Defaults to :nested for bootstrap config.
|
109
|
+
# :inline => input + label
|
110
|
+
# :nested => label > input
|
111
|
+
config.boolean_style = :nested
|
112
|
+
|
113
|
+
# Default class for buttons
|
114
|
+
config.button_class = 'button'
|
115
|
+
|
116
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
117
|
+
# :first lists the first message for each field.
|
118
|
+
# Use :to_sentence to list all errors for each field.
|
119
|
+
# config.error_method = :first
|
120
|
+
|
121
|
+
# Default tag used for error notification helper.
|
122
|
+
config.error_notification_tag = :div
|
123
|
+
|
124
|
+
# CSS class to add for error notification helper.
|
125
|
+
#config.error_notification_class = 'alert alert-error'
|
126
|
+
# delete hint
|
127
|
+
config.error_notification_class = 'alert-box alert'
|
128
|
+
# ID to add for error notification helper.
|
129
|
+
# config.error_notification_id = nil
|
130
|
+
|
131
|
+
# Series of attempts to detect a default label method for collection.
|
132
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
133
|
+
|
134
|
+
# Series of attempts to detect a default value method for collection.
|
135
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
136
|
+
|
137
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
138
|
+
# config.collection_wrapper_tag = nil
|
139
|
+
|
140
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
141
|
+
# config.collection_wrapper_class = nil
|
142
|
+
|
143
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
144
|
+
# defaulting to :span. Please note that when using :boolean_style = :nested,
|
145
|
+
# SimpleForm will force this option to be a label.
|
146
|
+
# config.item_wrapper_tag = :span
|
147
|
+
|
148
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
149
|
+
# config.item_wrapper_class = nil
|
150
|
+
|
151
|
+
# How the label text should be generated altogether with the required text.
|
152
|
+
# config.label_text = lambda { |label, required| "#{required} #{label}" }
|
153
|
+
|
154
|
+
# You can define the class to use on all labels. Default is nil.
|
155
|
+
config.label_class = 'control-label'
|
156
|
+
|
157
|
+
# You can define the class to use on all forms. Default is simple_form.
|
158
|
+
config.form_class = :nice
|
159
|
+
|
160
|
+
# You can define which elements should obtain additional classes
|
161
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
162
|
+
|
163
|
+
# Whether attributes are required by default (or not). Default is true.
|
164
|
+
# config.required_by_default = true
|
165
|
+
|
166
|
+
# Tell browsers whether to use default HTML5 validations (novalidate option).
|
167
|
+
# Default is enabled.
|
168
|
+
config.browser_validations = false
|
169
|
+
|
170
|
+
# Collection of methods to detect if a file type was given.
|
171
|
+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
172
|
+
|
173
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
174
|
+
# to match as key, and the input type that will be used when the field name
|
175
|
+
# matches the regexp as value.
|
176
|
+
# config.input_mappings = { /count/ => :integer }
|
177
|
+
|
178
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
179
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
180
|
+
# config.wrapper_mappings = { :string => :prepend }
|
181
|
+
|
182
|
+
# Default priority for time_zone inputs.
|
183
|
+
# config.time_zone_priority = nil
|
184
|
+
|
185
|
+
# Default priority for country inputs.
|
186
|
+
# config.country_priority = nil
|
187
|
+
|
188
|
+
# Default size for text inputs.
|
189
|
+
# config.default_input_size = 50
|
190
|
+
|
191
|
+
# When false, do not use translations for labels.
|
192
|
+
# config.translate_labels = true
|
193
|
+
|
194
|
+
# Automatically discover new inputs in Rails' autoload path.
|
195
|
+
# config.inputs_discovery = true
|
196
|
+
|
197
|
+
# Cache SimpleForm inputs discovery
|
198
|
+
# config.cache_discovery = !Rails.env.development?
|
199
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
en:
|
2
|
+
comfy_imprint:
|
3
|
+
contact_us: 'Contact Us'
|
4
|
+
contact_mailer:
|
5
|
+
contact_email:
|
6
|
+
sent_by_contact_form: "Sent through contact form from %{email}"
|
7
|
+
sent_by_name: "Sent by %{name} from %{email}"
|
8
|
+
subject: "Contact Us message from %{email}"
|
9
|
+
contacts:
|
10
|
+
show:
|
11
|
+
notices:
|
12
|
+
error: 'You must enter both fields.'
|
13
|
+
success: 'Contact email was successfully sent. Thank you for your inquiry, we will try to get back to you ASAP.'
|
14
|
+
activerecord:
|
15
|
+
attributes:
|
16
|
+
contact: &contact
|
17
|
+
name: 'Full Name'
|
18
|
+
email: 'Email'
|
19
|
+
message: 'Message'
|
20
|
+
phone: 'Phone'
|
21
|
+
url: 'Website'
|
22
|
+
company: 'Company Name'
|
23
|
+
is_subscribed: 'Subscribe to Newsletter'
|
24
|
+
errors:
|
25
|
+
models:
|
26
|
+
comfy_imprint/contact:
|
27
|
+
attributes:
|
28
|
+
name:
|
29
|
+
invalid_name: "allows only valid names: Leia Vader-O'Solo II . No punctuation please."
|
30
|
+
email:
|
31
|
+
invalid_email: 'allows only valid emails: leia.vader_o_solo@death-star.space'
|
32
|
+
phone:
|
33
|
+
invalid_phone: 'allows only valid phones: (012) 345-6789 x 555'
|
34
|
+
url:
|
35
|
+
invalid_url: 'allows only valid urls: www.death-star.space'
|
36
|
+
company:
|
37
|
+
invalid_company_name: 'allows only valid company names: Death Star Candy Company, Inc.'
|
38
|
+
message:
|
39
|
+
invalid_clean_text: 'allows only valid characters: limit it to letters, numbers and punctuation ()-?!,. please.'
|
40
|
+
simple_form:
|
41
|
+
labels:
|
42
|
+
contact:
|
43
|
+
<<: *contact
|
44
|
+
placeholders:
|
45
|
+
contact:
|
46
|
+
name: 'James Bond'
|
47
|
+
email: 'james_bond@mi6.spy'
|
48
|
+
phone: '(007) 007-9999 x 007'
|
49
|
+
url: 'www.mi6.spy'
|
50
|
+
company: 'MI 6'
|
51
|
+
message:
|
52
|
+
helpers:
|
53
|
+
submit:
|
54
|
+
contact:
|
55
|
+
create: 'Send Email'
|
@@ -0,0 +1,55 @@
|
|
1
|
+
ru:
|
2
|
+
comfy_imprint:
|
3
|
+
contact_us: 'Прямая связь'
|
4
|
+
contact_mailer:
|
5
|
+
contact_email:
|
6
|
+
sent_by_contact_form: "Отправлено через контактную форму от %{email}"
|
7
|
+
sent_by_name: "Отправлено %{name} с %{email}"
|
8
|
+
subject: "Контактное сообщение с %{email}"
|
9
|
+
contacts:
|
10
|
+
show:
|
11
|
+
notices:
|
12
|
+
error: 'Вы должны заполнить все поля.'
|
13
|
+
success: 'Сообщение отправлено. Мы постараемся связаться с Вами как можно скорее.'
|
14
|
+
activerecord:
|
15
|
+
attributes:
|
16
|
+
contact: &contact
|
17
|
+
name: 'Полное Имя'
|
18
|
+
email: 'Е-мэйл'
|
19
|
+
message: 'Сообщение'
|
20
|
+
phone: 'Телефон'
|
21
|
+
url: 'Вебсайт'
|
22
|
+
company: 'Название Компании'
|
23
|
+
is_subscribed: 'Подписаться на рассылку'
|
24
|
+
errors:
|
25
|
+
models:
|
26
|
+
comfy_imprint/contact:
|
27
|
+
attributes:
|
28
|
+
name:
|
29
|
+
invalid_name: "разрешены только корректные знаки: Leia Vader-O'Solo II . Без пунктуации, пожалуйста!"
|
30
|
+
email:
|
31
|
+
invalid_email: 'разрешены только корректные е-мэйлы: leia.vader_o_solo@death-star.space'
|
32
|
+
phone:
|
33
|
+
invalid_phone: 'разрешены только корректные номера: (012) 345-6789 x 555'
|
34
|
+
url:
|
35
|
+
invalid_url: 'разрешены только корректные аддресса: www.death-star.space'
|
36
|
+
company:
|
37
|
+
invalid_company_name: 'разрешены только корректные названия компаний: Death Star Candy Company, Inc.'
|
38
|
+
message:
|
39
|
+
invalid_clean_text: 'разрешены только корректные знаки: ограничьтесь буквами, цифрами и знаками препинания ()-?!,. пожалуйста.'
|
40
|
+
simple_form:
|
41
|
+
labels:
|
42
|
+
contact:
|
43
|
+
<<: *contact
|
44
|
+
placeholders:
|
45
|
+
contact:
|
46
|
+
name: 'Майор Пронин'
|
47
|
+
email: 'major_pronin@fsb.spy'
|
48
|
+
phone: '(007) 007-9999 x 007'
|
49
|
+
url: 'www.fsb.spy'
|
50
|
+
company: 'ФСБ'
|
51
|
+
message:
|
52
|
+
helpers:
|
53
|
+
submit:
|
54
|
+
contact:
|
55
|
+
create: 'Отправить Сообщение'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateComfyImprintContacts < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :comfy_imprint_contacts do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :email
|
6
|
+
t.string :phone
|
7
|
+
t.string :url
|
8
|
+
t.string :company
|
9
|
+
t.boolean :is_subscribed
|
10
|
+
t.text :message
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :comfy_imprint_contacts, :email
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'comfy_imprint/engine'
|
2
|
+
require 'haml'
|
3
|
+
|
4
|
+
module ComfyImprint
|
5
|
+
# This sets up an instnace of configuaration to make it availbe in config/initializers/comfy_imprint.rb
|
6
|
+
def self.configuration
|
7
|
+
@configuration ||= Configuration.new
|
8
|
+
end
|
9
|
+
def self.configure
|
10
|
+
config = configuration
|
11
|
+
yield(config)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ComfyImprint
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace ComfyImprint
|
4
|
+
config.generators do |g|
|
5
|
+
g.template_engine :haml
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class Configuration
|
10
|
+
attr_accessor :attributes_to_display,
|
11
|
+
:attributes_to_require,
|
12
|
+
:contacts_per_page,
|
13
|
+
:mail_from,
|
14
|
+
:mail_to,
|
15
|
+
:mail_subject
|
16
|
+
|
17
|
+
def initialize #:nodoc:
|
18
|
+
@attributes_to_display = []
|
19
|
+
@attributes_to_require = []
|
20
|
+
@contacts_per_page = 1
|
21
|
+
@mail_from = ''
|
22
|
+
@mail_to = ''
|
23
|
+
@mail_subject = ''
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|