various gpx rails things

This commit is contained in:
Steve Coast 2006-12-06 17:55:22 +00:00
parent a7e3b58b41
commit 6559db51df
4 changed files with 24 additions and 16 deletions

View file

@ -47,5 +47,4 @@ class TraceController < ApplicationController
trace = Trace.find(params[:id])
send_data(trace.icon_picture, :filename => "#{trace.id}.gif", :type => 'image/gif', :disposition => 'inline') if trace.public
end
end

View file

@ -2,7 +2,7 @@ class Trace < ActiveRecord::Base
set_table_name 'gpx_files'
belongs_to :user
has_many :tags, :class_name => 'Tracetag', :foreign_key => 'gpx_id'
has_many :tags, :class_name => 'Tracetag', :foreign_key => 'gpx_id', :dependent => :destroy
def tagstring=(s)
self.tags = s.split().collect {|tag|

View file

@ -1,15 +1,13 @@
trace <%= @trace.name %>
<br>
icon <img src="<%= url_for :controller => 'trace', :action => 'icon', :id => @trace.id, :user_login => @trace.user.display_name %>" border="0">
<br>
picture <img src="<%= url_for :controller => 'trace', :action => 'picture', :id => @trace.id, :user_login => @trace.user.display_name %>" border="0">
<br>
time <%= @trace.timestamp %>
<br>
dec <%= @trace.description %>
<h2>Viewing trace <%= @trace.name %></h2>
<img src="<%= url_for :controller => 'trace', :action => 'picture', :id => @trace.id, :user_login => @trace.user.display_name %>">
<table border="0">
<tr><td>filename:</td><td><%= @trace.name %></td></tr>
<tr><td>uploaded at:</td><td><%= @trace.timestamp %></td></tr>
<tr><td>points:</td><td><%= @trace.size %></td></tr>
<tr><td>start coordinate:</td><td><%= @trace.latitude %>, <%= @trace.longitude %></td></tr>
<tr><td>owner:</td><td><%= link_to @trace.user.display_name, {:controller => 'trace', :action => 'by_user'} %></td></tr>
<tr><td>description:</td><td><%= @trace.description %></td></tr>
<tr><td>tags:</td><td><%= @trace.tags.collect {|tag| tag.tag} %></td></tr>
</table>