]> git.openstreetmap.org Git - rails.git/commitdiff
- replaced hardcoded www.openstreetmap.org with environment variable
authorImmanuel Scholz <immanuel.scholz@gmx.de>
Sun, 14 Jan 2007 01:29:52 +0000 (01:29 +0000)
committerImmanuel Scholz <immanuel.scholz@gmx.de>
Sun, 14 Jan 2007 01:29:52 +0000 (01:29 +0000)
- added preferences action to user
- added column preferences to user table

app/controllers/user_controller.rb
app/models/notifier.rb
app/views/notifier/signup_confirm.rhtml
app/views/site/index.rhtml
app/views/trace/list.rhtml
config/environment.rb
db/migrate.sql

index 2b695ce7a83cc1c22d8950a16a1dd85cb8455fe9..eaac774d2350fd6593a3be3a0fd7246025eb6b8e 100644 (file)
@@ -1,5 +1,7 @@
 class UserController < ApplicationController
   layout 'site'
+
+  before_filter :authorize, :only => :preferences
   
   def save
     @user = User.new(params[:user])
@@ -93,4 +95,16 @@ class UserController < ApplicationController
     end
   end
 
+  def preferences
+    if request.get?
+      render_text @user.preferences
+    elsif request.post? or request.put?
+      @user.preferences = request.raw_post
+      @user.save!
+      render :nothing => true
+    else
+      render :status => 400, :nothing => true
+    end
+  end
 end
+
index c165dca96725085e88dd67a0317593a88c521030..b064ee1f0350ff348251668de20a3e80c26fbdf8 100644 (file)
@@ -4,14 +4,14 @@ class Notifier < ActionMailer::Base
     @recipients = user.email
     @from = 'abuse@openstreetmap.org'
     @subject = '[OpenStreetMap] Confirm your email address'
-    @body['url'] = 'http://www.openstreetmap.org/user/confirm?confirm_string=' + user.token
+    @body['url'] = "http://#{SERVER_URL}/user/confirm?confirm_string=#{user.token}"
   end
 
   def lost_password( user )
     @recipients = user.email
     @from = 'abuse@openstreetmap.org'
     @subject = '[OpenStreetMap] Password reset request'
-    @body['url'] = "http://www.openstreetmap.org/user/reset_password?email=#{user.email}&token=#{user.token}"
+    @body['url'] = "http://#{SERVER_URL}/user/reset_password?email=#{user.email}&token=#{user.token}"
   end
 
   def reset_password(user, pass)
index a998f578282a42ef15bab8584fc31089580e1cd1..05fa3f61397e1f0d5a96553a3331092703d10203 100644 (file)
@@ -1,7 +1,7 @@
 Hi,
 
 Somone (hopefully you) would like to create an account over at
-www.openstreetmap.org
+<%= SERVER_URL %>
 
 If this is you, please click the link below to confirm that account.
 
index a7dbd15e3cb972f7b5cdca470a54ce08951e2838..344c43273e052008c06a70bc4392920230e87740 100644 (file)
@@ -36,7 +36,7 @@
         function init(){
 
                        OpenLayers.Util.onImageLoadError = function() {
-                               this.src = "http://www.openstreetmap.org/javascript/img/404.png";
+                               this.src = "http://<%= SERVER_URL %>/javascript/img/404.png";
                        }
             map = new OpenLayers.Map( "map", 
                                {maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), maxResolution:156543, units:'meters', projection: "EPSG:41001"} );
index dc3861a5433d535250d310cd89ce972e000cc296..dce98136f0403109efde8e20d95c1f17a1189ce6 100644 (file)
@@ -2,7 +2,7 @@
 
 <br /><br />
 
-<span class="rsssmall"><a href="<%= url_for :controller => 'trace', :action => 'georss' %>"><img src="http://www.openstreetmap.org/images/RSS.gif" border="0"></a></span> | 
+<span class="rsssmall"><a href="<%= url_for :controller => 'trace', :action => 'georss' %>"><img src="http://<%= SERVER_URL %>/images/RSS.gif" border="0"></a></span> | 
 <% if @user %>
   <%= link_to 'See just your traces', {:controller => 'trace', :action => 'mine'} %>
 <% else %>
index 76f1669a2d26d045afd6d1c6cae8b4763f8fdf49..a26cb54420075233e0347d621960320ecc5a6c98 100644 (file)
@@ -52,7 +52,8 @@ end
 
 # Include your application configuration below
 
-API_VERSION = '0.4'
+API_VERSION = ENV['OSM_API_VERSION'] || '0.4'
+SERVER_URL = ENV['OSM_SERVER_URL'] || 'www.openstreetmap.org'
 
 ActionMailer::Base.server_settings = {
   :address  => "localhost",
index 92ae6b1711a23f393e48940fd0d7e1948c886601..bced117902c99baa661069f963662a4fe0610db5 100644 (file)
@@ -24,3 +24,4 @@ alter table gpx_file_tags drop column sequence_id;
 create index gpx_file_tags_gpxid_idx on gpx_file_tags(gpx_id);
 alter table gpx_file_tags add id int(20) auto_increment not null, add primary key(id);
 
+alter table users add preferences text;