Removed hard coded links from mailer and views.

* Not tested every mail template. Hopefully everything works ;-)
This commit is contained in:
Benjamin Meichsner 2010-03-20 14:49:46 +01:00
parent 2c1952d625
commit f49c6493f4
9 changed files with 25 additions and 11 deletions

View File

@ -12,9 +12,9 @@ class Mailer < ActionMailer::Base
body :body => message.body,
:sender => message.sender.nick,
:recipients => recipient.nick,
:reply => "#{Foodsoft.config[:base_url]}/messages/reply/#{message.id}",
:link => "#{Foodsoft.config[:base_url]}/messages/show/#{message.id}",
:profile => "#{Foodsoft.config[:base_url]}/home/profile"
:reply => url_for(:controller => "messages", :action => "reply", :id => message.id),
:link => url_for(:controller => "messages", :action => "show", :id => message.id),
:profile => url_for(:controller => "home", :action => "profile")
end
# Sends an email with instructions on how to reset the password.
@ -23,7 +23,7 @@ class Mailer < ActionMailer::Base
prepare_system_message(user)
subject "[#{Foodsoft.config[:name]}] Neues Passwort für/ New password for #{user.nick}"
body :user => user,
:link => "#{Foodsoft.config[:base_url]}/login/password/#{user.id}?token=#{user.reset_password_token}"
:link => url_for(:controller => "login", :action => "password", :id => user.id, :token => user.reset_password_token)
end
# Sends an invite email.
@ -31,7 +31,7 @@ class Mailer < ActionMailer::Base
prepare_system_message(invite)
subject "Einladung in die Foodcoop #{Foodsoft.config[:name]} - Invitation to the Foodcoop"
body :invite => invite,
:link => "#{Foodsoft.config[:base_url]}/login/invite/#{invite.token}"
:link => url_for(:controller => "login", :action => "invite", :id => invite.token)
end
# Notify user of upcoming task.
@ -71,7 +71,7 @@ class Mailer < ActionMailer::Base
prepare_system_message(user)
subject "[#{Foodsoft.config[:name]}] #{task.name} braucht noch Leute!"
body :task => task, :user => user,
:task_url => File.join(Foodsoft.config[:base_url], "tasks/workgroup", task.workgroup_id.to_s)
:task_url => url_for(:controller => "tasks", :action => "workgroup", :id => task.workgroup_id)
end
protected

View File

@ -15,4 +15,4 @@
= text_field 'login', 'email'
= submit_tag 'Neues Passwort anfordern'
|
= link_to 'Abbrechen', :action => 'login'
= link_to 'Abbrechen', login_path

View File

@ -13,4 +13,4 @@
= form.password_field :password_confirmation
= form.submit 'Speichern'
|
= link_to 'Abbrechen', :action => 'login'
= link_to 'Abbrechen', login_path

View File

@ -7,5 +7,5 @@ Sofern Du Dich noch nicht für diese Aufgabe eingetragen hast ist das jetzt die
<%= @task_url %>
--
Deine Aufgaben: <%= Foodsoft.config[:base_url] %>/home/tasks
Deine Aufgaben: <%= url_for(:controller => "home", :actions => "user") %>

View File

@ -9,6 +9,6 @@ Für Euch wurden die folgenden Artikel bestellt:
<% end -%>
Gesamtpreis: <%= @group_order.price %>
Bestellung online einsehen: <%= "#{Foodsoft.config[:base_url]}/ordering/my_order_result/#{@order.id}" %>
Bestellung online einsehen: <%= url_for(:controller => "ordering", :action => "my_order_result", :id => @order.id) %>
Viele Grüße von <%= Foodsoft.config[:name] %>

View File

@ -11,6 +11,6 @@ Aufgaben für die nächste Woche:
<% end -%>
<% end -%>
Meine Aufgaben: <%= Foodsoft.config[:base_url] %>/home/tasks
Meine Aufgaben: <%= url_for(:controller => "home", :actions => "user") %>
Viele Grüße von <%= Foodsoft.config[:name] %>

View File

@ -5,6 +5,12 @@ development: &defaults
# Don't forget to setup databases for each foodcoop. See also MULTI_COOP_INSTALL
multi_coop_install: false
# http config for this host
# Required for action mailer
protocol: http
host: localhost
port: 3000
# name of this foodcoop
name: FC Test
# foodcoop contact information (used for FAX messages)

View File

@ -17,6 +17,13 @@ end
# Initial load the default config and database from rails environment
Foodsoft.env = RAILS_ENV
# Set action mailer default host for url generating
ActionMailer::Base.default_url_options = {
:host => Foodsoft.config[:host],
:port => Foodsoft.config[:port],
:protocol => Foodsoft.config[:protocol]
}
# Configuration of the exception_notification plugin
# Mailadresses are set in config/foodsoft.yaml
ExceptionNotifier.exception_recipients = Foodsoft.config[:notification]['error_recipients']

View File

@ -7,6 +7,7 @@ ActionController::Routing::Routes.draw do |map|
map.root :controller => 'home', :action => 'index'
# User specific
map.login "/login", :controller => 'login', :action => 'login'
map.logout '/logout', :controller => 'login', :action => 'logout'
map.my_profile '/home/profile', :controller => 'home', :action => 'profile'
map.my_ordergroup '/home/ordergroup', :controller => 'home', :action => 'ordergroup'