split_node_tags: Merge changes in main branch up to r7649.

This commit is contained in:
Gabriel Ebner 2008-05-04 08:31:39 +00:00
commit 4424cd5b94
7 changed files with 39 additions and 22 deletions

View file

@ -34,8 +34,10 @@ class MessageController < ApplicationController
def reply
message = Message.find(params[:message_id], :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id ])
title = message.title.sub(/^Re:\s*/, "Re: ")
redirect_to :action => 'new', :user_id => message.from_user_id, :title => title
@body = "\n\nOn #{message.sent_on} #{message.sender.display_name} wrote:\n #{message.body}"
@title = "Re: #{message.title}"
@user_id = message.from_user_id
render :action => 'new'
rescue ActiveRecord::RecordNotFound
render :nothing => true, :status => :not_found
end

View file

@ -83,6 +83,13 @@ class TraceController < ApplicationController
def view
@trace = Trace.find(params[:id])
unless @trace
flash[:notice] = "OH NOES! Trace not found!"
redirect_to :controller => 'trace', :action => 'list'
return
end
@title = "Viewing trace #{@trace.name}"
if !@trace.visible?
render :nothing => true, :status => :not_found
@ -90,7 +97,8 @@ class TraceController < ApplicationController
render :nothing => true, :status => :forbidden
end
rescue ActiveRecord::RecordNotFound
render :nothing => true, :status => :not_found
flash[:notice] = "GPX file not found"
redirect_to :controller => 'trace', :action => 'list'
end
def create
@ -107,11 +115,11 @@ class TraceController < ApplicationController
end
else
@trace = Trace.new({:name => "Dummy",
:tagstring => params[:trace][:tagstring],
:description => params[:trace][:description],
:public => params[:trace][:public],
:inserted => false, :user => @user,
:timestamp => Time.now})
:tagstring => params[:trace][:tagstring],
:description => params[:trace][:description],
:public => params[:trace][:public],
:inserted => false, :user => @user,
:timestamp => Time.now})
@trace.valid?
@trace.errors.add(:gpx_file, "can't be blank")
end
@ -196,7 +204,7 @@ class TraceController < ApplicationController
conditions[0] += " AND users.display_name = ?"
conditions << params[:display_name]
end
if params[:tag]
conditions[0] += " AND EXISTS (SELECT * FROM gpx_file_tags AS gft WHERE gft.gpx_id = gpx_files.id AND gft.tag = ?)"
conditions << params[:tag]
@ -286,7 +294,7 @@ class TraceController < ApplicationController
end
end
private
private
def do_create(file, tags, description, public)
name = file.original_filename.gsub(/[^a-zA-Z0-9.]/, '_')
@ -295,7 +303,7 @@ private
File.open(filename, "w") { |f| f.write(file.read) }
@trace = Trace.new({:name => name, :tagstring => tags,
:description => description, :public => public})
:description => description, :public => public})
@trace.inserted = false
@trace.user = @user
@trace.timestamp = Time.now

View file

@ -1,4 +1,4 @@
<% display_name = User.find_by_id(params[:user_id]).display_name %>
<% display_name = User.find_by_id(params[:user_id] || @user_id).display_name %>
<% title = params[:message] ? params[:message][:title] : params[:title] %>
<h2>Send a new message to <%= h(display_name) %></h2>
@ -10,19 +10,19 @@
<%= error_messages_for 'message' %>
<% form_for :message do |f| %>
<% form_for :message, :url => {:user_id => params[:user_id] || @user_id, :action => "new" } do |f| %>
<table>
<tr valign="top">
<th>Subject</th>
<td><%= text_field_tag 'message[title]', title, :size => 60 %></td>
<td><%= text_field_tag 'message[title]', title, :size => 60, :value => @title %></td>
</tr>
<tr valign="top">
<th>Body</th>
<td><%= f.text_area :body, :cols => 80 %></td>
<td><%= f.text_area :body, :cols => 80, :value => @body %></td>
</tr>
<tr>
<th></th>
<td><%= submit_tag 'Send' %></td>
<td><%= submit_tag 'Send', :action => 'new' %></td>
</tr>
</table>
<% end %>

View file

@ -39,7 +39,9 @@
:complete => "endSearch()",
:url => { :controller => :geocoder, :action => :search }) do %>
<%= text_field_tag :query, h(params[:query]) %>
<% end %>
<%= submit_tag 'Go' %></td>
<% end %>
</span>
<p id="search_active">Searching...</p>
</div>

View file

@ -26,7 +26,9 @@
<% if @user.data_public? %>
All your edits are public.
<% else %>
Currently your edits are anonymous and people can't send you messages or see your location. To show what you edited and allow people to contact you through the website, click the button below. <b>You will need to do this if you want to use the online editor</b> (<a href="http://wiki.openstreetmap.org/index.php/Disabling_anonymous_edits">find out why</a>). This action cannot be reversed.
Currently your edits are anonymous and people can't send you messages or see your location. To show what you edited and allow people to contact you through the website, click the button below.
<b>You will need to do this if you want to use the online editor and it is encouraged</b> (<a href="http://wiki.openstreetmap.org/index.php/Disabling_anonymous_edits">find out why</a>).
This action cannot be reversed and all new users are now public by default.
<br /><br />
<%= button_to "Make all my edits public, forever", :action => :go_public %>
<%= button_to "Make all my edits public", :action => :go_public %>
<% end %>

View file

@ -1,7 +1,9 @@
class AddUserPreferenceId < ActiveRecord::Migration
def self.up
remove_primary_key 'user_preferences'
add_column "user_preferences", "id", :bigint, :limit => 64, :null => false
add_primary_key "user_preferences", ["id"]
change_column "user_preferences", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
add_index "user_preferences", ["id"], :name => "user_preferences_id_idx"
end

View file

@ -354,8 +354,9 @@ hides rule from IE5-Mac \*/
padding: 0px;
}
.optionalbox input {
width: 100%;
.optionalbox input[type="text"] {
width: 110px;
}
.search_form {