From c3703e472856754e36f856fda214f4355e652828 Mon Sep 17 00:00:00 2001 From: Merlin Date: Tue, 10 Apr 2012 11:33:48 +0200 Subject: [PATCH 01/15] Inicializado correctamente desde ging --- db/schema.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 9eb10c3..55d9fcf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120409085740) do +ActiveRecord::Schema.define(:version => 20120409143117) do create_table "sites", :force => true do |t| t.string "name" @@ -58,4 +58,12 @@ add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + create_table "visits", :force => true do |t| + t.integer "trip_id" + t.integer "site_id" + t.integer "hour" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + end From c89b83b69eb253cd040de3f6a81518a54fbdb864 Mon Sep 17 00:00:00 2001 From: Merlin Date: Tue, 10 Apr 2012 15:33:15 +0200 Subject: [PATCH 02/15] Generado autor y enlaces inferiores --- app/assets/stylesheets/planet.css | 11 ++ app/assets/stylesheets/planet.css~ | 173 ++++++++++++++++++++++++ app/views/layouts/application.html.erb | 31 ++++- app/views/layouts/application.html.erb~ | 56 ++++++++ app/views/planet/autor.html.erb | 8 ++ app/views/planet/autor.html.erb~ | 6 + app/views/sites/index.html.erb | 10 +- app/views/sites/index.html.erb~ | 34 +++++ config/routes.rb | 2 + config/routes.rb~ | 79 +++++++++++ 10 files changed, 401 insertions(+), 9 deletions(-) create mode 100644 app/assets/stylesheets/planet.css~ create mode 100644 app/views/layouts/application.html.erb~ create mode 100644 app/views/planet/autor.html.erb create mode 100644 app/views/planet/autor.html.erb~ create mode 100644 app/views/sites/index.html.erb~ create mode 100644 config/routes.rb~ diff --git a/app/assets/stylesheets/planet.css b/app/assets/stylesheets/planet.css index c6334b0..4b7f07e 100644 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -97,6 +97,7 @@ margin-left: 9em; /* Ajuste de borde izquierdo */ padding-top: 4ex; padding-left: 2em; + padding-bottom: 1em; background: white; } @@ -113,6 +114,16 @@ color: #bfb; font-size: small; } + +#bottom { + padding: 1em; + text-align: center; +} + +#bottom a { + color: #bfb; + font-size: small; +} /* END:mainlayout */ /* An entry in the store catalog (no utilizados de momento) */ diff --git a/app/assets/stylesheets/planet.css~ b/app/assets/stylesheets/planet.css~ new file mode 100644 index 0000000..c431836 --- /dev/null +++ b/app/assets/stylesheets/planet.css~ @@ -0,0 +1,173 @@ +/* Global styles (no utilizados de momento) */ + +#planet #notice { + color: #000; + border: 2px solid red; + padding: 1em; + margin-bottom: 2em; + background-color: #f0f0f0; + font: bold smaller sans-serif; +} + + +#planet h1 { + font: 150% sans-serif; + color: #226; + border-bottom: 3px dotted #77d; +} + +/* Styles for products/index */ + +#site_list table { + border-collapse: collapse; +} + +#site_list table tr td { + padding: 5px; + vertical-align: top; +} + +#site_list .list_image { + width: 60px; + height: 70px; +} + +#site_list .list_description { + width: 60%; +} + +#site_list .list_description dl { + margin: 0; +} + +#site_list .list_description dt { + color: #244; + font-weight: bold; + font-size: larger; +} + +#site_list .list_description dd { + margin: 0; +} + +#site_list .list_actions { + font-size: x-small; + text-align: right; + padding-left: 1em; +} + +#site_list .list_line_even { + background: #a8b8f8; +} + +#site_list .list_line_odd { + background: #88b0f8; +} + + +/* START:mainlayout */ +/* Styles for main page */ + +#banner { + background: #668; + padding-top: 10px; + padding-bottom: 10px; + border-bottom: 2px solid; + font: small-caps 40px/40px "Times New Roman", serif; + color: #bfb; + text-align: center; +} + +#banner img { + float: left; + padding-left: 10px; +} + +#banner .user { + float: right; + color: #bfb; + font-size: small; +} + +#columns { + background: #446; +} + +#main { + margin-left: 9em; /* Ajuste de borde izquierdo */ + padding-top: 4ex; + padding-left: 2em; + padding-bottom: 1em; + background: white; +} + +#side { + float: left; + padding-top: 1em; + padding-left: 1em; + padding-bottom: 1em; + width: 8em; /* Ajuste de borde izquierdo */ + background: #446; +} + +#side a { + color: #bfb; + font-size: small; +} + +#bottom { + text-align: center; +} + +#bottom a { + color: #bfb; + font-size: small; +} +/* END:mainlayout */ + +/* An entry in the store catalog (no utilizados de momento) */ + +#planet .entry { + overflow: auto; + margin-top: 1em; + border-bottom: 1px dotted #77d; +} + +#planet .name { + font-size: 120%; + font-family: sans-serif; +} + +#store .entry img { + width: 80px; + margin-right: 5px; + margin-bottom: 5px; + float: left; +} + + +#store .entry h3 { + margin-top: 0; + margin-bottom: 2px; + color: #227; +} + +#store .entry p { + margin-top: 0.5em; + margin-bottom: 0.8em; +} + +#store .entry .price_line { + clear: both; + margin-bottom: 0.5em; +} + +#store .entry .add_to_cart { + position: relative; +} + +#store .entry .price { + color: #44a; + font-weight: bold; + margin-right: 2em; +} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 82edd70..368a880 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,7 +6,11 @@ <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> - + @@ -14,7 +18,14 @@ - \ No newline at end of file + diff --git a/app/views/layouts/application.html.erb~ b/app/views/layouts/application.html.erb~ new file mode 100644 index 0000000..c58b351 --- /dev/null +++ b/app/views/layouts/application.html.erb~ @@ -0,0 +1,56 @@ + + + + Planet + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + + + + + +
+
+ <%= link_to "Home", planet_index_path %>
+ <%= link_to "Tipos", types_path %>
+ <%= link_to "Sitios", sites_path %>
+ <%= link_to "Viajes", trips_path %>
+ <%= link_to "Autor", planet_autor_path %>
+ <%= link_to "Contact", planet_contact_path %>
+ <%= link_to "Sign up", new_user_registration_path if !current_user %> +
+
+

<%= notice %>

<%= alert %>

+ <%= yield %> +
+
+ <%= link_to "Home", planet_index_path %>
| + <%= link_to "Tipos", types_path %> | + <%= link_to "Sitios", sites_path %>
| + <%= link_to "Viajes", trips_path %>
| + <%= link_to "Autor", planet_autor_path %>
| + <%= link_to "Contact", planet_contact_path %>
| + <%= link_to "Sign up", new_user_registration_path if !current_user %> +
+
+ + diff --git a/app/views/planet/autor.html.erb b/app/views/planet/autor.html.erb new file mode 100644 index 0000000..e52f8a3 --- /dev/null +++ b/app/views/planet/autor.html.erb @@ -0,0 +1,8 @@ +

Autor

+

+

+

diff --git a/app/views/planet/autor.html.erb~ b/app/views/planet/autor.html.erb~ new file mode 100644 index 0000000..386265a --- /dev/null +++ b/app/views/planet/autor.html.erb~ @@ -0,0 +1,6 @@ +

Autor

+

+

+

diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index df94078..469710d 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -18,12 +18,14 @@ - <%= link_to 'Show', site %>
- <% if site.user == current_user %> <%= link_to 'Edit', edit_site_path(site) %>
+ + <% if site.user == current_user %> + <%= link_to 'Edit', edit_site_path(site) %>
<%= link_to 'Destroy', site, :confirm => 'Are you sure?', :method => :delete %> - <% end %> + <% end %> + <% end %> @@ -31,4 +33,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/index.html.erb~ b/app/views/sites/index.html.erb~ new file mode 100644 index 0000000..df94078 --- /dev/null +++ b/app/views/sites/index.html.erb~ @@ -0,0 +1,34 @@ +
+

Listing Sites

+ + + <% @sites.each do |site| %> + + + + + + + + + <% end %> +
+ <%= link_to image_tag(site.image_url, :class => 'list_image'), site %> + +
+
<%= link_to site.name, site %>
+
<%= truncate(strip_tags(site.description), + :length => 80) %>
+
+
+ <%= link_to 'Show', site %>
+ <% if site.user == current_user %> <%= link_to 'Edit', edit_site_path(site) %>
+ <%= link_to 'Destroy', site, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %>
+
+ +
+ +<%= link_to 'New site', new_site_path %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 29d3c86..9327e96 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,6 +18,8 @@ get "planet/ejemplo" + get "planet/autor" + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/config/routes.rb~ b/config/routes.rb~ new file mode 100644 index 0000000..29d3c86 --- /dev/null +++ b/config/routes.rb~ @@ -0,0 +1,79 @@ +Planet::Application.routes.draw do + + resources :visits + + resources :trips + + devise_for :users + + resources :sites + + resources :types do # Rutas anidadas /types/id/sites..., + resources :sites, :only => [ :index ] # Restringe a acción “index” + end + + get "planet/index" + + get "planet/contact" + + get "planet/ejemplo" + + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + # root :to => 'welcome#index' + + root :to => "planet#index" + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id(.:format)))' +end From 8822270c2bedd6deb02124f889374add21f4721b Mon Sep 17 00:00:00 2001 From: Merlin Date: Wed, 11 Apr 2012 03:20:32 +0200 Subject: [PATCH 03/15] Creado Comentarios y enlazado a falta de mostrar en Sites --- app/assets/javascripts/comentarios.js.coffee | 3 + app/assets/stylesheets/comentarios.css.scss | 3 + app/controllers/comentarios_controller.rb | 181 ++++++++++++++++++ app/controllers/comentarios_controller.rb~ | 181 ++++++++++++++++++ app/helpers/comentarios_helper.rb | 2 + app/models/comentario.rb | 6 + app/models/comentario.rb~ | 4 + app/models/site.rb | 1 + app/models/site.rb~ | 13 ++ app/models/user.rb | 1 + app/models/user.rb~ | 16 ++ app/views/comentarios/_form.html.erb | 30 +++ app/views/comentarios/_form.html.erb~ | 30 +++ app/views/comentarios/edit.html.erb | 6 + app/views/comentarios/index.html.erb | 41 ++++ app/views/comentarios/index.html.erb~ | 41 ++++ app/views/comentarios/new.html.erb | 5 + app/views/comentarios/show.html.erb | 23 +++ app/views/comentarios/show.html.erb~ | 25 +++ app/views/layouts/application.html.erb | 2 + app/views/layouts/application.html.erb~ | 12 +- config/routes.rb | 2 + .../20120410235356_create_comentarios.rb | 11 ++ db/schema.rb | 10 +- test/fixtures/comentarios.yml | 11 ++ .../functional/comentarios_controller_test.rb | 49 +++++ test/unit/comentario_test.rb | 7 + test/unit/helpers/comentarios_helper_test.rb | 4 + 28 files changed, 714 insertions(+), 6 deletions(-) create mode 100644 app/assets/javascripts/comentarios.js.coffee create mode 100644 app/assets/stylesheets/comentarios.css.scss create mode 100644 app/controllers/comentarios_controller.rb create mode 100644 app/controllers/comentarios_controller.rb~ create mode 100644 app/helpers/comentarios_helper.rb create mode 100644 app/models/comentario.rb create mode 100644 app/models/comentario.rb~ create mode 100644 app/models/site.rb~ create mode 100644 app/models/user.rb~ create mode 100644 app/views/comentarios/_form.html.erb create mode 100644 app/views/comentarios/_form.html.erb~ create mode 100644 app/views/comentarios/edit.html.erb create mode 100644 app/views/comentarios/index.html.erb create mode 100644 app/views/comentarios/index.html.erb~ create mode 100644 app/views/comentarios/new.html.erb create mode 100644 app/views/comentarios/show.html.erb create mode 100644 app/views/comentarios/show.html.erb~ create mode 100644 db/migrate/20120410235356_create_comentarios.rb create mode 100644 test/fixtures/comentarios.yml create mode 100644 test/functional/comentarios_controller_test.rb create mode 100644 test/unit/comentario_test.rb create mode 100644 test/unit/helpers/comentarios_helper_test.rb diff --git a/app/assets/javascripts/comentarios.js.coffee b/app/assets/javascripts/comentarios.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/comentarios.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/comentarios.css.scss b/app/assets/stylesheets/comentarios.css.scss new file mode 100644 index 0000000..494c101 --- /dev/null +++ b/app/assets/stylesheets/comentarios.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the comentarios controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/comentarios_controller.rb b/app/controllers/comentarios_controller.rb new file mode 100644 index 0000000..8282b9f --- /dev/null +++ b/app/controllers/comentarios_controller.rb @@ -0,0 +1,181 @@ +class ComentariosController < ApplicationController + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] + + # GET /comentarios + # GET /comentarios.json + def index + if params[:site_id].nil? or params[:site_id].empty? + @comentarios = Comentario.all # path: /sites + else + @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios + end + respond_to do |format| + format.html # index.html.erb + format.json { render json: @comentarios } + end + end + + # GET /comentarios/1 + # GET /comentarios/1.json + def show + @comentario = Comentario.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comentario } + end + end + + # GET /comentarios/new + # GET /comentarios/new.json + def new + @comentario = current_user.comentarios.build # crea sitio vacio asociado a current_user + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @comentario } + end + end + + # GET /comentarios/1/edit + def edit + @comentario = current_user.comentarios.find(params[:id]) # busca solo en sitios asociados a current_user + end + + # POST /comentarios + # POST /comentarios.json + def create + @comentario = current_user.comentarios.build(params[:comentario]) # Asigna solo si sitio asociado a current_user + + respond_to do |format| + if @comentario.save + format.html { redirect_to @comentario, notice: 'Comentario was successfully created.' } + format.json { render json: @comentario, status: :created, location: @comentario } + else + format.html { render action: "new" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # PUT /comentarios/1 + # PUT /comentarios/1.json + def update + @comentario = current_user.comentarios.find(params[:id]) # busca solo en sitios asociados a current_user + + respond_to do |format| + if @comentario.update_attributes(params[:comentario]) + format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comentarios/1 + # DELETE /comentarios/1.json + def destroy + @comentario = current_user.comentarios.find(params[:id]) # busca solo en sitios asociados a current_user + @comentario.destroy + + respond_to do |format| + format.html { redirect_to comentarios_url } + format.json { head :no_content } + end + end +end + + +#class ComentariosController < ApplicationController +# +# # authenticate_user! ejecuta acción solo si sesión existe +# before_filter :authenticate_user!, :except => [ :index, :show ] +# +# # GET /comentarios +# # GET /comentarios.json +# def index +# @comentarios = Comentario.all +# +# respond_to do |format| +# format.html # index.html.erb +# format.json { render json: @comentarios } +# end +# end +# +# # GET /comentarios/1 +# # GET /comentarios/1.json +# def show +# @comentario = Comentario.find(params[:id]) +# +# respond_to do |format| +# format.html # show.html.erb +# format.json { render json: @comentario } +# end +# end +# +# # GET /comentarios/new +# # GET /comentarios/new.json +# def new +# @comentario = Comentario.new +# +# respond_to do |format| +# format.html # new.html.erb +# format.json { render json: @comentario } +# end +# end +# +# # GET /comentarios/1/edit +# def edit +# @comentario = Comentario.find(params[:id]) +# end +# +# # POST /comentarios +# # POST /comentarios.json +# def create +# @comentario = Comentario.new(params[:comentario]) +# +# respond_to do |format| +# if @comentario.save +# format.html { redirect_to @comentario, notice: 'Comentario was successfully #created.' } +# format.json { render json: @comentario, status: :created, location: @comentario } +# else +# format.html { render action: "new" } +# format.json { render json: @comentario.errors, status: :unprocessable_entity } +# end +# end +# end +# +# # PUT /comentarios/1 +# # PUT /comentarios/1.json +# def update +# @comentario = Comentario.find(params[:id]) +# +# respond_to do |format| +# if @comentario.update_attributes(params[:comentario]) +# format.html { redirect_to @comentario, notice: 'Comentario was successfully #updated.' } +# format.json { head :no_content } +# else +# format.html { render action: "edit" } +# format.json { render json: @comentario.errors, status: :unprocessable_entity } +# end +# end +# end +# +# # DELETE /comentarios/1 +# # DELETE /comentarios/1.json +# def destroy +# @comentario = Comentario.find(params[:id]) +# @comentario.destroy +# +# respond_to do |format| +# format.html { redirect_to comentarios_url } +# format.json { head :no_content } +# end +# end +#end + + diff --git a/app/controllers/comentarios_controller.rb~ b/app/controllers/comentarios_controller.rb~ new file mode 100644 index 0000000..8282b9f --- /dev/null +++ b/app/controllers/comentarios_controller.rb~ @@ -0,0 +1,181 @@ +class ComentariosController < ApplicationController + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] + + # GET /comentarios + # GET /comentarios.json + def index + if params[:site_id].nil? or params[:site_id].empty? + @comentarios = Comentario.all # path: /sites + else + @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios + end + respond_to do |format| + format.html # index.html.erb + format.json { render json: @comentarios } + end + end + + # GET /comentarios/1 + # GET /comentarios/1.json + def show + @comentario = Comentario.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comentario } + end + end + + # GET /comentarios/new + # GET /comentarios/new.json + def new + @comentario = current_user.comentarios.build # crea sitio vacio asociado a current_user + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @comentario } + end + end + + # GET /comentarios/1/edit + def edit + @comentario = current_user.comentarios.find(params[:id]) # busca solo en sitios asociados a current_user + end + + # POST /comentarios + # POST /comentarios.json + def create + @comentario = current_user.comentarios.build(params[:comentario]) # Asigna solo si sitio asociado a current_user + + respond_to do |format| + if @comentario.save + format.html { redirect_to @comentario, notice: 'Comentario was successfully created.' } + format.json { render json: @comentario, status: :created, location: @comentario } + else + format.html { render action: "new" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # PUT /comentarios/1 + # PUT /comentarios/1.json + def update + @comentario = current_user.comentarios.find(params[:id]) # busca solo en sitios asociados a current_user + + respond_to do |format| + if @comentario.update_attributes(params[:comentario]) + format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comentarios/1 + # DELETE /comentarios/1.json + def destroy + @comentario = current_user.comentarios.find(params[:id]) # busca solo en sitios asociados a current_user + @comentario.destroy + + respond_to do |format| + format.html { redirect_to comentarios_url } + format.json { head :no_content } + end + end +end + + +#class ComentariosController < ApplicationController +# +# # authenticate_user! ejecuta acción solo si sesión existe +# before_filter :authenticate_user!, :except => [ :index, :show ] +# +# # GET /comentarios +# # GET /comentarios.json +# def index +# @comentarios = Comentario.all +# +# respond_to do |format| +# format.html # index.html.erb +# format.json { render json: @comentarios } +# end +# end +# +# # GET /comentarios/1 +# # GET /comentarios/1.json +# def show +# @comentario = Comentario.find(params[:id]) +# +# respond_to do |format| +# format.html # show.html.erb +# format.json { render json: @comentario } +# end +# end +# +# # GET /comentarios/new +# # GET /comentarios/new.json +# def new +# @comentario = Comentario.new +# +# respond_to do |format| +# format.html # new.html.erb +# format.json { render json: @comentario } +# end +# end +# +# # GET /comentarios/1/edit +# def edit +# @comentario = Comentario.find(params[:id]) +# end +# +# # POST /comentarios +# # POST /comentarios.json +# def create +# @comentario = Comentario.new(params[:comentario]) +# +# respond_to do |format| +# if @comentario.save +# format.html { redirect_to @comentario, notice: 'Comentario was successfully #created.' } +# format.json { render json: @comentario, status: :created, location: @comentario } +# else +# format.html { render action: "new" } +# format.json { render json: @comentario.errors, status: :unprocessable_entity } +# end +# end +# end +# +# # PUT /comentarios/1 +# # PUT /comentarios/1.json +# def update +# @comentario = Comentario.find(params[:id]) +# +# respond_to do |format| +# if @comentario.update_attributes(params[:comentario]) +# format.html { redirect_to @comentario, notice: 'Comentario was successfully #updated.' } +# format.json { head :no_content } +# else +# format.html { render action: "edit" } +# format.json { render json: @comentario.errors, status: :unprocessable_entity } +# end +# end +# end +# +# # DELETE /comentarios/1 +# # DELETE /comentarios/1.json +# def destroy +# @comentario = Comentario.find(params[:id]) +# @comentario.destroy +# +# respond_to do |format| +# format.html { redirect_to comentarios_url } +# format.json { head :no_content } +# end +# end +#end + + diff --git a/app/helpers/comentarios_helper.rb b/app/helpers/comentarios_helper.rb new file mode 100644 index 0000000..a8f928b --- /dev/null +++ b/app/helpers/comentarios_helper.rb @@ -0,0 +1,2 @@ +module ComentariosHelper +end diff --git a/app/models/comentario.rb b/app/models/comentario.rb new file mode 100644 index 0000000..471e904 --- /dev/null +++ b/app/models/comentario.rb @@ -0,0 +1,6 @@ +class Comentario < ActiveRecord::Base + belongs_to :site + belongs_to :user + + attr_protected :user_id +end diff --git a/app/models/comentario.rb~ b/app/models/comentario.rb~ new file mode 100644 index 0000000..8b39078 --- /dev/null +++ b/app/models/comentario.rb~ @@ -0,0 +1,4 @@ +class Comentario < ActiveRecord::Base + belongs_to :site + belongs_to :user +end diff --git a/app/models/site.rb b/app/models/site.rb index 7a3bd34..54ca9d0 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -3,6 +3,7 @@ class Site < ActiveRecord::Base belongs_to :user has_many :visits has_many :trips, :through => :visits + has_many :comentarios # Debe estar protegido para evitar accesos indeseados diff --git a/app/models/site.rb~ b/app/models/site.rb~ new file mode 100644 index 0000000..7a3bd34 --- /dev/null +++ b/app/models/site.rb~ @@ -0,0 +1,13 @@ +class Site < ActiveRecord::Base + belongs_to :type + belongs_to :user + has_many :visits + has_many :trips, :through => :visits + + + # Debe estar protegido para evitar accesos indeseados + attr_protected :user_id + + # Se añaden estas definiciones + validates :name, :type_id, :image_url, :presence => true # campo obligatorio +end diff --git a/app/models/user.rb b/app/models/user.rb index 35b8159..9b60370 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,7 @@ class User < ActiveRecord::Base has_many :sites + has_many :comentarios has_many :trips # Include default devise modules. Others available are: diff --git a/app/models/user.rb~ b/app/models/user.rb~ new file mode 100644 index 0000000..9b60370 --- /dev/null +++ b/app/models/user.rb~ @@ -0,0 +1,16 @@ +class User < ActiveRecord::Base + + has_many :sites + has_many :comentarios + has_many :trips + + # Include default devise modules. Others available are: + # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable + + validates_presence_of :name + + # Setup accessible (or protected) attributes for your model + attr_accessible :name, :email, :password, :password_confirmation, :remember_me +end diff --git a/app/views/comentarios/_form.html.erb b/app/views/comentarios/_form.html.erb new file mode 100644 index 0000000..4f67d52 --- /dev/null +++ b/app/views/comentarios/_form.html.erb @@ -0,0 +1,30 @@ +<%= form_for(@comentario) do |f| %> + <% if @comentario.errors.any? %> +
+

<%= pluralize(@comentario.errors.count, "error") %> prohibited this comentario from being saved:

+ +
    + <% @comentario.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :coment %>
+ <%= f.text_area :coment, :rows => 4 %> +
+ +
+ <%= f.label :site_id %>
+ + <%= f.collection_select(:site_id, Site.find(:all, :order => :name), :id, :name) %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/comentarios/_form.html.erb~ b/app/views/comentarios/_form.html.erb~ new file mode 100644 index 0000000..40d3350 --- /dev/null +++ b/app/views/comentarios/_form.html.erb~ @@ -0,0 +1,30 @@ +<%= form_for(@comentario) do |f| %> + <% if @comentario.errors.any? %> +
+

<%= pluralize(@comentario.errors.count, "error") %> prohibited this comentario from being saved:

+ +
    + <% @comentario.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :coment %>
+ <%= f.text_field :coment %> +
+ +
+ <%= f.label :site_id %>
+ + <%= f.collection_select(:site_id, Site.find(:all, :order => :name), :id, :name) %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/comentarios/edit.html.erb b/app/views/comentarios/edit.html.erb new file mode 100644 index 0000000..9a8929b --- /dev/null +++ b/app/views/comentarios/edit.html.erb @@ -0,0 +1,6 @@ +

Editing comentario

+ +<%= render 'form' %> + +<%= link_to 'Show', @comentario %> | +<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/index.html.erb b/app/views/comentarios/index.html.erb new file mode 100644 index 0000000..27338ae --- /dev/null +++ b/app/views/comentarios/index.html.erb @@ -0,0 +1,41 @@ +
+

Listing Comentarios

+ + + +<% @comentarios.each do |comentario| %> + + + + + + + + + + + +<% end %> +
<%= comentario.user.name if comentario.user %> +
+
<%= link_to comentario.site.name, comentario.site if comentario.site%>
+
<%= comentario.coment %>
+
+ + <% if comentario.user == current_user %> + <%= link_to 'Edit', edit_comentario_path(comentario) %>
+ <%= link_to 'Destroy', comentario, confirm: 'Are you sure?', method: :delete %> + <% end %> +
+
+ +
+ +<%= link_to 'New Comentario', new_comentario_path %> diff --git a/app/views/comentarios/index.html.erb~ b/app/views/comentarios/index.html.erb~ new file mode 100644 index 0000000..b482987 --- /dev/null +++ b/app/views/comentarios/index.html.erb~ @@ -0,0 +1,41 @@ +
+

Listing Comentarios

+ + + +<% @comentarios.each do |comentario| %> + + + + + + + + + + + +<% end %> +
<%= comentario.user.name if comentario.user %> +
+
<%= comentario.site.name if comentario.site %>
+
<%= comentario.coment %>
+
+ + <% if comentario.user == current_user %> + <%= link_to 'Edit', edit_comentario_path(comentario) %>
+ <%= link_to 'Destroy', comentario, confirm: 'Are you sure?', method: :delete %> + <% end %> +
+
+ +
+ +<%= link_to 'New Comentario', new_comentario_path %> diff --git a/app/views/comentarios/new.html.erb b/app/views/comentarios/new.html.erb new file mode 100644 index 0000000..5310e0c --- /dev/null +++ b/app/views/comentarios/new.html.erb @@ -0,0 +1,5 @@ +

New comentario

+ +<%= render 'form' %> + +<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/show.html.erb b/app/views/comentarios/show.html.erb new file mode 100644 index 0000000..12d5915 --- /dev/null +++ b/app/views/comentarios/show.html.erb @@ -0,0 +1,23 @@ +

<%= notice %>

+ +

+ Coment: + <%= @comentario.coment %> +

+ +

+ Autor: + + <%= @comentario.user.name if @comentario.user %> +

+ +

+ Site: + + <%= @comentario.site.name if @comentario.site %> +

+ + +<%= link_to 'Edit', edit_comentario_path(@comentario) %> | +<%= link_to 'Back', comentarios_path %> | +<%= link_to 'Destroy', @comentario, :confirm => 'Are you sure?', :method => :delete %> diff --git a/app/views/comentarios/show.html.erb~ b/app/views/comentarios/show.html.erb~ new file mode 100644 index 0000000..c7a6dec --- /dev/null +++ b/app/views/comentarios/show.html.erb~ @@ -0,0 +1,25 @@ +

<%= notice %>

+ +

+ Coment: + <%= @comentario.coment %> +

+ +

+ Autor: + + <%= @comentario.user.name if @comentario.user %> +

+ +

+ Site: + + <%= @comentario.site.name if @comentario.site %> +

+ + +<%= link_to 'Edit', edit_comentario_path(@comentario) %> | +<%= link_to 'Back', comentarios_path %> +<%= link_to 'Destroy', @comentario, + :confirm => 'Are you sure?', + :method => :delete %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 368a880..abb6345 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -34,6 +34,7 @@ <%= link_to "Tipos", types_path %>
<%= link_to "Sitios", sites_path %>
<%= link_to "Viajes", trips_path %>
+ <%= link_to "Comentarios", comentarios_path %>
<%= link_to "Autor", planet_autor_path %>
<%= link_to "Contact", planet_contact_path %>
<%= link_to "Sign up", new_user_registration_path if !current_user %> @@ -47,6 +48,7 @@ <%= link_to "Tipos", types_path %> | <%= link_to "Sitios", sites_path %> | <%= link_to "Viajes", trips_path %> | + <%= link_to "Comentarios", comentarios_path %> | <%= link_to "Autor", planet_autor_path %> | <%= link_to "Contact", planet_contact_path %> | <%= link_to "Sign up", new_user_registration_path if !current_user %> diff --git a/app/views/layouts/application.html.erb~ b/app/views/layouts/application.html.erb~ index c58b351..d282ad6 100644 --- a/app/views/layouts/application.html.erb~ +++ b/app/views/layouts/application.html.erb~ @@ -34,6 +34,7 @@ <%= link_to "Tipos", types_path %>
<%= link_to "Sitios", sites_path %>
<%= link_to "Viajes", trips_path %>
+ <%= link_to "Comentarios", comments_path %>
<%= link_to "Autor", planet_autor_path %>
<%= link_to "Contact", planet_contact_path %>
<%= link_to "Sign up", new_user_registration_path if !current_user %> @@ -43,12 +44,13 @@ <%= yield %>
- <%= link_to "Home", planet_index_path %>
| + <%= link_to "Home", planet_index_path %> | <%= link_to "Tipos", types_path %> | - <%= link_to "Sitios", sites_path %>
| - <%= link_to "Viajes", trips_path %>
| - <%= link_to "Autor", planet_autor_path %>
| - <%= link_to "Contact", planet_contact_path %>
| + <%= link_to "Sitios", sites_path %> | + <%= link_to "Viajes", trips_path %> | + <%= link_to "Comentarios", comments_path %> | + <%= link_to "Autor", planet_autor_path %> | + <%= link_to "Contact", planet_contact_path %> | <%= link_to "Sign up", new_user_registration_path if !current_user %>
diff --git a/config/routes.rb b/config/routes.rb index 9327e96..0a746dc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,7 @@ Planet::Application.routes.draw do + resources :comentarios + resources :visits resources :trips diff --git a/db/migrate/20120410235356_create_comentarios.rb b/db/migrate/20120410235356_create_comentarios.rb new file mode 100644 index 0000000..1f46d24 --- /dev/null +++ b/db/migrate/20120410235356_create_comentarios.rb @@ -0,0 +1,11 @@ +class CreateComentarios < ActiveRecord::Migration + def change + create_table :comentarios do |t| + t.string :coment + t.integer :user_id + t.integer :site_id + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 55d9fcf..9999bd6 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 => 20120409143117) do +ActiveRecord::Schema.define(:version => 20120410235356) do + + create_table "comentarios", :force => true do |t| + t.string "coment" + 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" diff --git a/test/fixtures/comentarios.yml b/test/fixtures/comentarios.yml new file mode 100644 index 0000000..e7e2ac9 --- /dev/null +++ b/test/fixtures/comentarios.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + coment: MyString + user_id: 1 + site_id: 1 + +two: + coment: MyString + user_id: 1 + site_id: 1 diff --git a/test/functional/comentarios_controller_test.rb b/test/functional/comentarios_controller_test.rb new file mode 100644 index 0000000..2c09333 --- /dev/null +++ b/test/functional/comentarios_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class ComentariosControllerTest < ActionController::TestCase + setup do + @comentario = comentarios(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:comentarios) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create comentario" do + assert_difference('Comentario.count') do + post :create, comentario: @comentario.attributes + end + + assert_redirected_to comentario_path(assigns(:comentario)) + end + + test "should show comentario" do + get :show, id: @comentario + assert_response :success + end + + test "should get edit" do + get :edit, id: @comentario + assert_response :success + end + + test "should update comentario" do + put :update, id: @comentario, comentario: @comentario.attributes + assert_redirected_to comentario_path(assigns(:comentario)) + end + + test "should destroy comentario" do + assert_difference('Comentario.count', -1) do + delete :destroy, id: @comentario + end + + assert_redirected_to comentarios_path + end +end diff --git a/test/unit/comentario_test.rb b/test/unit/comentario_test.rb new file mode 100644 index 0000000..02f982d --- /dev/null +++ b/test/unit/comentario_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ComentarioTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/comentarios_helper_test.rb b/test/unit/helpers/comentarios_helper_test.rb new file mode 100644 index 0000000..d553eef --- /dev/null +++ b/test/unit/helpers/comentarios_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ComentariosHelperTest < ActionView::TestCase +end From 224dbb10f991f30c4a6990269de47babf35c68fb Mon Sep 17 00:00:00 2001 From: Merlin Date: Wed, 11 Apr 2012 17:48:22 +0200 Subject: [PATCH 04/15] Cambiada vista para sites, ahora aparece el enlace comentarios --- .gitignore | 0 Gemfile | 0 Gemfile.lock | 0 README.rdoc | 0 Rakefile | 0 app/assets/images/arbol1.png | Bin app/assets/images/florencia.png | Bin app/assets/images/logo3.png | Bin app/assets/images/pedriza.png | Bin app/assets/images/pedriza2-m.png | Bin app/assets/images/pergamo.png | Bin app/assets/images/rails.png | Bin app/assets/images/reichstag.png | Bin app/assets/javascripts/application.js | 0 app/assets/javascripts/comentarios.js.coffee | 0 app/assets/javascripts/planet.js.coffee | 0 app/assets/javascripts/sites.js.coffee | 0 app/assets/javascripts/trips.js.coffee | 0 app/assets/javascripts/types.js.coffee | 0 app/assets/javascripts/visits.js.coffee | 0 app/assets/stylesheets/application.css | 0 app/assets/stylesheets/comentarios.css.scss | 0 app/assets/stylesheets/planet.css | 0 app/assets/stylesheets/planet.css.scss | 0 app/assets/stylesheets/planet.css~ | 0 app/assets/stylesheets/scaffolds.css.scss | 0 app/assets/stylesheets/sites.css.scss | 0 app/assets/stylesheets/trips.css.scss | 0 app/assets/stylesheets/types.css.scss | 0 app/assets/stylesheets/visits.css.scss | 0 app/controllers/application_controller.rb | 0 app/controllers/comentarios_controller.rb | 0 app/controllers/comentarios_controller.rb~ | 0 app/controllers/planet_controller.rb | 0 app/controllers/sites_controller.rb | 0 app/controllers/trips_controller.rb | 0 app/controllers/types_controller.rb | 0 app/controllers/visits_controller.rb | 0 app/helpers/application_helper.rb | 0 app/helpers/comentarios_helper.rb | 0 app/helpers/planet_helper.rb | 0 app/helpers/sites_helper.rb | 0 app/helpers/trips_helper.rb | 0 app/helpers/types_helper.rb | 0 app/helpers/visits_helper.rb | 0 app/mailers/.gitkeep | 0 app/models/.gitkeep | 0 app/models/comentario.rb | 0 app/models/comentario.rb~ | 0 app/models/site.rb | 0 app/models/site.rb~ | 0 app/models/trip.rb | 0 app/models/type.rb | 0 app/models/user.rb | 0 app/models/user.rb~ | 0 app/models/visit.rb | 0 app/views/comentarios/_form.html.erb | 0 app/views/comentarios/_form.html.erb~ | 0 app/views/comentarios/edit.html.erb | 0 app/views/comentarios/index.html.erb | 0 app/views/comentarios/index.html.erb~ | 0 app/views/comentarios/new.html.erb | 0 app/views/comentarios/show.html.erb | 0 app/views/comentarios/show.html.erb~ | 0 app/views/devise/_links.erb | 0 app/views/devise/confirmations/new.html.erb | 0 .../mailer/confirmation_instructions.html.erb | 0 .../reset_password_instructions.html.erb | 0 .../mailer/unlock_instructions.html.erb | 0 app/views/devise/passwords/edit.html.erb | 0 app/views/devise/passwords/new.html.erb | 0 app/views/devise/registrations/edit.html.erb | 0 app/views/devise/registrations/new.html.erb | 0 app/views/devise/sessions/new.html.erb | 0 app/views/devise/unlocks/new.html.erb | 0 app/views/layouts/application.html.erb | 0 app/views/layouts/application.html.erb~ | 0 app/views/planet/autor.html.erb | 0 app/views/planet/autor.html.erb~ | 0 app/views/planet/contact.html.erb | 0 app/views/planet/ejemplo.html.erb | 0 app/views/planet/index.html.erb | 0 app/views/sites/_form.html.erb | 0 app/views/sites/edit.html.erb | 0 app/views/sites/index.html.erb | 1 + app/views/sites/index.html.erb~ | 11 +++++--- app/views/sites/new.html.erb | 0 app/views/sites/show.html.erb | 12 +++++++-- app/views/sites/show.html.erb~ | 24 ++++++++++++++++++ app/views/trips/_form.html.erb | 0 app/views/trips/_trip.html.erb | 0 app/views/trips/edit.html.erb | 0 app/views/trips/index.html.erb | 0 app/views/trips/new.html.erb | 0 app/views/trips/show.html.erb | 0 app/views/types/_form.html.erb | 0 app/views/types/edit.html.erb | 0 app/views/types/index.html.erb | 0 app/views/types/new.html.erb | 0 app/views/types/show.html.erb | 0 app/views/visits/_form.html.erb | 0 app/views/visits/edit.html.erb | 0 app/views/visits/index.html.erb | 0 app/views/visits/new.html.erb | 0 app/views/visits/show.html.erb | 0 config.ru | 0 config/application.rb | 0 config/boot.rb | 0 config/database.yml | 0 config/environment.rb | 0 config/environments/development.rb | 0 config/environments/production.rb | 0 config/environments/test.rb | 0 config/initializers/backtrace_silencers.rb | 0 config/initializers/devise.rb | 0 config/initializers/inflections.rb | 0 config/initializers/mime_types.rb | 0 config/initializers/secret_token.rb | 0 config/initializers/session_store.rb | 0 config/initializers/wrap_parameters.rb | 0 config/locales/devise.en.yml | 0 config/locales/en.yml | 0 config/routes.rb | 4 +++ config/routes.rb~ | 8 ++++++ db/migrate/20120317231537_create_types.rb | 0 db/migrate/20120320100145_create_sites.rb | 0 .../20120328230302_devise_create_users.rb | 0 db/migrate/20120329060322_user_name.rb | 0 db/migrate/20120329080433_user_sites.rb | 0 db/migrate/20120409085740_create_trips.rb | 0 db/migrate/20120409143117_create_visits.rb | 0 .../20120410235356_create_comentarios.rb | 0 db/schema.rb | 0 db/seeds.rb | 0 doc/README_FOR_APP | 0 lib/assets/.gitkeep | 0 lib/tasks/.gitkeep | 0 log/.gitkeep | 0 public/404.html | 0 public/422.html | 0 public/500.html | 0 public/favicon.ico | 0 public/robots.txt | 0 test/fixtures/.gitkeep | 0 test/fixtures/comentarios.yml | 0 test/fixtures/sites.yml | 0 test/fixtures/trips.yml | 0 test/fixtures/types.yml | 0 test/fixtures/users.yml | 0 test/fixtures/visits.yml | 0 test/functional/.gitkeep | 0 .../functional/comentarios_controller_test.rb | 0 test/functional/planet_controller_test.rb | 0 test/functional/sites_controller_test.rb | 0 test/functional/trips_controller_test.rb | 0 test/functional/types_controller_test.rb | 0 test/functional/visits_controller_test.rb | 0 test/integration/.gitkeep | 0 test/performance/browsing_test.rb | 0 test/test_helper.rb | 0 test/unit/.gitkeep | 0 test/unit/comentario_test.rb | 0 test/unit/helpers/comentarios_helper_test.rb | 0 test/unit/helpers/planet_helper_test.rb | 0 test/unit/helpers/sites_helper_test.rb | 0 test/unit/helpers/trips_helper_test.rb | 0 test/unit/helpers/types_helper_test.rb | 0 test/unit/helpers/visits_helper_test.rb | 0 test/unit/site_test.rb | 0 test/unit/trip_test.rb | 0 test/unit/type_test.rb | 0 test/unit/user_test.rb | 0 test/unit/visit_test.rb | 0 vendor/assets/javascripts/.gitkeep | 0 vendor/assets/stylesheets/.gitkeep | 0 vendor/plugins/.gitkeep | 0 176 files changed, 54 insertions(+), 6 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 Gemfile mode change 100644 => 100755 Gemfile.lock mode change 100644 => 100755 README.rdoc mode change 100644 => 100755 Rakefile mode change 100644 => 100755 app/assets/images/arbol1.png mode change 100644 => 100755 app/assets/images/florencia.png mode change 100644 => 100755 app/assets/images/logo3.png mode change 100644 => 100755 app/assets/images/pedriza.png mode change 100644 => 100755 app/assets/images/pedriza2-m.png mode change 100644 => 100755 app/assets/images/pergamo.png mode change 100644 => 100755 app/assets/images/rails.png mode change 100644 => 100755 app/assets/images/reichstag.png mode change 100644 => 100755 app/assets/javascripts/application.js mode change 100644 => 100755 app/assets/javascripts/comentarios.js.coffee mode change 100644 => 100755 app/assets/javascripts/planet.js.coffee mode change 100644 => 100755 app/assets/javascripts/sites.js.coffee mode change 100644 => 100755 app/assets/javascripts/trips.js.coffee mode change 100644 => 100755 app/assets/javascripts/types.js.coffee mode change 100644 => 100755 app/assets/javascripts/visits.js.coffee mode change 100644 => 100755 app/assets/stylesheets/application.css mode change 100644 => 100755 app/assets/stylesheets/comentarios.css.scss mode change 100644 => 100755 app/assets/stylesheets/planet.css mode change 100644 => 100755 app/assets/stylesheets/planet.css.scss mode change 100644 => 100755 app/assets/stylesheets/planet.css~ mode change 100644 => 100755 app/assets/stylesheets/scaffolds.css.scss mode change 100644 => 100755 app/assets/stylesheets/sites.css.scss mode change 100644 => 100755 app/assets/stylesheets/trips.css.scss mode change 100644 => 100755 app/assets/stylesheets/types.css.scss mode change 100644 => 100755 app/assets/stylesheets/visits.css.scss mode change 100644 => 100755 app/controllers/application_controller.rb mode change 100644 => 100755 app/controllers/comentarios_controller.rb mode change 100644 => 100755 app/controllers/comentarios_controller.rb~ mode change 100644 => 100755 app/controllers/planet_controller.rb mode change 100644 => 100755 app/controllers/sites_controller.rb mode change 100644 => 100755 app/controllers/trips_controller.rb mode change 100644 => 100755 app/controllers/types_controller.rb mode change 100644 => 100755 app/controllers/visits_controller.rb mode change 100644 => 100755 app/helpers/application_helper.rb mode change 100644 => 100755 app/helpers/comentarios_helper.rb mode change 100644 => 100755 app/helpers/planet_helper.rb mode change 100644 => 100755 app/helpers/sites_helper.rb mode change 100644 => 100755 app/helpers/trips_helper.rb mode change 100644 => 100755 app/helpers/types_helper.rb mode change 100644 => 100755 app/helpers/visits_helper.rb mode change 100644 => 100755 app/mailers/.gitkeep mode change 100644 => 100755 app/models/.gitkeep mode change 100644 => 100755 app/models/comentario.rb mode change 100644 => 100755 app/models/comentario.rb~ mode change 100644 => 100755 app/models/site.rb mode change 100644 => 100755 app/models/site.rb~ mode change 100644 => 100755 app/models/trip.rb mode change 100644 => 100755 app/models/type.rb mode change 100644 => 100755 app/models/user.rb mode change 100644 => 100755 app/models/user.rb~ mode change 100644 => 100755 app/models/visit.rb mode change 100644 => 100755 app/views/comentarios/_form.html.erb mode change 100644 => 100755 app/views/comentarios/_form.html.erb~ mode change 100644 => 100755 app/views/comentarios/edit.html.erb mode change 100644 => 100755 app/views/comentarios/index.html.erb mode change 100644 => 100755 app/views/comentarios/index.html.erb~ mode change 100644 => 100755 app/views/comentarios/new.html.erb mode change 100644 => 100755 app/views/comentarios/show.html.erb mode change 100644 => 100755 app/views/comentarios/show.html.erb~ mode change 100644 => 100755 app/views/devise/_links.erb mode change 100644 => 100755 app/views/devise/confirmations/new.html.erb mode change 100644 => 100755 app/views/devise/mailer/confirmation_instructions.html.erb mode change 100644 => 100755 app/views/devise/mailer/reset_password_instructions.html.erb mode change 100644 => 100755 app/views/devise/mailer/unlock_instructions.html.erb mode change 100644 => 100755 app/views/devise/passwords/edit.html.erb mode change 100644 => 100755 app/views/devise/passwords/new.html.erb mode change 100644 => 100755 app/views/devise/registrations/edit.html.erb mode change 100644 => 100755 app/views/devise/registrations/new.html.erb mode change 100644 => 100755 app/views/devise/sessions/new.html.erb mode change 100644 => 100755 app/views/devise/unlocks/new.html.erb mode change 100644 => 100755 app/views/layouts/application.html.erb mode change 100644 => 100755 app/views/layouts/application.html.erb~ mode change 100644 => 100755 app/views/planet/autor.html.erb mode change 100644 => 100755 app/views/planet/autor.html.erb~ mode change 100644 => 100755 app/views/planet/contact.html.erb mode change 100644 => 100755 app/views/planet/ejemplo.html.erb mode change 100644 => 100755 app/views/planet/index.html.erb mode change 100644 => 100755 app/views/sites/_form.html.erb mode change 100644 => 100755 app/views/sites/edit.html.erb mode change 100644 => 100755 app/views/sites/index.html.erb mode change 100644 => 100755 app/views/sites/index.html.erb~ mode change 100644 => 100755 app/views/sites/new.html.erb mode change 100644 => 100755 app/views/sites/show.html.erb create mode 100755 app/views/sites/show.html.erb~ mode change 100644 => 100755 app/views/trips/_form.html.erb mode change 100644 => 100755 app/views/trips/_trip.html.erb mode change 100644 => 100755 app/views/trips/edit.html.erb mode change 100644 => 100755 app/views/trips/index.html.erb mode change 100644 => 100755 app/views/trips/new.html.erb mode change 100644 => 100755 app/views/trips/show.html.erb mode change 100644 => 100755 app/views/types/_form.html.erb mode change 100644 => 100755 app/views/types/edit.html.erb mode change 100644 => 100755 app/views/types/index.html.erb mode change 100644 => 100755 app/views/types/new.html.erb mode change 100644 => 100755 app/views/types/show.html.erb mode change 100644 => 100755 app/views/visits/_form.html.erb mode change 100644 => 100755 app/views/visits/edit.html.erb mode change 100644 => 100755 app/views/visits/index.html.erb mode change 100644 => 100755 app/views/visits/new.html.erb mode change 100644 => 100755 app/views/visits/show.html.erb mode change 100644 => 100755 config.ru mode change 100644 => 100755 config/application.rb mode change 100644 => 100755 config/boot.rb mode change 100644 => 100755 config/database.yml mode change 100644 => 100755 config/environment.rb mode change 100644 => 100755 config/environments/development.rb mode change 100644 => 100755 config/environments/production.rb mode change 100644 => 100755 config/environments/test.rb mode change 100644 => 100755 config/initializers/backtrace_silencers.rb mode change 100644 => 100755 config/initializers/devise.rb mode change 100644 => 100755 config/initializers/inflections.rb mode change 100644 => 100755 config/initializers/mime_types.rb mode change 100644 => 100755 config/initializers/secret_token.rb mode change 100644 => 100755 config/initializers/session_store.rb mode change 100644 => 100755 config/initializers/wrap_parameters.rb mode change 100644 => 100755 config/locales/devise.en.yml mode change 100644 => 100755 config/locales/en.yml mode change 100644 => 100755 config/routes.rb mode change 100644 => 100755 config/routes.rb~ mode change 100644 => 100755 db/migrate/20120317231537_create_types.rb mode change 100644 => 100755 db/migrate/20120320100145_create_sites.rb mode change 100644 => 100755 db/migrate/20120328230302_devise_create_users.rb mode change 100644 => 100755 db/migrate/20120329060322_user_name.rb mode change 100644 => 100755 db/migrate/20120329080433_user_sites.rb mode change 100644 => 100755 db/migrate/20120409085740_create_trips.rb mode change 100644 => 100755 db/migrate/20120409143117_create_visits.rb mode change 100644 => 100755 db/migrate/20120410235356_create_comentarios.rb mode change 100644 => 100755 db/schema.rb mode change 100644 => 100755 db/seeds.rb mode change 100644 => 100755 doc/README_FOR_APP mode change 100644 => 100755 lib/assets/.gitkeep mode change 100644 => 100755 lib/tasks/.gitkeep mode change 100644 => 100755 log/.gitkeep mode change 100644 => 100755 public/404.html mode change 100644 => 100755 public/422.html mode change 100644 => 100755 public/500.html mode change 100644 => 100755 public/favicon.ico mode change 100644 => 100755 public/robots.txt mode change 100644 => 100755 test/fixtures/.gitkeep mode change 100644 => 100755 test/fixtures/comentarios.yml mode change 100644 => 100755 test/fixtures/sites.yml mode change 100644 => 100755 test/fixtures/trips.yml mode change 100644 => 100755 test/fixtures/types.yml mode change 100644 => 100755 test/fixtures/users.yml mode change 100644 => 100755 test/fixtures/visits.yml mode change 100644 => 100755 test/functional/.gitkeep mode change 100644 => 100755 test/functional/comentarios_controller_test.rb mode change 100644 => 100755 test/functional/planet_controller_test.rb mode change 100644 => 100755 test/functional/sites_controller_test.rb mode change 100644 => 100755 test/functional/trips_controller_test.rb mode change 100644 => 100755 test/functional/types_controller_test.rb mode change 100644 => 100755 test/functional/visits_controller_test.rb mode change 100644 => 100755 test/integration/.gitkeep mode change 100644 => 100755 test/performance/browsing_test.rb mode change 100644 => 100755 test/test_helper.rb mode change 100644 => 100755 test/unit/.gitkeep mode change 100644 => 100755 test/unit/comentario_test.rb mode change 100644 => 100755 test/unit/helpers/comentarios_helper_test.rb mode change 100644 => 100755 test/unit/helpers/planet_helper_test.rb mode change 100644 => 100755 test/unit/helpers/sites_helper_test.rb mode change 100644 => 100755 test/unit/helpers/trips_helper_test.rb mode change 100644 => 100755 test/unit/helpers/types_helper_test.rb mode change 100644 => 100755 test/unit/helpers/visits_helper_test.rb mode change 100644 => 100755 test/unit/site_test.rb mode change 100644 => 100755 test/unit/trip_test.rb mode change 100644 => 100755 test/unit/type_test.rb mode change 100644 => 100755 test/unit/user_test.rb mode change 100644 => 100755 test/unit/visit_test.rb mode change 100644 => 100755 vendor/assets/javascripts/.gitkeep mode change 100644 => 100755 vendor/assets/stylesheets/.gitkeep mode change 100644 => 100755 vendor/plugins/.gitkeep diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/Gemfile b/Gemfile old mode 100644 new mode 100755 diff --git a/Gemfile.lock b/Gemfile.lock old mode 100644 new mode 100755 diff --git a/README.rdoc b/README.rdoc old mode 100644 new mode 100755 diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 diff --git a/app/assets/images/arbol1.png b/app/assets/images/arbol1.png old mode 100644 new mode 100755 diff --git a/app/assets/images/florencia.png b/app/assets/images/florencia.png old mode 100644 new mode 100755 diff --git a/app/assets/images/logo3.png b/app/assets/images/logo3.png old mode 100644 new mode 100755 diff --git a/app/assets/images/pedriza.png b/app/assets/images/pedriza.png old mode 100644 new mode 100755 diff --git a/app/assets/images/pedriza2-m.png b/app/assets/images/pedriza2-m.png old mode 100644 new mode 100755 diff --git a/app/assets/images/pergamo.png b/app/assets/images/pergamo.png old mode 100644 new mode 100755 diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png old mode 100644 new mode 100755 diff --git a/app/assets/images/reichstag.png b/app/assets/images/reichstag.png old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/comentarios.js.coffee b/app/assets/javascripts/comentarios.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/planet.js.coffee b/app/assets/javascripts/planet.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/sites.js.coffee b/app/assets/javascripts/sites.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/trips.js.coffee b/app/assets/javascripts/trips.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/types.js.coffee b/app/assets/javascripts/types.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/visits.js.coffee b/app/assets/javascripts/visits.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/comentarios.css.scss b/app/assets/stylesheets/comentarios.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/planet.css b/app/assets/stylesheets/planet.css old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/planet.css.scss b/app/assets/stylesheets/planet.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/planet.css~ b/app/assets/stylesheets/planet.css~ old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/sites.css.scss b/app/assets/stylesheets/sites.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/trips.css.scss b/app/assets/stylesheets/trips.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/types.css.scss b/app/assets/stylesheets/types.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/visits.css.scss b/app/assets/stylesheets/visits.css.scss old mode 100644 new mode 100755 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/comentarios_controller.rb b/app/controllers/comentarios_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/comentarios_controller.rb~ b/app/controllers/comentarios_controller.rb~ old mode 100644 new mode 100755 diff --git a/app/controllers/planet_controller.rb b/app/controllers/planet_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/visits_controller.rb b/app/controllers/visits_controller.rb old mode 100644 new mode 100755 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/comentarios_helper.rb b/app/helpers/comentarios_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/planet_helper.rb b/app/helpers/planet_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/sites_helper.rb b/app/helpers/sites_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/trips_helper.rb b/app/helpers/trips_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/types_helper.rb b/app/helpers/types_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/visits_helper.rb b/app/helpers/visits_helper.rb old mode 100644 new mode 100755 diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep old mode 100644 new mode 100755 diff --git a/app/models/.gitkeep b/app/models/.gitkeep old mode 100644 new mode 100755 diff --git a/app/models/comentario.rb b/app/models/comentario.rb old mode 100644 new mode 100755 diff --git a/app/models/comentario.rb~ b/app/models/comentario.rb~ old mode 100644 new mode 100755 diff --git a/app/models/site.rb b/app/models/site.rb old mode 100644 new mode 100755 diff --git a/app/models/site.rb~ b/app/models/site.rb~ old mode 100644 new mode 100755 diff --git a/app/models/trip.rb b/app/models/trip.rb old mode 100644 new mode 100755 diff --git a/app/models/type.rb b/app/models/type.rb old mode 100644 new mode 100755 diff --git a/app/models/user.rb b/app/models/user.rb old mode 100644 new mode 100755 diff --git a/app/models/user.rb~ b/app/models/user.rb~ old mode 100644 new mode 100755 diff --git a/app/models/visit.rb b/app/models/visit.rb old mode 100644 new mode 100755 diff --git a/app/views/comentarios/_form.html.erb b/app/views/comentarios/_form.html.erb old mode 100644 new mode 100755 diff --git a/app/views/comentarios/_form.html.erb~ b/app/views/comentarios/_form.html.erb~ old mode 100644 new mode 100755 diff --git a/app/views/comentarios/edit.html.erb b/app/views/comentarios/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/comentarios/index.html.erb b/app/views/comentarios/index.html.erb old mode 100644 new mode 100755 diff --git a/app/views/comentarios/index.html.erb~ b/app/views/comentarios/index.html.erb~ old mode 100644 new mode 100755 diff --git a/app/views/comentarios/new.html.erb b/app/views/comentarios/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/comentarios/show.html.erb b/app/views/comentarios/show.html.erb old mode 100644 new mode 100755 diff --git a/app/views/comentarios/show.html.erb~ b/app/views/comentarios/show.html.erb~ old mode 100644 new mode 100755 diff --git a/app/views/devise/_links.erb b/app/views/devise/_links.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb old mode 100644 new mode 100755 diff --git a/app/views/layouts/application.html.erb~ b/app/views/layouts/application.html.erb~ old mode 100644 new mode 100755 diff --git a/app/views/planet/autor.html.erb b/app/views/planet/autor.html.erb old mode 100644 new mode 100755 diff --git a/app/views/planet/autor.html.erb~ b/app/views/planet/autor.html.erb~ old mode 100644 new mode 100755 diff --git a/app/views/planet/contact.html.erb b/app/views/planet/contact.html.erb old mode 100644 new mode 100755 diff --git a/app/views/planet/ejemplo.html.erb b/app/views/planet/ejemplo.html.erb old mode 100644 new mode 100755 diff --git a/app/views/planet/index.html.erb b/app/views/planet/index.html.erb old mode 100644 new mode 100755 diff --git a/app/views/sites/_form.html.erb b/app/views/sites/_form.html.erb old mode 100644 new mode 100755 diff --git a/app/views/sites/edit.html.erb b/app/views/sites/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb old mode 100644 new mode 100755 index 469710d..ca1096e --- 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) %>
+
<%= link_to 'comentarios >>', site_comentarios_path(site.id) %>
diff --git a/app/views/sites/index.html.erb~ b/app/views/sites/index.html.erb~ old mode 100644 new mode 100755 index df94078..84ea45a --- a/app/views/sites/index.html.erb~ +++ b/app/views/sites/index.html.erb~ @@ -14,16 +14,19 @@
<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
+
<%= link_to 'comentarios', site_comentarios_path(site.id) %>
- <%= link_to 'Show', site %>
- <% if site.user == current_user %> <%= link_to 'Edit', edit_site_path(site) %>
+ + <% if site.user == current_user %> + <%= link_to 'Edit', edit_site_path(site) %>
<%= link_to 'Destroy', site, :confirm => 'Are you sure?', :method => :delete %> - <% end %> + <% end %> + <% end %> @@ -31,4 +34,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/new.html.erb b/app/views/sites/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb old mode 100644 new mode 100755 index 1b81f59..03865fd --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -8,8 +8,16 @@

<%=sanitize @site.description %>

-

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

+ +

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

+ + +

-<% if @site.user == current_user %> <%= link_to 'Edit', edit_site_path(@site) %> | <% end %> <%= link_to 'Back', sites_path %> +<% if @site.user == current_user %> + <%= link_to 'Edit', edit_site_path(@site) %> | +<% end %> +<%= link_to 'Back', sites_path %> diff --git a/app/views/sites/show.html.erb~ b/app/views/sites/show.html.erb~ new file mode 100755 index 0000000..a09c318 --- /dev/null +++ b/app/views/sites/show.html.erb~ @@ -0,0 +1,24 @@ +

+ +

<%= @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 %>

+ +

Comentarios:

+ + +
+ +

+<% if @site.user == current_user %> + <%= link_to 'Edit', edit_site_path(@site) %> | +<% end %> +<%= link_to 'Back', sites_path %> diff --git a/app/views/trips/_form.html.erb b/app/views/trips/_form.html.erb old mode 100644 new mode 100755 diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb old mode 100644 new mode 100755 diff --git a/app/views/trips/edit.html.erb b/app/views/trips/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/trips/index.html.erb b/app/views/trips/index.html.erb old mode 100644 new mode 100755 diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb old mode 100644 new mode 100755 diff --git a/app/views/types/_form.html.erb b/app/views/types/_form.html.erb old mode 100644 new mode 100755 diff --git a/app/views/types/edit.html.erb b/app/views/types/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb old mode 100644 new mode 100755 diff --git a/app/views/types/new.html.erb b/app/views/types/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/types/show.html.erb b/app/views/types/show.html.erb old mode 100644 new mode 100755 diff --git a/app/views/visits/_form.html.erb b/app/views/visits/_form.html.erb old mode 100644 new mode 100755 diff --git a/app/views/visits/edit.html.erb b/app/views/visits/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/visits/index.html.erb b/app/views/visits/index.html.erb old mode 100644 new mode 100755 diff --git a/app/views/visits/new.html.erb b/app/views/visits/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/visits/show.html.erb b/app/views/visits/show.html.erb old mode 100644 new mode 100755 diff --git a/config.ru b/config.ru old mode 100644 new mode 100755 diff --git a/config/application.rb b/config/application.rb old mode 100644 new mode 100755 diff --git a/config/boot.rb b/config/boot.rb old mode 100644 new mode 100755 diff --git a/config/database.yml b/config/database.yml old mode 100644 new mode 100755 diff --git a/config/environment.rb b/config/environment.rb old mode 100644 new mode 100755 diff --git a/config/environments/development.rb b/config/environments/development.rb old mode 100644 new mode 100755 diff --git a/config/environments/production.rb b/config/environments/production.rb old mode 100644 new mode 100755 diff --git a/config/environments/test.rb b/config/environments/test.rb old mode 100644 new mode 100755 diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb old mode 100644 new mode 100755 diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb old mode 100644 new mode 100755 diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb old mode 100644 new mode 100755 diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb old mode 100644 new mode 100755 diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb old mode 100644 new mode 100755 diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb old mode 100644 new mode 100755 diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb old mode 100644 new mode 100755 diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml old mode 100644 new mode 100755 diff --git a/config/locales/en.yml b/config/locales/en.yml old mode 100644 new mode 100755 diff --git a/config/routes.rb b/config/routes.rb old mode 100644 new mode 100755 index 0a746dc..eafeb87 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,6 +13,10 @@ resources :types do # Rutas anidadas /types/id/sites..., resources :sites, :only => [ :index ] # Restringe a acción “index” end + + resources :sites do # Rutas anidadas /types/id/sites..., + resources :comentarios, :only => [ :index ] # Restringe a acción “index” + end get "planet/index" diff --git a/config/routes.rb~ b/config/routes.rb~ old mode 100644 new mode 100755 index 29d3c86..eafeb87 --- a/config/routes.rb~ +++ b/config/routes.rb~ @@ -1,5 +1,7 @@ Planet::Application.routes.draw do + resources :comentarios + resources :visits resources :trips @@ -11,6 +13,10 @@ Planet::Application.routes.draw do resources :types do # Rutas anidadas /types/id/sites..., resources :sites, :only => [ :index ] # Restringe a acción “index” end + + resources :sites do # Rutas anidadas /types/id/sites..., + resources :comentarios, :only => [ :index ] # Restringe a acción “index” + end get "planet/index" @@ -18,6 +24,8 @@ Planet::Application.routes.draw do get "planet/ejemplo" + get "planet/autor" + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/db/migrate/20120317231537_create_types.rb b/db/migrate/20120317231537_create_types.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120320100145_create_sites.rb b/db/migrate/20120320100145_create_sites.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120328230302_devise_create_users.rb b/db/migrate/20120328230302_devise_create_users.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120329060322_user_name.rb b/db/migrate/20120329060322_user_name.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120329080433_user_sites.rb b/db/migrate/20120329080433_user_sites.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120409085740_create_trips.rb b/db/migrate/20120409085740_create_trips.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120409143117_create_visits.rb b/db/migrate/20120409143117_create_visits.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120410235356_create_comentarios.rb b/db/migrate/20120410235356_create_comentarios.rb old mode 100644 new mode 100755 diff --git a/db/schema.rb b/db/schema.rb old mode 100644 new mode 100755 diff --git a/db/seeds.rb b/db/seeds.rb old mode 100644 new mode 100755 diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP old mode 100644 new mode 100755 diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep old mode 100644 new mode 100755 diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep old mode 100644 new mode 100755 diff --git a/log/.gitkeep b/log/.gitkeep old mode 100644 new mode 100755 diff --git a/public/404.html b/public/404.html old mode 100644 new mode 100755 diff --git a/public/422.html b/public/422.html old mode 100644 new mode 100755 diff --git a/public/500.html b/public/500.html old mode 100644 new mode 100755 diff --git a/public/favicon.ico b/public/favicon.ico old mode 100644 new mode 100755 diff --git a/public/robots.txt b/public/robots.txt old mode 100644 new mode 100755 diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep old mode 100644 new mode 100755 diff --git a/test/fixtures/comentarios.yml b/test/fixtures/comentarios.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/sites.yml b/test/fixtures/sites.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/trips.yml b/test/fixtures/trips.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/types.yml b/test/fixtures/types.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/visits.yml b/test/fixtures/visits.yml old mode 100644 new mode 100755 diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep old mode 100644 new mode 100755 diff --git a/test/functional/comentarios_controller_test.rb b/test/functional/comentarios_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/functional/planet_controller_test.rb b/test/functional/planet_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/functional/sites_controller_test.rb b/test/functional/sites_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/functional/trips_controller_test.rb b/test/functional/trips_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/functional/types_controller_test.rb b/test/functional/types_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/functional/visits_controller_test.rb b/test/functional/visits_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/integration/.gitkeep b/test/integration/.gitkeep old mode 100644 new mode 100755 diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb old mode 100644 new mode 100755 diff --git a/test/test_helper.rb b/test/test_helper.rb old mode 100644 new mode 100755 diff --git a/test/unit/.gitkeep b/test/unit/.gitkeep old mode 100644 new mode 100755 diff --git a/test/unit/comentario_test.rb b/test/unit/comentario_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/helpers/comentarios_helper_test.rb b/test/unit/helpers/comentarios_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/helpers/planet_helper_test.rb b/test/unit/helpers/planet_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/helpers/sites_helper_test.rb b/test/unit/helpers/sites_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/helpers/trips_helper_test.rb b/test/unit/helpers/trips_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/helpers/types_helper_test.rb b/test/unit/helpers/types_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/helpers/visits_helper_test.rb b/test/unit/helpers/visits_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/site_test.rb b/test/unit/site_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/trip_test.rb b/test/unit/trip_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/type_test.rb b/test/unit/type_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/visit_test.rb b/test/unit/visit_test.rb old mode 100644 new mode 100755 diff --git a/vendor/assets/javascripts/.gitkeep b/vendor/assets/javascripts/.gitkeep old mode 100644 new mode 100755 diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep old mode 100644 new mode 100755 diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep old mode 100644 new mode 100755 From a88dd01bfdfadf10c5948bc533792c9a89f8e234 Mon Sep 17 00:00:00 2001 From: Merlin Date: Wed, 11 Apr 2012 18:00:51 +0200 Subject: [PATCH 05/15] Creado links a comentarios en index y show para sites --- app/views/sites/index.html.erb~ | 2 +- app/views/sites/show.html.erb | 3 ++- app/views/sites/show.html.erb~ | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/sites/index.html.erb~ b/app/views/sites/index.html.erb~ index 84ea45a..ca1096e 100755 --- a/app/views/sites/index.html.erb~ +++ b/app/views/sites/index.html.erb~ @@ -14,7 +14,7 @@

<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
-
<%= link_to 'comentarios', site_comentarios_path(site.id) %>
+
<%= link_to 'comentarios >>', site_comentarios_path(site.id) %>
diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 03865fd..5bc373c 100755 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -12,9 +12,10 @@

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

+

<%= link_to 'Comentarios >>', site_comentarios_path(@site.id) %>

- +

<% if @site.user == current_user %> diff --git a/app/views/sites/show.html.erb~ b/app/views/sites/show.html.erb~ index a09c318..14f4bcf 100755 --- a/app/views/sites/show.html.erb~ +++ b/app/views/sites/show.html.erb~ @@ -12,7 +12,8 @@

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

-

Comentarios:

+

<%= link_to 'Comentarios >>', site_comentarios_path(@site.id) %>

+ From 81c810a06d9a1bf757261e99630f14843b8a40d1 Mon Sep 17 00:00:00 2001 From: Merlin Date: Thu, 12 Apr 2012 20:25:08 +0200 Subject: [PATCH 06/15] Modificada aparicion de enlace de comentarios --- app/views/layouts/application.html.erb | 4 +--- app/views/layouts/application.html.erb~ | 4 ++-- app/views/sites/index.html.erb | 2 +- app/views/sites/show.html.erb | 5 ++--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index abb6345..65e6133 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -34,7 +34,6 @@ <%= link_to "Tipos", types_path %>
<%= link_to "Sitios", sites_path %>
<%= link_to "Viajes", trips_path %>
- <%= link_to "Comentarios", comentarios_path %>
<%= link_to "Autor", planet_autor_path %>
<%= link_to "Contact", planet_contact_path %>
<%= link_to "Sign up", new_user_registration_path if !current_user %> @@ -47,8 +46,7 @@ <%= link_to "Home", planet_index_path %> | <%= link_to "Tipos", types_path %> | <%= link_to "Sitios", sites_path %> | - <%= link_to "Viajes", trips_path %> | - <%= link_to "Comentarios", comentarios_path %> | + <%= link_to "Viajes", trips_path %> | <%= link_to "Autor", planet_autor_path %> | <%= link_to "Contact", planet_contact_path %> | <%= link_to "Sign up", new_user_registration_path if !current_user %> diff --git a/app/views/layouts/application.html.erb~ b/app/views/layouts/application.html.erb~ index d282ad6..abb6345 100755 --- a/app/views/layouts/application.html.erb~ +++ b/app/views/layouts/application.html.erb~ @@ -34,7 +34,7 @@ <%= link_to "Tipos", types_path %>
<%= link_to "Sitios", sites_path %>
<%= link_to "Viajes", trips_path %>
- <%= link_to "Comentarios", comments_path %>
+ <%= link_to "Comentarios", comentarios_path %>
<%= link_to "Autor", planet_autor_path %>
<%= link_to "Contact", planet_contact_path %>
<%= link_to "Sign up", new_user_registration_path if !current_user %> @@ -48,7 +48,7 @@ <%= link_to "Tipos", types_path %> | <%= link_to "Sitios", sites_path %> | <%= link_to "Viajes", trips_path %> | - <%= link_to "Comentarios", comments_path %> | + <%= link_to "Comentarios", comentarios_path %> | <%= link_to "Autor", planet_autor_path %> | <%= link_to "Contact", planet_contact_path %> | <%= link_to "Sign up", new_user_registration_path if !current_user %> diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index ca1096e..2287d2c 100755 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -14,7 +14,7 @@
<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
-
<%= link_to 'comentarios >>', site_comentarios_path(site.id) %>
+
<%= (link_to 'comentarios >>', site_comentarios_path(site.id)) if (site.comentarios.size > 0) %>
diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 5bc373c..b305f61 100755 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -11,9 +11,8 @@

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

- -

<%= link_to 'Comentarios >>', site_comentarios_path(@site.id) %>

- +

<%= (link_to 'Comentarios >>', site_comentarios_path(@site.id)) if (@site.comentarios.size > 0) %>

+

<%= link_to 'Añadir Comentario', new_comentario_path %>
From 8a2331e2a76950adb9a4793433f568afd4b5c8aa Mon Sep 17 00:00:00 2001 From: Merlin Date: Thu, 12 Apr 2012 20:47:33 +0200 Subject: [PATCH 07/15] Configurado el cleditor para todos los campos de texto --- app/views/layouts/application.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 65e6133..ce97058 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -8,7 +8,7 @@ From e4aed49f39619a986a6827eae1c5016e5debffba Mon Sep 17 00:00:00 2001 From: Merlin Date: Wed, 18 Apr 2012 20:51:51 +0200 Subject: [PATCH 08/15] Modificada tabla sites para geolocalizacion --- app/views/comentarios/index.html.erb | 11 +++----- app/views/sites/index.html.erb | 2 +- app/views/types/index.html.erb | 2 +- db/migrate/20120320100145_create_sites.rb~ | 15 +++++++++++ .../20120418184242_site_geolocalization.rb | 25 +++++++++++++++++++ .../20120418184242_site_geolocalization.rb~ | 19 ++++++++++++++ db/schema.rb | 5 +++- 7 files changed, 69 insertions(+), 10 deletions(-) create mode 100755 db/migrate/20120320100145_create_sites.rb~ create mode 100644 db/migrate/20120418184242_site_geolocalization.rb create mode 100644 db/migrate/20120418184242_site_geolocalization.rb~ diff --git a/app/views/comentarios/index.html.erb b/app/views/comentarios/index.html.erb index 27338ae..dec8b3e 100755 --- a/app/views/comentarios/index.html.erb +++ b/app/views/comentarios/index.html.erb @@ -1,5 +1,5 @@

-

Listing Comentarios

+

Comentarios

- - + - - diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 7e973e6..34bda11 100755 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -38,7 +38,7 @@ function displayPosition() { - <%= image_tag(@site.image_url, :class => 'site_image') %> + <%= image_tag(@site.image.url, :class => 'site_image') %>

<%= @site.name %>

diff --git a/app/views/sites/show.html.erb~ b/app/views/sites/show.html.erb~ index 4942699..7e973e6 100755 --- a/app/views/sites/show.html.erb~ +++ b/app/views/sites/show.html.erb~ @@ -32,6 +32,12 @@ function displayPosition() {

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

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

<%= @site.name %>

diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb index d8c5b00..d7abf6c 100755 --- a/app/views/trips/_trip.html.erb +++ b/app/views/trips/_trip.html.erb @@ -3,7 +3,7 @@ <% trip.visits.order(:hour).each do |visit| %> diff --git a/app/views/sites/index.html.erb~ b/app/views/sites/index.html.erb~ index aa866fd..29e98df 100755 --- a/app/views/sites/index.html.erb~ +++ b/app/views/sites/index.html.erb~ @@ -6,7 +6,7 @@ + + + + <%= link_to image_tag(visit.site.image.url, :class => 'list_image'), visit.site %> + + +
<%= comentario.user.name if comentario.user %>
-
<%= link_to comentario.site.name, comentario.site if comentario.site%>
+ +
<%= comentario.user.name if comentario.user %>
<%= comentario.coment %>
<% if comentario.user == current_user %> diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index 2287d2c..6f55b9e 100755 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -1,5 +1,5 @@
-

Listing Sites

+

Sites

<% @sites.each do |site| %> diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb index e761359..91a22f7 100755 --- a/app/views/types/index.html.erb +++ b/app/views/types/index.html.erb @@ -1,5 +1,5 @@
-

Listing Types

+

Types

<% @types.each do |type| %> diff --git a/db/migrate/20120320100145_create_sites.rb~ b/db/migrate/20120320100145_create_sites.rb~ new file mode 100755 index 0000000..f9472ad --- /dev/null +++ b/db/migrate/20120320100145_create_sites.rb~ @@ -0,0 +1,15 @@ +class CreateSites < ActiveRecord::Migration + def change + create_table :sites do |t| + t.string :name + t.text :description + t.integer :type_id + t.string :image_url + t.float :longitud + t.float :latitud + t.integer :zoom + + t.timestamps + end + end +end diff --git a/db/migrate/20120418184242_site_geolocalization.rb b/db/migrate/20120418184242_site_geolocalization.rb new file mode 100644 index 0000000..8b1be68 --- /dev/null +++ b/db/migrate/20120418184242_site_geolocalization.rb @@ -0,0 +1,25 @@ +class SiteGeolocalization < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :latitud, :float + end + change_table :sites do |t| + t.column :longitud, :float + end + change_table :sites do |t| + t.column :zoom, :integer + end + end + + def down + change_table :sites do |t| + t.remove :latitud + end + change_table :sites do |t| + t.remove :longitud + end + change_table :sites do |t| + t.remove :zoom + end + end +end diff --git a/db/migrate/20120418184242_site_geolocalization.rb~ b/db/migrate/20120418184242_site_geolocalization.rb~ new file mode 100644 index 0000000..c4adf15 --- /dev/null +++ b/db/migrate/20120418184242_site_geolocalization.rb~ @@ -0,0 +1,19 @@ +class SiteGeolocalization < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :latitud, :float + change_table :sites do |t| + t.column :longitud, :float + change_table :sites do |t| + t.column :zoom, :integer + end + + def down + change_table :sites do |t| + t.remove :latitud + change_table :sites do |t| + t.remove :longitud + change_table :sites do |t| + t.remove :zoom + end +end diff --git a/db/schema.rb b/db/schema.rb index 9999bd6..bed3780 100755 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120410235356) do +ActiveRecord::Schema.define(:version => 20120418184242) do create_table "comentarios", :force => true do |t| t.string "coment" @@ -29,6 +29,9 @@ t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.integer "user_id" + t.float "latitud" + t.float "longitud" + t.integer "zoom" end create_table "trips", :force => true do |t| From 810672251e792ac3145d7c66e8b208cd5946aaee Mon Sep 17 00:00:00 2001 From: Merlin Date: Thu, 19 Apr 2012 13:51:33 +0200 Subject: [PATCH 09/15] =?UTF-8?q?Arreglado=20Google=20Maps,=20a=C3=B1adido?= =?UTF-8?q?=20a=20la=20vista=20de=20Site=20y=20aplicado=20estilo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/planet.css | 7 ++ app/assets/stylesheets/planet.css~ | 7 ++ app/views/layouts/application.html.erb | 1 + app/views/layouts/application.html.erb~ | 7 +- app/views/sites/_form.html.erb | 40 ++++++++++ app/views/sites/_form.html.erb~ | 76 +++++++++++++++++++ app/views/sites/show.html.erb | 40 +++++++++- app/views/sites/show.html.erb~ | 38 +++++++++- .../20120418184242_site_geolocalization.rb | 0 .../20120418184242_site_geolocalization.rb~ | 0 10 files changed, 207 insertions(+), 9 deletions(-) create mode 100755 app/views/sites/_form.html.erb~ mode change 100644 => 100755 db/migrate/20120418184242_site_geolocalization.rb mode change 100644 => 100755 db/migrate/20120418184242_site_geolocalization.rb~ diff --git a/app/assets/stylesheets/planet.css b/app/assets/stylesheets/planet.css index 4b7f07e..d7f5f42 100755 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -172,3 +172,10 @@ font-weight: bold; margin-right: 2em; } + +#map_canvas { + width: 300px; + height: 300px; + float: right; + margin-right: 100px; +} diff --git a/app/assets/stylesheets/planet.css~ b/app/assets/stylesheets/planet.css~ index c431836..f6d6c69 100755 --- a/app/assets/stylesheets/planet.css~ +++ b/app/assets/stylesheets/planet.css~ @@ -116,6 +116,7 @@ } #bottom { + padding: 1em; text-align: center; } @@ -171,3 +172,9 @@ font-weight: bold; margin-right: 2em; } + +#map_canvas { + width: 300px; + height: 300px; + float: right; +} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index ce97058..b9e5b7e 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -12,6 +12,7 @@ }); + diff --git a/app/views/layouts/application.html.erb~ b/app/views/layouts/application.html.erb~ index abb6345..b9e5b7e 100755 --- a/app/views/layouts/application.html.erb~ +++ b/app/views/layouts/application.html.erb~ @@ -8,10 +8,11 @@ + @@ -34,7 +35,6 @@ <%= link_to "Tipos", types_path %>
<%= link_to "Sitios", sites_path %>
<%= link_to "Viajes", trips_path %>
- <%= link_to "Comentarios", comentarios_path %>
<%= link_to "Autor", planet_autor_path %>
<%= link_to "Contact", planet_contact_path %>
<%= link_to "Sign up", new_user_registration_path if !current_user %> @@ -47,8 +47,7 @@ <%= link_to "Home", planet_index_path %> | <%= link_to "Tipos", types_path %> | <%= link_to "Sitios", sites_path %> | - <%= link_to "Viajes", trips_path %> | - <%= link_to "Comentarios", comentarios_path %> | + <%= link_to "Viajes", trips_path %> | <%= link_to "Autor", planet_autor_path %> | <%= link_to "Contact", planet_contact_path %> | <%= link_to "Sign up", new_user_registration_path if !current_user %> diff --git a/app/views/sites/_form.html.erb b/app/views/sites/_form.html.erb index abc9fec..4471393 100755 --- a/app/views/sites/_form.html.erb +++ b/app/views/sites/_form.html.erb @@ -11,6 +11,34 @@ <% end %> + + + + +
<%= f.label :name %>
<%= f.text_field :name %> @@ -27,6 +55,18 @@ <%= f.label :image_url %>
<%= f.text_field :image_url %>
+
+ <%= f.label :latitud %>
+ <%= f.text_field :latitud %> +
+
+ <%= f.label :longitud %>
+ <%= f.text_field :longitud %> +
+
+ <%= f.label :zoom %>
+ <%= f.text_field :zoom %> +
<%= f.submit %>
diff --git a/app/views/sites/_form.html.erb~ b/app/views/sites/_form.html.erb~ new file mode 100755 index 0000000..52ccafc --- /dev/null +++ b/app/views/sites/_form.html.erb~ @@ -0,0 +1,76 @@ +<%= form_for(@site) do |f| %> + <% if @site.errors.any? %> +
+

<%= pluralize(@site.errors.count, "error") %> prohibited this site from being saved:

+ +
    + <% @site.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + + + + + + +
+ <%= f.label :name %>
+ <%= f.text_field :name %> +
+
+ <%= f.label :description %>
+ <%= f.text_area :description , :rows => 4 %> +
+
+ <%= f.label :type_id %>
+ <%= f.collection_select(:type_id, Type.find(:all, :order => :name), :id, :name) %> +
+
+ <%= f.label :image_url %>
+ <%= f.text_field :image_url %> +
+
+ <%= f.label :latitud %>
+ <%= f.text_field :latitud %> +
+
+ <%= f.label :longitud %>
+ <%= f.text_field :longitud %> +
+
+ <%= f.label :zoom %>
+ <%= f.text_field :zoom %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index b305f61..7e973e6 100755 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -1,7 +1,43 @@ + + + + +

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

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

<%= @site.name %>

@@ -14,7 +50,9 @@

<%= (link_to 'Comentarios >>', site_comentarios_path(@site.id)) if (@site.comentarios.size > 0) %>

<%= link_to 'Añadir Comentario', new_comentario_path %> -


+ + +

<% if @site.user == current_user %> diff --git a/app/views/sites/show.html.erb~ b/app/views/sites/show.html.erb~ index 14f4bcf..4942699 100755 --- a/app/views/sites/show.html.erb~ +++ b/app/views/sites/show.html.erb~ @@ -1,3 +1,33 @@ + + + + +

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

@@ -11,12 +41,12 @@

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

+

<%= (link_to 'Comentarios >>', site_comentarios_path(@site.id)) if (@site.comentarios.size > 0) %>

+

<%= link_to 'Añadir Comentario', new_comentario_path %> -

<%= link_to 'Comentarios >>', site_comentarios_path(@site.id) %>

- - +
- +

<% if @site.user == current_user %> diff --git a/db/migrate/20120418184242_site_geolocalization.rb b/db/migrate/20120418184242_site_geolocalization.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120418184242_site_geolocalization.rb~ b/db/migrate/20120418184242_site_geolocalization.rb~ old mode 100644 new mode 100755 From 364ed696fc0f5129d38e5ad8cd2282ebd374bcc9 Mon Sep 17 00:00:00 2001 From: Merlin Date: Fri, 20 Apr 2012 11:02:40 +0200 Subject: [PATCH 10/15] =?UTF-8?q?A=C3=B1adida=20foto=20de=20autor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/images/foto.png | Bin 0 -> 18952 bytes app/assets/stylesheets/planet.css | 5 +++++ app/assets/stylesheets/planet.css~ | 7 +++++++ app/views/planet/autor.html.erb | 29 +++++++++++++++++++++------- app/views/planet/autor.html.erb~ | 27 +++++++++++++++++++++----- app/views/sites/_form.html.erb | 27 -------------------------- app/views/sites/_form.html.erb~ | 3 --- app/views/sites/new.html.erb | 30 +++++++++++++++++++++++++++++ app/views/sites/new.html.erb~ | 5 +++++ 9 files changed, 91 insertions(+), 42 deletions(-) create mode 100644 app/assets/images/foto.png create mode 100755 app/views/sites/new.html.erb~ diff --git a/app/assets/images/foto.png b/app/assets/images/foto.png new file mode 100644 index 0000000000000000000000000000000000000000..b3d8db1f42981bdb8ef3ca759ccf9373b4ff6c2b GIT binary patch literal 18952 zcmXt=dpMK-|Hp5KvJfLN5=O;B3_0hp9G7S-WOB;+OwMOAhmR)3oQKd-PL)ICSk#=) zta6saa+ve^_}ll7-}}1m-Pg5$cD?WS{W?8gkJtWtV5obMnU5I&fQ$NiT4>tcigsCo z=xLvw&#ahew+mi+W--R&iPY@gZN zd-ync`mQlFs{w!zps%I*D3G99Z&qqg@uTeZObPS_u6^BlU|h4rUD7UW_SXQJ216xZ zH?J65XT0)^3B*UYnJoYO#|8R1sFZ#rKsWlI?fXkr6BGV5=8|2T8eg^b)AUf+v`sFT zD2{k}P8{Th^xkRB-BX~BcAc01v~IP0^szcz@VIg6Y^`Z?#L7iJTN~wU`{j#3 z`0Uw9I;GD-Ogr(y(b`$tS(HyxL)~W2*?L({oOyrd$wXs^9opEq^3Snn_*x!&T&ri; zvbnKw^%%8HFyi9FoWaF*S@7h9%M77{}ZWATya3d9ue;!x&1 z;4HzD6L$6e>D_KO%IQfxnXhcePR6}vENbc#;NTqYH7<(9q8=GPmAiV-WCXia%n5Lv z@42R*BKH%bV1BW03y(&^7`?OJX^w*tKpY5)%-l)5CwtG;wA|t@(7mV3(^uB#KgI} zoYnF1_je*Z_`THpaVupt&5r_57NBh;To~Lu7iHhNSj%$}|L0hj?#XujrpR4GG{C3AjGbmJsq*o{8E z1QUxY%~{^zt{NC}=DhtByY8E;%#G@Hg*2)B;h)`QqSgtsstI zRmCuB^)Ip3KGm==XB*3|1P)fHSl9TLqV1zAh4{C4W$Uiu7Rs&iuo;$*rDf#}>*HHp z;w2FW)aLezakDG2Gh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heets/planet.css b/app/assets/stylesheets/planet.css index d7f5f42..c0b7953 100755 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -179,3 +179,8 @@ float: right; margin-right: 100px; } + +#author-photo { + float: right; + margin-right: 100px; +} diff --git a/app/assets/stylesheets/planet.css~ b/app/assets/stylesheets/planet.css~ index f6d6c69..464074a 100755 --- a/app/assets/stylesheets/planet.css~ +++ b/app/assets/stylesheets/planet.css~ @@ -177,4 +177,11 @@ width: 300px; height: 300px; float: right; + margin-right: 100px; +} + +#author-photo { + float: left; + position: absolute; + margin-left: 500px; } diff --git a/app/views/planet/autor.html.erb b/app/views/planet/autor.html.erb index e52f8a3..a92ea14 100755 --- a/app/views/planet/autor.html.erb +++ b/app/views/planet/autor.html.erb @@ -1,8 +1,23 @@ -

Autor

-

-

    -
  • Raul de Pablos Martin
  • -
  • Estudiante de la ETSI Telecomunicacion
  • -
  • raulmerlin@gmail.com
  • +

    + Autor

    +
    <%= image_tag('foto.png') %>
      +
    • + Raul de Pablos Martin +
        +
      • + Estudiante de la ETSI Telecomunicacion +
          +
        • + 4º Curso
        • +
        • + Estudiante de SWCM
        • +
        +
      • +
      • + raulmerlin@gmail.com
      • +
      +
    -

    +

    +  

    + diff --git a/app/views/planet/autor.html.erb~ b/app/views/planet/autor.html.erb~ index 386265a..b015be3 100755 --- a/app/views/planet/autor.html.erb~ +++ b/app/views/planet/autor.html.erb~ @@ -1,6 +1,23 @@ -

    Autor

    -

    -

      -
    • Raul de Pablos Martin
    • +

      + Autor

      +<%= image_tag('foto.png') %>
        +
      • + Raul de Pablos Martin +
          +
        • + Estudiante de la ETSI Telecomunicacion +
            +
          • + 4º Curso
          • +
          • + Estudiante de SWCM
          • +
          +
        • +
        • + raulmerlin@gmail.com
        • +
        +
      -

      +

      +  

      + diff --git a/app/views/sites/_form.html.erb b/app/views/sites/_form.html.erb index 4471393..21b015e 100755 --- a/app/views/sites/_form.html.erb +++ b/app/views/sites/_form.html.erb @@ -12,33 +12,6 @@ <% end %> - - - -
      <%= f.label :name %>
      <%= f.text_field :name %> diff --git a/app/views/sites/_form.html.erb~ b/app/views/sites/_form.html.erb~ index 52ccafc..4471393 100755 --- a/app/views/sites/_form.html.erb~ +++ b/app/views/sites/_form.html.erb~ @@ -27,9 +27,6 @@ function displayPosition(pos) { var mylat = pos.coords.latitude; var mylong = pos.coords.longitude; - //var thediv = document.getElementById('locationinfo'); - //thediv.innerHTML = '

      Your longitude is :' + - //mylong + ' and your latitide is ' + mylat + '

      '; oFormObject = document.forms['new_site']; oFormObject.elements["site_longitud"].value = mylong; oFormObject.elements["site_latitud"].value = mylat; diff --git a/app/views/sites/new.html.erb b/app/views/sites/new.html.erb index 2988bdc..d3bd110 100755 --- a/app/views/sites/new.html.erb +++ b/app/views/sites/new.html.erb @@ -1,3 +1,33 @@ + + + + + + +

      New site

      <%= render 'form' %> diff --git a/app/views/sites/new.html.erb~ b/app/views/sites/new.html.erb~ new file mode 100755 index 0000000..2988bdc --- /dev/null +++ b/app/views/sites/new.html.erb~ @@ -0,0 +1,5 @@ +

      New site

      + +<%= render 'form' %> + +<%= link_to 'Back', sites_path %> From 5e7887e166b31c94e713b95408354c8126fdfc7b Mon Sep 17 00:00:00 2001 From: Merlin Date: Sun, 22 Apr 2012 01:01:39 +0200 Subject: [PATCH 11/15] Creado link de ordenacion de tipos, actualizado autores y conteo de inclusiones de sitio --- app/assets/images/foto.png | Bin app/controllers/types_controller.rb | 12 ++++ app/controllers/types_controller.rb~ | 83 ++++++++++++++++++++++++ app/views/layouts/application.html.erb | 8 +-- app/views/planet/autor.html.erb | 26 +++++++- app/views/planet/autor.html.erb~ | 28 ++++++-- app/views/sites/index.html.erb | 1 + app/views/sites/index.html.erb~ | 5 +- app/views/types/index.html.erb | 6 +- app/views/types/index.html.erb~ | 32 +++++++++ app/views/types/ordered_index.html.erb | 32 +++++++++ app/views/types/ordered_index.html.erb~ | 32 +++++++++ config/routes.rb | 4 +- config/routes.rb~ | 2 + 14 files changed, 255 insertions(+), 16 deletions(-) mode change 100644 => 100755 app/assets/images/foto.png create mode 100755 app/controllers/types_controller.rb~ create mode 100755 app/views/types/index.html.erb~ create mode 100755 app/views/types/ordered_index.html.erb create mode 100755 app/views/types/ordered_index.html.erb~ diff --git a/app/assets/images/foto.png b/app/assets/images/foto.png old mode 100644 new mode 100755 diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb index da826f4..0b0457c 100755 --- a/app/controllers/types_controller.rb +++ b/app/controllers/types_controller.rb @@ -10,6 +10,18 @@ def index end end + # GET /types + # GET /types.json + def ordered_index + @types = Type.find(:all,:order=>:name) + + respond_to do |format| + format.html # ordered_index.html.erb + format.json { render json: @types } + end + end + + # GET /types/1 # GET /types/1.json def show diff --git a/app/controllers/types_controller.rb~ b/app/controllers/types_controller.rb~ new file mode 100755 index 0000000..da826f4 --- /dev/null +++ b/app/controllers/types_controller.rb~ @@ -0,0 +1,83 @@ +class TypesController < ApplicationController + # GET /types + # GET /types.json + def index + @types = Type.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @types } + end + end + + # GET /types/1 + # GET /types/1.json + def show + @type = Type.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @type } + end + end + + # GET /types/new + # GET /types/new.json + def new + @type = Type.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @type } + end + end + + # GET /types/1/edit + def edit + @type = Type.find(params[:id]) + end + + # POST /types + # POST /types.json + def create + @type = Type.new(params[:type]) + + respond_to do |format| + if @type.save + format.html { redirect_to @type, notice: 'Type was successfully created.' } + format.json { render json: @type, status: :created, location: @type } + else + format.html { render action: "new" } + format.json { render json: @type.errors, status: :unprocessable_entity } + end + end + end + + # PUT /types/1 + # PUT /types/1.json + def update + @type = Type.find(params[:id]) + + respond_to do |format| + if @type.update_attributes(params[:type]) + format.html { redirect_to @type, notice: 'Type was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @type.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /types/1 + # DELETE /types/1.json + def destroy + @type = Type.find(params[:id]) + @type.destroy + + respond_to do |format| + format.html { redirect_to types_url } + format.json { head :no_content } + end + end +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b9e5b7e..696ceb2 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -35,8 +35,8 @@ <%= link_to "Tipos", types_path %>
      <%= link_to "Sitios", sites_path %>
      <%= link_to "Viajes", trips_path %>
      - <%= link_to "Autor", planet_autor_path %>
      - <%= link_to "Contact", planet_contact_path %>
      + <%= link_to "Autores", planet_autor_path %>
      + <%= link_to "Contacto", planet_contact_path %>
      <%= link_to "Sign up", new_user_registration_path if !current_user %>
      @@ -48,8 +48,8 @@ <%= link_to "Tipos", types_path %> | <%= link_to "Sitios", sites_path %> | <%= link_to "Viajes", trips_path %> | - <%= link_to "Autor", planet_autor_path %> | - <%= link_to "Contact", planet_contact_path %> | + <%= link_to "Autores", planet_autor_path %> | + <%= link_to "Contacto", planet_contact_path %> | <%= link_to "Sign up", new_user_registration_path if !current_user %>
      diff --git a/app/views/planet/autor.html.erb b/app/views/planet/autor.html.erb index a92ea14..ac0f4c9 100755 --- a/app/views/planet/autor.html.erb +++ b/app/views/planet/autor.html.erb @@ -1,6 +1,8 @@ +

      - Autor

      + Autores
      <%= image_tag('foto.png') %>
        +
        • Raul de Pablos Martin
            @@ -9,14 +11,32 @@
            • 4º Curso
            • -
            • - Estudiante de SWCM
            +
          • + Aficiones: Tecnología, deporte, música y motos.
          • raulmerlin@gmail.com
        • +

        +
          +
        • + Rubén Valero García +
            +
          • + Estudiante de la ETSI Telecomunicación +
              +
            • + 4º Curso
            • +
            +
          • +
          • + Aficiones: Música
          • +
          • + rubevalero@gmail.com
          • +
          +

         

        diff --git a/app/views/planet/autor.html.erb~ b/app/views/planet/autor.html.erb~ index b015be3..0b2b066 100755 --- a/app/views/planet/autor.html.erb~ +++ b/app/views/planet/autor.html.erb~ @@ -1,6 +1,8 @@ +

        - Autor

        -<%= image_tag('foto.png') %>
          + Autores +
          <%= image_tag('foto.png') %>
            +
            • Raul de Pablos Martin
                @@ -9,15 +11,33 @@
                • 4º Curso
                • -
                • - Estudiante de SWCM
                +
              • + Aficiones: Tecnología, deporte, música y motos.
              • raulmerlin@gmail.com
            +
              +
            • + Rubén Valero García +
                +
              • + Estudiante de la ETSI Telecomunicación +
                  +
                • + 4º Curso
                • +
                +
              • +
              • + Aficiones: Música
              • +
              • + rubevalero@gmail.com
              • +
              +
            • +

             

            diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index 6f55b9e..aa866fd 100755 --- 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.size %> viajes
            <%= (link_to 'comentarios >>', site_comentarios_path(site.id)) if (site.comentarios.size > 0) %>
            diff --git a/app/views/sites/index.html.erb~ b/app/views/sites/index.html.erb~ index ca1096e..a90fb1f 100755 --- a/app/views/sites/index.html.erb~ +++ b/app/views/sites/index.html.erb~ @@ -1,5 +1,5 @@
            -

            Listing Sites

            +

            Sites

<% @sites.each do |site| %> @@ -14,7 +14,8 @@
<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
-
<%= link_to 'comentarios >>', site_comentarios_path(site.id) %>
+
<%= (link_to 'comentarios >>', site_comentarios_path(site.id)) if (site.comentarios.size > 0) %>
+
Incluido en <%= site.visits.size %> viajes
diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb index 91a22f7..17d2a89 100755 --- a/app/views/types/index.html.erb +++ b/app/views/types/index.html.erb @@ -9,7 +9,7 @@
<%= link_to type.name, type_sites_path(type) %>
<%= truncate(strip_tags(type.description), - :length => 80) %>
+ :length => 80) %>
Modificado el: <%= type.updated_at %>
@@ -27,4 +27,6 @@
-<%= link_to 'New Type', new_type_path %> +<%= link_to 'New Type', new_type_path %> | +<%= link_to 'Order By Name', types_ordered_index_path %> | +<%= link_to 'Order By Creation', types_path %> diff --git a/app/views/types/index.html.erb~ b/app/views/types/index.html.erb~ new file mode 100755 index 0000000..a8cdc63 --- /dev/null +++ b/app/views/types/index.html.erb~ @@ -0,0 +1,32 @@ +
+

Types

+ +
+ <% @types.each do |type| %> + + + + + + + <% end %> +
+
+
<%= link_to type.name, type_sites_path(type) %>
+
<%= truncate(strip_tags(type.description), + :length => 80) %>
Modificado el: <%= type.updated_at %>
+
+
+ <%= link_to 'Show', type %>
+ <%= link_to 'Edit', edit_type_path(type) %>
+ <%= link_to 'Destroy', type, + :confirm => 'Are you sure?', + :method => :delete %> +
+
+ +
+ +<%= link_to 'New Type', new_type_path %> | +<%= link_to 'Order By Name', types_ordered_index_path %> | +<%= link_to 'Order By Creation', types_index_path %> diff --git a/app/views/types/ordered_index.html.erb b/app/views/types/ordered_index.html.erb new file mode 100755 index 0000000..17d2a89 --- /dev/null +++ b/app/views/types/ordered_index.html.erb @@ -0,0 +1,32 @@ +
+

Types

+ + + <% @types.each do |type| %> + + + + + + + <% end %> +
+
+
<%= link_to type.name, type_sites_path(type) %>
+
<%= truncate(strip_tags(type.description), + :length => 80) %>
Modificado el: <%= type.updated_at %>
+
+
+ <%= link_to 'Show', type %>
+ <%= link_to 'Edit', edit_type_path(type) %>
+ <%= link_to 'Destroy', type, + :confirm => 'Are you sure?', + :method => :delete %> +
+
+ +
+ +<%= link_to 'New Type', new_type_path %> | +<%= link_to 'Order By Name', types_ordered_index_path %> | +<%= link_to 'Order By Creation', types_path %> diff --git a/app/views/types/ordered_index.html.erb~ b/app/views/types/ordered_index.html.erb~ new file mode 100755 index 0000000..a8cdc63 --- /dev/null +++ b/app/views/types/ordered_index.html.erb~ @@ -0,0 +1,32 @@ +
+

Types

+ + + <% @types.each do |type| %> + + + + + + + <% end %> +
+
+
<%= link_to type.name, type_sites_path(type) %>
+
<%= truncate(strip_tags(type.description), + :length => 80) %>
Modificado el: <%= type.updated_at %>
+
+
+ <%= link_to 'Show', type %>
+ <%= link_to 'Edit', edit_type_path(type) %>
+ <%= link_to 'Destroy', type, + :confirm => 'Are you sure?', + :method => :delete %> +
+
+ +
+ +<%= link_to 'New Type', new_type_path %> | +<%= link_to 'Order By Name', types_ordered_index_path %> | +<%= link_to 'Order By Creation', types_index_path %> diff --git a/config/routes.rb b/config/routes.rb index eafeb87..90f3acd 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,6 +10,8 @@ resources :sites + get "types/ordered_index" + resources :types do # Rutas anidadas /types/id/sites..., resources :sites, :only => [ :index ] # Restringe a acción “index” end @@ -17,7 +19,7 @@ resources :sites do # Rutas anidadas /types/id/sites..., resources :comentarios, :only => [ :index ] # Restringe a acción “index” end - + get "planet/index" get "planet/contact" diff --git a/config/routes.rb~ b/config/routes.rb~ index eafeb87..c3d1723 100755 --- a/config/routes.rb~ +++ b/config/routes.rb~ @@ -18,6 +18,8 @@ Planet::Application.routes.draw do resources :comentarios, :only => [ :index ] # Restringe a acción “index” end + get "types/ordered_index" + get "planet/index" get "planet/contact" From a699180ffe6c002b24ebad17e907c3f72f91e01a Mon Sep 17 00:00:00 2001 From: Merlin Date: Sun, 22 Apr 2012 01:33:40 +0200 Subject: [PATCH 12/15] =?UTF-8?q?A=C3=B1adido=20Paperclip=20para=20la=20su?= =?UTF-8?q?bida=20de=20imagenes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +++ app/models/site.rb | 3 +- app/models/site.rb~ | 1 + app/views/sites/index.html.erb | 2 +- app/views/sites/index.html.erb~ | 2 +- app/views/sites/show.html.erb | 2 +- app/views/sites/show.html.erb~ | 6 ++++ app/views/trips/_trip.html.erb | 2 +- app/views/trips/_trip.html.erb~ | 29 +++++++++++++++++++ app/views/types/_form.html.erb | 4 +++ app/views/types/_form.html.erb~ | 29 +++++++++++++++++++ .../20120421232359_add_paperclip_to_sites.rb | 20 +++++++++++++ .../20120421232359_add_paperclip_to_sites.rb~ | 4 +++ db/schema.rb | 10 +++++-- 14 files changed, 110 insertions(+), 8 deletions(-) create mode 100755 app/views/trips/_trip.html.erb~ create mode 100755 app/views/types/_form.html.erb~ create mode 100644 db/migrate/20120421232359_add_paperclip_to_sites.rb create mode 100644 db/migrate/20120421232359_add_paperclip_to_sites.rb~ diff --git a/.gitignore b/.gitignore index 28a4c21..e751592 100755 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,7 @@ # ignore al .DS_store files of MAC OSX .DS_Store + +# ignore paperclip installation files +public/system +.project diff --git a/app/models/site.rb b/app/models/site.rb index 54ca9d0..39848d4 100755 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -4,11 +4,12 @@ class Site < ActiveRecord::Base has_many :visits has_many :trips, :through => :visits has_many :comentarios + has_attached_file :image # Debe estar protegido para evitar accesos indeseados attr_protected :user_id # Se añaden estas definiciones - validates :name, :type_id, :image_url, :presence => true # campo obligatorio + validates :name, :type_id, :presence => true # campo obligatorio end diff --git a/app/models/site.rb~ b/app/models/site.rb~ index 7a3bd34..54ca9d0 100755 --- a/app/models/site.rb~ +++ b/app/models/site.rb~ @@ -3,6 +3,7 @@ class Site < ActiveRecord::Base belongs_to :user has_many :visits has_many :trips, :through => :visits + has_many :comentarios # Debe estar protegido para evitar accesos indeseados diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index aa866fd..29e98df 100755 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -6,7 +6,7 @@
- <%= link_to image_tag(site.image_url, :class => 'list_image'), site %> + <%= link_to image_tag(site.image.url, :class => 'list_image'), site %> diff --git a/app/views/sites/index.html.erb~ b/app/views/sites/index.html.erb~ index a90fb1f..aa866fd 100755 --- a/app/views/sites/index.html.erb~ +++ b/app/views/sites/index.html.erb~ @@ -14,8 +14,8 @@
<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
-
<%= (link_to 'comentarios >>', site_comentarios_path(site.id)) if (site.comentarios.size > 0) %>
Incluido en <%= site.visits.size %> viajes
+
<%= (link_to 'comentarios >>', site_comentarios_path(site.id)) if (site.comentarios.size > 0) %>
- <%= link_to image_tag(visit.site.image_url, :class => 'list_image'), visit.site %> + <%= link_to image_tag(visit.site.image.url, :class => 'list_image'), visit.site %> diff --git a/app/views/trips/_trip.html.erb~ b/app/views/trips/_trip.html.erb~ new file mode 100755 index 0000000..d8c5b00 --- /dev/null +++ b/app/views/trips/_trip.html.erb~ @@ -0,0 +1,29 @@ +
+ + <% trip.visits.order(:hour).each do |visit| %> + + + + + + + + <% end %> +
+ <%= link_to image_tag(visit.site.image_url, :class => 'list_image'), visit.site %> + +
+
<%= visit.hour.to_s + 'h: ' %> + <%=link_to(visit.site.name, visit.site) %>
+
<%= truncate(strip_tags(visit.site.description), + :length => 80) %>
+
+
+ <%= link_to 'Show', visit.site %>
+ <%= link_to 'Destroy', visit, + :confirm => 'Are you sure?', + :method => :delete if @trip.user == current_user %> + +
+
+ diff --git a/app/views/types/_form.html.erb b/app/views/types/_form.html.erb index 80284dd..deb2959 100755 --- a/app/views/types/_form.html.erb +++ b/app/views/types/_form.html.erb @@ -19,6 +19,10 @@ <%= f.label :description %>
<%= f.text_area :description, :rows => 4 %> +
+ <%= f.label :image %>
+ <%= f.file_field :image %> +
<%= f.submit %>
diff --git a/app/views/types/_form.html.erb~ b/app/views/types/_form.html.erb~ new file mode 100755 index 0000000..deb2959 --- /dev/null +++ b/app/views/types/_form.html.erb~ @@ -0,0 +1,29 @@ +<%= form_for(@type) do |f| %> + <% if @type.errors.any? %> +
+

<%= pluralize(@type.errors.count, "error") %> prohibited this type from being saved:

+ +
    + <% @type.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :name %>
+ <%= f.text_field :name %> +
+
+ <%= f.label :description %>
+ <%= f.text_area :description, :rows => 4 %> +
+
+ <%= f.label :image %>
+ <%= f.file_field :image %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/db/migrate/20120421232359_add_paperclip_to_sites.rb b/db/migrate/20120421232359_add_paperclip_to_sites.rb new file mode 100644 index 0000000..96de497 --- /dev/null +++ b/db/migrate/20120421232359_add_paperclip_to_sites.rb @@ -0,0 +1,20 @@ +class AddPaperclipToSites < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :image_file_name, :string + t.column :image_content_type, :string + t.column :image_file_size, :string + t.column :image_updated_at, :datetime + end + end + + def down + change_table :sites do |t| + t.remove :image_file_name, :string + t.remove :image_content_type, :string + t.remove :image_file_size, :string + t.remove :image_updated_at, :datetime + end + end + +end diff --git a/db/migrate/20120421232359_add_paperclip_to_sites.rb~ b/db/migrate/20120421232359_add_paperclip_to_sites.rb~ new file mode 100644 index 0000000..be845a8 --- /dev/null +++ b/db/migrate/20120421232359_add_paperclip_to_sites.rb~ @@ -0,0 +1,4 @@ +class AddPaperclipToSites < ActiveRecord::Migration + def change + end +end diff --git a/db/schema.rb b/db/schema.rb index bed3780..197b740 100755 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120418184242) do +ActiveRecord::Schema.define(:version => 20120421232359) do create_table "comentarios", :force => true do |t| t.string "coment" @@ -26,12 +26,16 @@ t.text "description" t.integer "type_id" t.string "image_url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "user_id" t.float "latitud" t.float "longitud" t.integer "zoom" + t.string "image_file_name" + t.string "image_content_type" + t.string "image_file_size" + t.datetime "image_updated_at" end create_table "trips", :force => true do |t| From c9af451d81aeb53546ec2feeb90e49848c6887fc Mon Sep 17 00:00:00 2001 From: Merlin Date: Sun, 22 Apr 2012 02:09:22 +0200 Subject: [PATCH 13/15] Actualizadas imagenes de sitios --- Gemfile | 2 ++ Gemfile.lock | 8 ++++++++ app/views/sites/_form.html.erb | 4 ++-- app/views/sites/_form.html.erb~ | 27 --------------------------- app/views/types/_form.html.erb | 4 ---- 5 files changed, 12 insertions(+), 33 deletions(-) diff --git a/Gemfile b/Gemfile index ca448a6..e8051e0 100755 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,8 @@ gem 'sqlite3' gem 'devise' +gem 'paperclip' + # Gems used only for assets and not required # in production environments by default. group :assets do diff --git a/Gemfile.lock b/Gemfile.lock index 36f623e..6247569 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,6 +32,7 @@ GEM bcrypt-ruby (3.0.1) builder (3.0.0) cleditor_rails (0.0.3) + cocaine (0.2.1) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) @@ -61,6 +62,12 @@ GEM mime-types (1.17.2) multi_json (1.1.0) orm_adapter (0.0.7) + paperclip (3.0.2) + activemodel (>= 3.0.0) + activerecord (>= 3.0.0) + activesupport (>= 3.0.0) + cocaine (>= 0.0.2) + mime-types polyglot (0.3.3) rack (1.4.1) rack-cache (1.2) @@ -117,6 +124,7 @@ DEPENDENCIES coffee-rails (~> 3.2.1) devise jquery-rails + paperclip rails (= 3.2.2) sass-rails (~> 3.2.3) sqlite3 diff --git a/app/views/sites/_form.html.erb b/app/views/sites/_form.html.erb index 21b015e..770e80f 100755 --- a/app/views/sites/_form.html.erb +++ b/app/views/sites/_form.html.erb @@ -25,8 +25,8 @@ <%= f.collection_select(:type_id, Type.find(:all, :order => :name), :id, :name) %>
- <%= f.label :image_url %>
- <%= f.text_field :image_url %> + <%= f.label :image %>
+ <%= f.file_field :image %>
<%= f.label :latitud %>
diff --git a/app/views/sites/_form.html.erb~ b/app/views/sites/_form.html.erb~ index 4471393..21b015e 100755 --- a/app/views/sites/_form.html.erb~ +++ b/app/views/sites/_form.html.erb~ @@ -12,33 +12,6 @@ <% end %> - - - -
<%= f.label :name %>
<%= f.text_field :name %> diff --git a/app/views/types/_form.html.erb b/app/views/types/_form.html.erb index deb2959..80284dd 100755 --- a/app/views/types/_form.html.erb +++ b/app/views/types/_form.html.erb @@ -19,10 +19,6 @@ <%= f.label :description %>
<%= f.text_area :description, :rows => 4 %>
-
- <%= f.label :image %>
- <%= f.file_field :image %> -
<%= f.submit %>
From b49f18763ded24b1ad61ec21546d9375ccd71365 Mon Sep 17 00:00:00 2001 From: Merlin Date: Wed, 25 Apr 2012 14:47:45 +0200 Subject: [PATCH 14/15] Generacion de mapas en viajes y revision hasta ejercicio 8 --- app/controllers/sites_controller.rb | 1 + app/controllers/sites_controller.rb~ | 96 +++++++++++++++++++ app/views/layouts/application.html.erb | 2 + app/views/layouts/application.html.erb~ | 10 +- app/views/sites/index.html.erb | 4 +- app/views/sites/index.html.erb~ | 2 +- app/views/sites/show.html.erb | 8 +- app/views/sites/show.html.erb~ | 12 ++- app/views/trips/_trip.html.erb | 6 +- app/views/trips/_trip.html.erb~ | 8 +- app/views/trips/show.html.erb | 29 +----- app/views/trips/show.html.erb~ | 1 + app/views/types/show.html.erb | 5 + app/views/types/show.html.erb~ | 20 ++++ .../20120421232359_add_paperclip_to_sites.rb | 0 .../20120421232359_add_paperclip_to_sites.rb~ | 0 db/migrate/20120425123554_site_visitas.rb | 13 +++ db/migrate/20120425123554_site_visitas.rb~ | 7 ++ db/schema.rb | 3 +- db/schema.rb~ | 85 ++++++++++++++++ 20 files changed, 270 insertions(+), 42 deletions(-) create mode 100755 app/controllers/sites_controller.rb~ create mode 100755 app/views/trips/show.html.erb~ create mode 100755 app/views/types/show.html.erb~ mode change 100644 => 100755 db/migrate/20120421232359_add_paperclip_to_sites.rb mode change 100644 => 100755 db/migrate/20120421232359_add_paperclip_to_sites.rb~ create mode 100644 db/migrate/20120425123554_site_visitas.rb create mode 100644 db/migrate/20120425123554_site_visitas.rb~ create mode 100755 db/schema.rb~ diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index ed3047d..453d537 100755 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -87,4 +87,5 @@ def destroy format.json { head :no_content } end end + end diff --git a/app/controllers/sites_controller.rb~ b/app/controllers/sites_controller.rb~ new file mode 100755 index 0000000..21b9709 --- /dev/null +++ b/app/controllers/sites_controller.rb~ @@ -0,0 +1,96 @@ +class SitesController < ApplicationController + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] + after_filter :count_visit, :only => :show + + # GET /sites + # GET /sites.json + def index + if params[:type_id].nil? or params[:type_id].empty? + @sites = Site.all # path: /types + else + @sites = Type.find(params[:type_id]).sites # path: /types/id/sites + end + respond_to do |format| + format.html # index.html.erb + format.json { render json: @sites } + end + end + + # GET /sites/1 + # GET /sites/1.json + def show + @site = Site.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @site } + end + end + + # GET /sites/new + # GET /sites/new.json + def new + @site = current_user.sites.build # crea sitio vacio asociado a current_user + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @site } + end + end + + # GET /sites/1/edit + def edit + @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user + end + + # POST /sites + # POST /sites.json + def create + @site = current_user.sites.build(params[:site]) # Asigna solo si sitio asociado a current_user + + respond_to do |format| + if @site.save + format.html { redirect_to @site, notice: 'Site was successfully created.' } + format.json { render json: @site, status: :created, location: @site } + else + format.html { render action: "new" } + format.json { render json: @site.errors, status: :unprocessable_entity } + end + end + end + + # PUT /sites/1 + # PUT /sites/1.json + def update + @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user + + respond_to do |format| + if @site.update_attributes(params[:site]) + format.html { redirect_to @site, notice: 'Site was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @site.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /sites/1 + # DELETE /sites/1.json + def destroy + @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user + @site.destroy + + respond_to do |format| + format.html { redirect_to sites_url } + format.json { head :no_content } + end + end + + private + def count_visit + @site.increment!(:visits) + end +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 696ceb2..cc90224 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -33,6 +33,7 @@
<%= link_to "Home", planet_index_path %>
<%= link_to "Tipos", types_path %>
+ <%= link_to "Sitios", sites_path %>
<%= link_to "Viajes", trips_path %>
<%= link_to "Autores", planet_autor_path %>
@@ -46,6 +47,7 @@
<%= link_to "Home", planet_index_path %> | <%= link_to "Tipos", types_path %> | + <%= link_to "Sitios", sites_path %> | <%= link_to "Viajes", trips_path %> | <%= link_to "Autores", planet_autor_path %> | diff --git a/app/views/layouts/application.html.erb~ b/app/views/layouts/application.html.erb~ index b9e5b7e..cc90224 100755 --- a/app/views/layouts/application.html.erb~ +++ b/app/views/layouts/application.html.erb~ @@ -33,10 +33,11 @@
<%= link_to "Home", planet_index_path %>
<%= link_to "Tipos", types_path %>
+ <%= link_to "Sitios", sites_path %>
<%= link_to "Viajes", trips_path %>
- <%= link_to "Autor", planet_autor_path %>
- <%= link_to "Contact", planet_contact_path %>
+ <%= link_to "Autores", planet_autor_path %>
+ <%= link_to "Contacto", planet_contact_path %>
<%= link_to "Sign up", new_user_registration_path if !current_user %>
@@ -46,10 +47,11 @@
<%= link_to "Home", planet_index_path %> | <%= link_to "Tipos", types_path %> | + <%= link_to "Sitios", sites_path %> | <%= link_to "Viajes", trips_path %> | - <%= link_to "Autor", planet_autor_path %> | - <%= link_to "Contact", planet_contact_path %> | + <%= link_to "Autores", planet_autor_path %> | + <%= link_to "Contacto", planet_contact_path %> | <%= link_to "Sign up", new_user_registration_path if !current_user %>
diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index 29e98df..ee41ed3 100755 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -14,8 +14,8 @@
<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
-
Incluido en <%= site.visits.size %> viajes
-
<%= (link_to 'comentarios >>', site_comentarios_path(site.id)) if (site.comentarios.size > 0) %>
+
Incluido en <%= site.visits.size %> viajes
+
<%= (link_to 'comentarios >>', site_comentarios_path(site.id)) if (site.comentarios.size > 0) %>
- <%= link_to image_tag(site.image_url, :class => 'list_image'), site %> + <%= link_to image_tag(site.image.url, :class => 'list_image'), site %> diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 34bda11..387cfd2 100755 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -44,12 +44,18 @@ function displayPosition() {

<%=sanitize @site.description %>

-

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

+ +
+ Visitas: <%= @site.visitas %> +
<%= (link_to 'Comentarios >>', site_comentarios_path(@site.id)) if (@site.comentarios.size > 0) %>

+

<%= link_to 'Añadir Comentario', new_comentario_path %> +
diff --git a/app/views/sites/show.html.erb~ b/app/views/sites/show.html.erb~ index 7e973e6..395adc2 100755 --- a/app/views/sites/show.html.erb~ +++ b/app/views/sites/show.html.erb~ @@ -38,18 +38,26 @@ function displayPosition() { - <%= image_tag(@site.image_url, :class => 'site_image') %> + <%= image_tag(@site.image.url, :class => 'site_image') %>

<%= @site.name %>

<%=sanitize @site.description %>

-

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

+ +
+ Visitas: <%= @site.visitas %> +
Incluido en <%= @site.visits.size %> viajes

+

<%= (link_to 'Comentarios >>', site_comentarios_path(@site.id)) if (@site.comentarios.size > 0) %>

+

<%= link_to 'Añadir Comentario', new_comentario_path %> +
diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb index d7abf6c..c8f84dd 100755 --- a/app/views/trips/_trip.html.erb +++ b/app/views/trips/_trip.html.erb @@ -4,8 +4,12 @@

<%= link_to image_tag(visit.site.image.url, :class => 'list_image'), visit.site %> -
<%= visit.hour.to_s + 'h: ' %> diff --git a/app/views/trips/_trip.html.erb~ b/app/views/trips/_trip.html.erb~ index d8c5b00..0830535 100755 --- a/app/views/trips/_trip.html.erb~ +++ b/app/views/trips/_trip.html.erb~ @@ -3,9 +3,13 @@ <% trip.visits.order(:hour).each do |visit| %>
- <%= link_to image_tag(visit.site.image_url, :class => 'list_image'), visit.site %> -
<%= visit.hour.to_s + 'h: ' %> diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 26176f0..9185d83 100755 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -1,28 +1 @@ -

Name: <%= @trip.name %>

Date: <%= @trip.date %>

- Autor: <%= @trip.user.name if @trip.user %> -

-

Description: <%= simple_format @trip.description %>

-
- -

Sitios a visitar

- - <%= render(@trip) %> - - <% if @trip.user == current_user %> - <%= form_for(@visit) do |f| %> - - <%= f.number_field :trip_id, :value => @trip.id, :hidden => true %> - <%= f.collection_select(:site_id, - Site.all, - :id, - :name) %> - <%= f.select(:hour, Array.new(24, 0).fill {|i| [(i.to_s + 'H'), i]}) %> - <%= f.submit "Añadir sitio" %> - <% end %> - <% end %> -
- -
- - <% if @trip.user == current_user %> <%= link_to 'Edit', edit_trip_path(@trip) %> | <% end %> <%= link_to 'Back', trips_path %> - \ No newline at end of file +

Name: <%= @trip.name %>

Date: <%= @trip.date %>

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

Description: <%= simple_format @trip.description %>

Sitios a visitar

<%= render(@trip) %> <% if @trip.user == current_user %> <%= form_for(@visit) do |f| %> <%= f.number_field :trip_id, :value => @trip.id, :hidden => true %> <%= f.collection_select(:site_id, Site.all, :id, :name) %> <%= f.select(:hour, Array.new(24, 0).fill {|i| [(i.to_s + 'H'), i]}) %> <%= f.submit "Añadir sitio" %> <% end %> <% end %>

<% if @trip.user == current_user %> <%= link_to 'Edit', edit_trip_path(@trip) %> | <% end %> <%= link_to 'Back', trips_path %> \ No newline at end of file diff --git a/app/views/trips/show.html.erb~ b/app/views/trips/show.html.erb~ new file mode 100755 index 0000000..de1a2d1 --- /dev/null +++ b/app/views/trips/show.html.erb~ @@ -0,0 +1 @@ +

Name: <%= @trip.name %>

Date: <%= @trip.date %>

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

Description: <%= simple_format @trip.description %>

Sitios a visitar

<%= render(@trip) %> <% if @trip.user == current_user %> <%= form_for(@visit) do |f| %> <%= f.number_field :trip_id, :value => @trip.id, :hidden => true %> <%= f.collection_select(:site_id, Site.all, :id, :name) %> <%= f.select(:hour, Array.new(24, 0).fill {|i| [(i.to_s + 'H'), i]}) %> <%= f.submit "Añadir sitio" %> <% end %> <% end %>

<% if @trip.user == current_user %> <%= link_to 'Edit', edit_trip_path(@trip) %> | <% end %> <%= link_to 'Back', trips_path %> \ No newline at end of file diff --git a/app/views/types/show.html.erb b/app/views/types/show.html.erb index 98b32e7..2f844e6 100755 --- a/app/views/types/show.html.erb +++ b/app/views/types/show.html.erb @@ -10,6 +10,11 @@ <%= @type.description %>

+

+ Last modified: + <%= @type.updated_at %> +

+ <%= link_to 'Edit', edit_type_path(@type) %> | <%= link_to 'Back', types_path %> diff --git a/app/views/types/show.html.erb~ b/app/views/types/show.html.erb~ new file mode 100755 index 0000000..38b3e3e --- /dev/null +++ b/app/views/types/show.html.erb~ @@ -0,0 +1,20 @@ +

<%= notice %>

+ +

+ Name: + <%= @type.name %> +

+ +

+ Description: + <%= @type.description %> +

+ +

+ Last modified on: + <%= @type.updated_at %> +

+ + +<%= link_to 'Edit', edit_type_path(@type) %> | +<%= link_to 'Back', types_path %> diff --git a/db/migrate/20120421232359_add_paperclip_to_sites.rb b/db/migrate/20120421232359_add_paperclip_to_sites.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120421232359_add_paperclip_to_sites.rb~ b/db/migrate/20120421232359_add_paperclip_to_sites.rb~ old mode 100644 new mode 100755 diff --git a/db/migrate/20120425123554_site_visitas.rb b/db/migrate/20120425123554_site_visitas.rb new file mode 100644 index 0000000..858d6ab --- /dev/null +++ b/db/migrate/20120425123554_site_visitas.rb @@ -0,0 +1,13 @@ +class SiteVisitas < ActiveRecord::Migration + def self.up + change_table :sites do |t| # añade la columna visits a la tabla sites + t.column :visitas, :integer, + end + end + + def self.down + change_table :sites do |t| + t.remove :visitas + end + end +end diff --git a/db/migrate/20120425123554_site_visitas.rb~ b/db/migrate/20120425123554_site_visitas.rb~ new file mode 100644 index 0000000..04e19a9 --- /dev/null +++ b/db/migrate/20120425123554_site_visitas.rb~ @@ -0,0 +1,7 @@ +class SiteVisitas < ActiveRecord::Migration + def up + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 197b740..733fde1 100755 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120421232359) do +ActiveRecord::Schema.define(:version => 20120425123554) do create_table "comentarios", :force => true do |t| t.string "coment" @@ -36,6 +36,7 @@ t.string "image_content_type" t.string "image_file_size" t.datetime "image_updated_at" + t.integer "visitas" end create_table "trips", :force => true do |t| diff --git a/db/schema.rb~ b/db/schema.rb~ new file mode 100755 index 0000000..733fde1 --- /dev/null +++ b/db/schema.rb~ @@ -0,0 +1,85 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20120425123554) do + + create_table "comentarios", :force => true do |t| + t.string "coment" + 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" + t.text "description" + t.integer "type_id" + t.string "image_url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + t.float "latitud" + t.float "longitud" + t.integer "zoom" + t.string "image_file_name" + t.string "image_content_type" + t.string "image_file_size" + t.datetime "image_updated_at" + t.integer "visitas" + end + + create_table "trips", :force => true do |t| + t.string "name" + t.text "description" + t.date "date" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "types", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "users", :force => true do |t| + t.string "email", :default => "", :null => false + t.string "encrypted_password", :default => "", :null => false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "name" + end + + add_index "users", ["email"], :name => "index_users_on_email", :unique => true + add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + + create_table "visits", :force => true do |t| + t.integer "trip_id" + t.integer "site_id" + t.integer "hour" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end From 7b1e67f256ecc666493433054822fef4e33ceae7 Mon Sep 17 00:00:00 2001 From: Merlin Date: Thu, 26 Apr 2012 00:27:15 +0200 Subject: [PATCH 15/15] Creado contador de visitas a sites --- app/controllers/sites_controller.rb | 7 +++++++ app/controllers/sites_controller.rb~ | 8 +++++--- app/views/sites/show.html.erb | 5 +++-- app/views/sites/show.html.erb~ | 6 ++---- db/migrate/20120425123554_site_visitas.rb | 4 ++-- db/migrate/20120425123554_site_visitas.rb~ | 10 ++++++++-- db/migrate/20120425184401_rm_site_visitas.rb | 10 ++++++++++ db/migrate/20120425184401_rm_site_visitas.rb~ | 7 +++++++ db/migrate/20120425184541_re_site_visitas.rb | 13 +++++++++++++ db/migrate/20120425184541_re_site_visitas.rb~ | 7 +++++++ db/schema.rb | 8 ++++---- 11 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 db/migrate/20120425184401_rm_site_visitas.rb create mode 100644 db/migrate/20120425184401_rm_site_visitas.rb~ create mode 100644 db/migrate/20120425184541_re_site_visitas.rb create mode 100644 db/migrate/20120425184541_re_site_visitas.rb~ diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 453d537..886db23 100755 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -2,6 +2,8 @@ class SitesController < ApplicationController # authenticate_user! ejecuta acción solo si sesión existe before_filter :authenticate_user!, :except => [ :index, :show ] + # Definimos un filtro que activa “count_visit” al finalizar la acción show. + after_filter :count_visita, :only => :show # GET /sites # GET /sites.json @@ -88,4 +90,9 @@ def destroy end end + private + def count_visita + @site.increment!(:visitas) + end + end diff --git a/app/controllers/sites_controller.rb~ b/app/controllers/sites_controller.rb~ index 21b9709..886db23 100755 --- a/app/controllers/sites_controller.rb~ +++ b/app/controllers/sites_controller.rb~ @@ -2,7 +2,8 @@ class SitesController < ApplicationController # authenticate_user! ejecuta acción solo si sesión existe before_filter :authenticate_user!, :except => [ :index, :show ] - after_filter :count_visit, :only => :show + # Definimos un filtro que activa “count_visit” al finalizar la acción show. + after_filter :count_visita, :only => :show # GET /sites # GET /sites.json @@ -90,7 +91,8 @@ class SitesController < ApplicationController end private - def count_visit - @site.increment!(:visits) + def count_visita + @site.increment!(:visitas) end + end diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 387cfd2..3ee4bb1 100755 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -48,8 +48,9 @@ function displayPosition() { <%= @site.user.name if @site.user %>

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

<%= (link_to 'Comentarios >>', site_comentarios_path(@site.id)) if (@site.comentarios.size > 0) %>

diff --git a/app/views/sites/show.html.erb~ b/app/views/sites/show.html.erb~ index 395adc2..4ffa641 100755 --- a/app/views/sites/show.html.erb~ +++ b/app/views/sites/show.html.erb~ @@ -48,10 +48,8 @@ function displayPosition() { <%= @site.user.name if @site.user %>

- Visitas: <%= @site.visitas %> -
Incluido en <%= @site.visits.size %> viajes

+ Visitas: +

<%= (link_to 'Comentarios >>', site_comentarios_path(@site.id)) if (@site.comentarios.size > 0) %>

diff --git a/db/migrate/20120425123554_site_visitas.rb b/db/migrate/20120425123554_site_visitas.rb index 858d6ab..4292789 100644 --- a/db/migrate/20120425123554_site_visitas.rb +++ b/db/migrate/20120425123554_site_visitas.rb @@ -1,7 +1,7 @@ class SiteVisitas < ActiveRecord::Migration def self.up - change_table :sites do |t| # añade la columna visits a la tabla sites - t.column :visitas, :integer, + change_table :sites do |t| # añade la columna visits a la tabla sites + t.column :visitas, :integer, :default => 0 end end diff --git a/db/migrate/20120425123554_site_visitas.rb~ b/db/migrate/20120425123554_site_visitas.rb~ index 04e19a9..b0abfb3 100644 --- a/db/migrate/20120425123554_site_visitas.rb~ +++ b/db/migrate/20120425123554_site_visitas.rb~ @@ -1,7 +1,13 @@ class SiteVisitas < ActiveRecord::Migration - def up + def self.up + change_table :sites do |t| # añade la columna visits a la tabla sites + t.column :visitas, :integer, end + end - def down + def self.down + change_table :sites do |t| + t.remove :visitas end + end end diff --git a/db/migrate/20120425184401_rm_site_visitas.rb b/db/migrate/20120425184401_rm_site_visitas.rb new file mode 100644 index 0000000..c56b5a4 --- /dev/null +++ b/db/migrate/20120425184401_rm_site_visitas.rb @@ -0,0 +1,10 @@ +class RmSiteVisitas < ActiveRecord::Migration + def self.up + change_table :sites do |t| + t.remove :visitas + end + end + + def self.down + end +end diff --git a/db/migrate/20120425184401_rm_site_visitas.rb~ b/db/migrate/20120425184401_rm_site_visitas.rb~ new file mode 100644 index 0000000..62ecf04 --- /dev/null +++ b/db/migrate/20120425184401_rm_site_visitas.rb~ @@ -0,0 +1,7 @@ +class RmSiteVisitas < ActiveRecord::Migration + def up + end + + def down + end +end diff --git a/db/migrate/20120425184541_re_site_visitas.rb b/db/migrate/20120425184541_re_site_visitas.rb new file mode 100644 index 0000000..f46fe80 --- /dev/null +++ b/db/migrate/20120425184541_re_site_visitas.rb @@ -0,0 +1,13 @@ +class ReSiteVisitas < ActiveRecord::Migration + def self.up + change_table :sites do |t| # añade la columna visits a la tabla sites + t.column :visitas, :integer, :default => 0 + end + end + + def self.down + change_table :sites do |t| + t.remove :visitas + end + end +end diff --git a/db/migrate/20120425184541_re_site_visitas.rb~ b/db/migrate/20120425184541_re_site_visitas.rb~ new file mode 100644 index 0000000..89019a0 --- /dev/null +++ b/db/migrate/20120425184541_re_site_visitas.rb~ @@ -0,0 +1,7 @@ +class ReSiteVisitas < ActiveRecord::Migration + def up + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 733fde1..6ffc7a4 100755 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120425123554) do +ActiveRecord::Schema.define(:version => 20120425184541) do create_table "comentarios", :force => true do |t| t.string "coment" @@ -26,8 +26,8 @@ t.text "description" t.integer "type_id" t.string "image_url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "user_id" t.float "latitud" t.float "longitud" @@ -36,7 +36,7 @@ t.string "image_content_type" t.string "image_file_size" t.datetime "image_updated_at" - t.integer "visitas" + t.integer "visitas", :default => 0 end create_table "trips", :force => true do |t|