diff --git a/app/views/sites/_form.html.erb b/app/views/sites/_form.html.erb index f1fd754..379502d 100644 --- a/app/views/sites/_form.html.erb +++ b/app/views/sites/_form.html.erb @@ -11,6 +11,31 @@ <% end %> + + + +
<%= f.label :name %>
<%= f.text_field :name %> @@ -27,6 +52,18 @@ <%= f.label :image %>
<%= f.file_field :image %>
+
+ <%= f.label :lat %>
+ <%= f.text_area :lat , :rows => 1 %> +
+
+ <%= f.label :long %>
+ <%= f.text_area :long , :rows => 1 %> +
+
+ <%= f.label :zoom %>
+ <%= f.text_area :zoom , :rows => 1 %> +
<%= f.submit %>
diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index b8e4cae..e45b2e7 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -14,6 +14,7 @@
<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
+

Incluido en <%= site.visits.count %> visitas

@@ -31,4 +32,4 @@
-<%= link_to 'New site', new_site_path %> \ No newline at end of file +<%= link_to 'New site', new_site_path %> diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 01a5417..6e27fde 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -1,19 +1,53 @@ + +

<%= @site.type.name if @site.type %>

<%= image_tag(@site.image.url, :class => 'site_image') %> +
+

<%= @site.name %>

<%=sanitize @site.description %>

Autor: <%= @site.user.name if @site.user %>

+ +

Incluido en <%= @site.visits.count %> visitas

Visitas: <%= @site.visitas %>
+ + + +

<% if @site.user == current_user %> <%= link_to 'Edit', edit_site_path(@site) %> | <% end %> <%= link_to 'Back', sites_path %> diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb index 2d69c99..ca6cd9d 100644 --- a/app/views/trips/_trip.html.erb +++ b/app/views/trips/_trip.html.erb @@ -1,4 +1,9 @@ + +

+
<% trip.visits.order(:hour).each do |visit| %> @@ -25,5 +30,42 @@ <% end %>
+
+ + + + diff --git a/db/migrate/20120421132559_localizacion_sitios.rb b/db/migrate/20120421132559_localizacion_sitios.rb new file mode 100644 index 0000000..0e14235 --- /dev/null +++ b/db/migrate/20120421132559_localizacion_sitios.rb @@ -0,0 +1,17 @@ +class LocalizacionSitios < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :lat, :integer + t.column :long, :integer + t.column :zoom, :integer + end + end + + def down + change_table :sites do |t| + t.column :lat, :integer + t.column :long, :integer + t.column :zoom, :integer + end + end +end diff --git a/db/migrate/20120421170806_sitios_lat_float.rb b/db/migrate/20120421170806_sitios_lat_float.rb new file mode 100644 index 0000000..0f18f75 --- /dev/null +++ b/db/migrate/20120421170806_sitios_lat_float.rb @@ -0,0 +1,10 @@ +class SitiosLatFloat < ActiveRecord::Migration + def up + change_column :sites, :lat, :float + change_column :sites, :long, :float + change_column :sites, :zoom, :float + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index e6aa66f..de42b4b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,15 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120411160519) do +ActiveRecord::Schema.define(:version => 20120421170806) do + + create_table "comments", :force => true do |t| + t.string "comment" + t.integer "user_id" + t.integer "site_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end create_table "sites", :force => true do |t| t.string "name" @@ -26,6 +34,9 @@ t.string "image_file_size" t.datetime "image_updated_at" t.integer "visitas", :default => 0 + t.float "lat" + t.float "long" + t.float "zoom" end create_table "trips", :force => true do |t|