server email address and letter opener gem for development emails

jamesperet 9 years ago
parent
commit
fb75685b72

+ 1 - 1
app/controllers/admin_panel_controller.rb

@@ -74,7 +74,7 @@ class AdminPanelController < ApplicationController
74 74
 
75 75
     # Never trust parameters from the scary internet, only allow the white list through.
76 76
     def info_params
77
-      params.require(:info).permit(:website_name, :website_link, :tagline, :contact_email, :default_language, :maintenance_mode, :maintenance_title, :maintenance_message)
77
+      params.require(:info).permit(:website_name, :website_link, :tagline, :contact_email, :server_email, :default_language, :maintenance_mode, :maintenance_title, :maintenance_message)
78 78
     end
79 79
   
80 80
     def authenticate_user 

+ 1 - 0
app/views/admin_panel/site_config.html.erb

@@ -15,6 +15,7 @@
15 15
 			    <%= f.text_field :website_link, :label => (t 'admin_panel.website_link'), class:'input-xlarge' %>
16 16
 			    <%= f.select :default_language, ["en", "pt-BR"],  :label => (t 'admin_panel.default_language'), help: ("<i>* "+(t "admin_panel.language_hint")+"</i>").html_safe %>
17 17
 			    <%= f.email_field :contact_email, :label => (t 'admin_panel.contact_email'), class:'input-xlarge' %>
18
+			    <%= f.email_field :server_email, :label => (t 'admin_panel.server_email'), class:'input-xlarge' %>
18 19
 			    <hr>
19 20
 			    <%= f.form_group :maintenance_mode, class: 'bootstrap_switch_group' do %>
20 21
 			    		<%= f.check_box :maintenance_mode, :label => (t 'admin_panel.maintenance_mode'), class: 'bootstrap_switch',

+ 11 - 11
config/environments/development.rb

@@ -30,17 +30,17 @@ RailsWebsiteTemplate::Application.configure do
30 30
   config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
31 31
   config.action_mailer.raise_delivery_errors = true
32 32
   
33
-  #config.action_mailer.delivery_method = :letter_opener
34
-  config.action_mailer.delivery_method = :smtp
33
+  config.action_mailer.delivery_method = :letter_opener
34
+  #config.action_mailer.delivery_method = :smtp
35 35
   
36
-  config.action_mailer.smtp_settings = {
37
-      :address   => "smtp.mandrillapp.com",
38
-      :port      => 587, # ports 587 and 2525 are also supported with STARTTLS
39
-      :enable_starttls_auto => true, # detects and uses STARTTLS
40
-      :user_name => "james.peret@gmail.com",
41
-      :password  => "UZIxm2vCtBr66yWRpC_Big", # SMTP password is any valid API key
42
-      :authentication => 'login', # Mandrill supports 'plain' or 'login'
43
-      :domain => 'rails_website_template.dev', # your domain to identify your server when connecting
44
-    }
36
+  # config.action_mailer.smtp_settings = {
37
+  #       :address   => "smtp.mandrillapp.com",
38
+  #       :port      => 587, # ports 587 and 2525 are also supported with STARTTLS
39
+  #       :enable_starttls_auto => true, # detects and uses STARTTLS
40
+  #       :user_name => "james.peret@gmail.com",
41
+  #       :password  => "UZIxm2vCtBr66yWRpC_Big", # SMTP password is any valid API key
42
+  #       :authentication => 'login', # Mandrill supports 'plain' or 'login'
43
+  #       :domain => 'rails_website_template.dev', # your domain to identify your server when connecting
44
+  #   }
45 45
   
46 46
 end

+ 1 - 1
config/initializers/devise.rb

@@ -10,7 +10,7 @@ Devise.setup do |config|
10 10
   # Configure the e-mail address which will be shown in Devise::Mailer,
11 11
   # note that it will be overwritten if you use your own mailer class
12 12
   # with default "from" parameter.
13
-  config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
13
+  config.mailer_sender = Info.first.server_email != nil ? Info.first.server_email : 'no-reply@website.com'
14 14
 
15 15
   # Configure the class responsible to send e-mails.
16 16
   # config.mailer = 'Devise::Mailer'

+ 1 - 0
config/locales/en.yml

@@ -220,6 +220,7 @@ en:
220 220
     default_language: Default Language
221 221
     update_config_btn: Update Config
222 222
     contact_email: Contact Email
223
+    server_email: Server Email
223 224
     config_update_success: Configurations saved successfully
224 225
     contact_messages: Contact Messages
225 226
     new: New

+ 1 - 0
config/locales/pt-BR.yml

@@ -223,6 +223,7 @@ pt-BR:
223 223
     default_language: Lingua padrão
224 224
     update_config_btn: Salvar Configurações
225 225
     contact_email: Email de contato
226
+    server_email: Email do servidor
226 227
     contact_messages: Mensagens de Contato
227 228
     new: Nova
228 229
     messages: Mensagens

+ 1 - 0
db/migrate/20141101234157_add_link_to_infos.rb

@@ -1,5 +1,6 @@
1 1
 class AddLinkToInfos < ActiveRecord::Migration
2 2
   def change
3 3
     add_column :infos, :website_link, :string
4
+    add_column :infos, :server_email, :string
4 5
   end
5 6
 end

+ 1 - 0
db/schema.rb

@@ -68,6 +68,7 @@ ActiveRecord::Schema.define(version: 20141101234157) do
68 68
     t.string   "maintenance_title"
69 69
     t.text     "maintenance_message"
70 70
     t.string   "website_link"
71
+    t.string   "server_email"
71 72
   end
72 73
 
73 74
   create_table "uploads", force: true do |t|