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 def reply
message = Message.find(params[:message_id], :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id ]) 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: ") @body = "\n\nOn #{message.sent_on} #{message.sender.display_name} wrote:\n #{message.body}"
redirect_to :action => 'new', :user_id => message.from_user_id, :title => title @title = "Re: #{message.title}"
@user_id = message.from_user_id
render :action => 'new'
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render :nothing => true, :status => :not_found render :nothing => true, :status => :not_found
end end

View file

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

View file

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

View file

@ -26,7 +26,9 @@
<% if @user.data_public? %> <% if @user.data_public? %>
All your edits are public. All your edits are public.
<% else %> <% 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 /> <br /><br />
<%= button_to "Make all my edits public, forever", :action => :go_public %> <%= button_to "Make all my edits public", :action => :go_public %>
<% end %> <% end %>

View file

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

View file

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