Skip to content

ezcontact

Andreas Dausenau edited this page Apr 13, 2022 · 4 revisions

ezcontact - generator

This generator ejects all files needed to edit the contact from the engine to your application.

rails generate ez_on_rails:ezcontact

The following steps are executed by the generator

1. Copy the controller

  • The controller holding the action to show the imprint is located in app/controllers/contact_form_controller.rb

2. Copy the model

  • The model holding the data of the form is located in app/models/contact_form.rb
  • Since this is an active model, you are able to use many awesome features of the rails models, like validations, without the need to persist it to the database

3. Copy the helper

  • The helper holding the render info of the contact form is located in app/helpers/contact_form_helper.rb
  • Have a look at the render info concept page to see the configuration pssibilities

4. Copy the mailer

  • The mailer is located in app/mailers/contact_form_mailer.rb

5. Copy the views

  • The view showing the contact form is located in app/views/contact_form
  • The views showing the mails are located in pp/views/contact_form_mailer/
    • There are mails for the admins to get the message and mails for the user to get an confirmation that the message was send
    • All messages are available in text and html format
    • All messages are available in the languages that are already used by i18n in your application

6. Copy the specs

  • The specs to test the contact form are located in spec/requests/contact_form_spec.rb

7. Copy the locales

  • The i18n locale files are located in config/locales/contact_form.en.ym and config/locales/contact_form.de.ym