From 967bebe58a6f68193e09c7c9fd657cdf74c093b5 Mon Sep 17 00:00:00 2001 From: Fran Gil Date: Thu, 22 Mar 2012 13:45:08 +0100 Subject: [PATCH 1/8] Primer intento de entrega 4 --- app/assets/images/alberto_contador.jpg | Bin 0 -> 24487 bytes app/assets/images/pizarro.jpg | Bin 0 -> 18156 bytes app/controllers/planet_controller.rb | 3 + app/controllers/planet_controller.rb~ | 11 +++ app/controllers/types_controller.rb | 11 +++ app/controllers/types_controller.rb~ | 96 +++++++++++++++++++ app/views/layouts/application.html.erb | 4 +- app/views/layouts/application.html.erb~ | 14 +++ app/views/planet/author.html.erb | 28 ++++++ app/views/planet/author.html.erb~ | 25 +++++ app/views/types/index.html.erb | 1 + app/views/types/index.html.erb~ | 26 +++++ app/views/types/index_ordenado.html.erb | 26 +++++ app/views/types/show.html.erb | 4 + app/views/types/show.html.erb~ | 15 +++ config/routes.rb | 4 + config/routes.rb~ | 70 ++++++++++++++ test/unit/helpers/planet_controller_test.rb | 17 ++++ test/unit/helpers/planet_controller_test.rb~ | 17 ++++ 19 files changed, 370 insertions(+), 2 deletions(-) create mode 100644 app/assets/images/alberto_contador.jpg create mode 100644 app/assets/images/pizarro.jpg create mode 100644 app/controllers/planet_controller.rb~ create mode 100644 app/controllers/types_controller.rb~ create mode 100644 app/views/layouts/application.html.erb~ create mode 100644 app/views/planet/author.html.erb create mode 100644 app/views/planet/author.html.erb~ create mode 100644 app/views/types/index.html.erb~ create mode 100644 app/views/types/index_ordenado.html.erb create mode 100644 app/views/types/show.html.erb~ create mode 100644 config/routes.rb~ create mode 100644 test/unit/helpers/planet_controller_test.rb create mode 100644 test/unit/helpers/planet_controller_test.rb~ diff --git a/app/assets/images/alberto_contador.jpg b/app/assets/images/alberto_contador.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cb6d270d886e9ef6460a40c6ec38a8d9c45ecac3 GIT binary patch literal 24487 zcmbTdbx>SS5H7k%a0!+mi*IlU?(XjH?jgY9?vQ0!EZE|%3&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c4w+I$Pbzcz@MkzQe^>lfY}{{Vz` zNTqq!@+q!wA&=(s6{N=EzQ7Vbm96n^_DJ;oI?g|pCXu9neW5@fn`iK*Zv&WUrkAvv%|M` zGIBud!#x2N(aE62sc8QI+1linrICxf1J{$&@~xMiC?aVlky17L&c^_HWYk>j z!TuZ%#}$d=NS5ot8o)XEEsTRa^1nCqr57wkW$hi?>Nb>Pq0z4!vCw`w{{TPdG`wRc zKGl=q+qb^(-kEbDJKog^KTa!54oU70TF#_-Cga#i^DB}Q&Isgj#VT@Xhk^Q2m4Lw= z2+!eCGI2v>A#4+l)PUpyJJgutsie0+_A_LRLpsYDCMiZo_*8{}$GtM(d16@kDvTXH zgJ+M-AI_bOs3*9otrZ!xjcL2Ykw_G$80MIYag6avGvsh7(T_W@H*H9oOfkh35nP<) S(O&d&N{uITmE#h7AOG3wgiy8s literal 0 HcmV?d00001 diff --git a/app/assets/images/pizarro.jpg b/app/assets/images/pizarro.jpg new file mode 100644 index 0000000000000000000000000000000000000000..77b4915edc85ac422f2e52ccbe15ebf4aafb0712 GIT binary patch literal 18156 zcma%iWlUwk((Pf;!5Lt18{FO9-EDB!gS)%T;O_3uAP0AMhl9I246fgN_vPK>{d;R? zC!MZNsyjQov#M&<=kn(^098gpS^@y^1pqMp_W(Z60cc{bCO}UB1ON&E0Py{rx&$B# zo7x+j0Ze=T%|Lvv0YU&UP*70NP%zNYFkfN*y$EnHFmMQn@bC!m@QA30{{bo@G72gR zG9o%U1_nAhJ{}$(KGA;x0SgO@gouQVii(YkiH3>$U&H_J;IjvS1_wb0p#}+o2Ka&o z0f`3jIRME1w?AlzfB3i2{{u*fFHq1humHHP5CF*k$MSFK7s!7$Q~(4dB;*$;C`f1+ zC}?Pie<%L}iADm&{0&+dM%m~Gx+4n)Y+xT|e7*>&NnNiBt7xz>*>|`dr=SA18&&5J zaxAoe{=WPN|JMTq+7}W?=5NAKKhTv~j4+@bMT}WLR{@BS{}!S_q5%W}%Z}?LCi*j+ ze0Tb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)D74bgl-0*2*qo*>66}m)A18_(NV2gUBo1lv3GJo4mRSBrwes=!nR#rM zY>AH8SsQD;Ui)s%=G(0^f$rBh-M7 zWZHI(3QL48x~)y%;tq+@sksiIjCi)HT5bJHfZ^@Ehh0LOsdeno@v)gBXg(BJZNs;( zmHEO9#I~hpFD>?;ii&u)$XeyDu5FPrDCTY-z-U$KosgTfOy2@lzYM-t_^qrCZoUhf zXGW+p#6fT=>RU7UknNSyQqK98POd)RCHGtUX5HSOc9j1B(zHCjh~{bZ$J_a7(R`fp z`_BIW>gQbDKBb@eSEbhZ?(daE^!A_PyL#R?dXqEwylA#_1^f(DXWL|+9TKXE5Z7aO zYt!JPWokAxKC}KBT|;=CkxkLpL~NZ>o9%xtl-<>2(QU;0Us`?IZKbNGe+tzueV)(q zsq>mqVWW69C(&&l?%n?Y#p0E~*D8Gf0IvFJzfRxvJDu%&b=^u@i%y1p{vBWKx9cDD zi2neqYg#-10GGDD-8$C#E&DO@$FDyK-*5i_>JR$PPx?3A{{W=-pQ)$+02_b*0I_e_ zpV#&HM}PV9y8G)-{{YU9we9_1zCG_}Wof&v%Pl@tuZPL9Z>g&vLD;RGRA>+}hpRQ>_s|`5xZiRV(-?fkmC|)abQ^d?3H)8&J&a?)4!jzO)og zdW0*#%_Y6#`_M+WRdE!quHo=O9?jbdDz)-HO=%y&OINt+`?6O{DXjGJ*6}|xJ}aNM z!_nySzsRq$RysQS8Jy4akHvKLxcd>`wvX_o)oRaWS@!pec-?P5t3A9lm{j&3xBM%M rvD@` :name) + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @types } + end + end + # GET /types/new # GET /types/new.json def new diff --git a/app/controllers/types_controller.rb~ b/app/controllers/types_controller.rb~ new file mode 100644 index 0000000..baaf537 --- /dev/null +++ b/app/controllers/types_controller.rb~ @@ -0,0 +1,96 @@ +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 index_ordenado + @types = Type.find(:all, :order => :name) + + 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 062c0a4..9415fcb 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,8 +7,8 @@ <%= csrf_meta_tags %> - +<%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Index', types_path)+ "|" + link_to('Index ordenado', types_index_ordenado_path) %> <%= yield %> - +<%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Index', types_path)+ "|" + link_to('Index ordenado', types_index_ordenado_path) %> diff --git a/app/views/layouts/application.html.erb~ b/app/views/layouts/application.html.erb~ new file mode 100644 index 0000000..16910ff --- /dev/null +++ b/app/views/layouts/application.html.erb~ @@ -0,0 +1,14 @@ + + + + Planet + <%= stylesheet_link_tag "application", :media => "all" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + +<%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Index', types_path)+ "|" + link_to('Index ordenado', types_index_ordenado_path) %> +<%= yield %> +<%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Index', types_path)+ "|" + link_to('Index ordenado', types_index_ordenado_path) %> + + diff --git a/app/views/planet/author.html.erb b/app/views/planet/author.html.erb new file mode 100644 index 0000000..1ac8727 --- /dev/null +++ b/app/views/planet/author.html.erb @@ -0,0 +1,28 @@ + + +Autores + + +

+Información sobre los creadores +

+ +

En esta página podrá encontrar varios datos sobre los creadores +

+

Alberto Moreno Díaz

+<%= image_tag('alberto_contador.jpg') %> + +

Francisco José Gil García

+<%= image_tag('pizarro.jpg') %> +
    +
  • Dirección de correo: fj.gil@alumnos.upm.es
  • +
  • Dirección física: C/Con nombre 2, Bajo Derecha, Villatempujo de arriba
  • +
  • Breve currículum: a rellenar también
  • +
+

Para cualquier duda o problema no dude en contactarnos.

+ + diff --git a/app/views/planet/author.html.erb~ b/app/views/planet/author.html.erb~ new file mode 100644 index 0000000..95dd94e --- /dev/null +++ b/app/views/planet/author.html.erb~ @@ -0,0 +1,25 @@ + + +Autores + + +

+Información sobre los creadores +

+ +

En esta página podrá encontrar varios datos sobre los creadores +

+

Alberto Moreno Díaz

+<%= image_tag('alberto_contador.jpg') %> + +<%= image_tag('pedriza2-m.png') %> +

Francisco José Gil García

+ +

Feel free to use it for your +convenience and pleasure.

+ + diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb index 50bda49..26b15a3 100644 --- a/app/views/types/index.html.erb +++ b/app/views/types/index.html.erb @@ -13,6 +13,7 @@ <%= type.name %> <%= type.description %> + <%= type.updated_at %> <%= link_to 'Show', type %> <%= link_to 'Edit', edit_type_path(type) %> <%= link_to 'Destroy', type, confirm: 'Are you sure?', method: :delete %> diff --git a/app/views/types/index.html.erb~ b/app/views/types/index.html.erb~ new file mode 100644 index 0000000..26b15a3 --- /dev/null +++ b/app/views/types/index.html.erb~ @@ -0,0 +1,26 @@ +

Listing types

+ + + + + + + + + + +<% @types.each do |type| %> + + + + + + + + +<% end %> +
NameDescription
<%= type.name %><%= type.description %><%= 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 %> diff --git a/app/views/types/index_ordenado.html.erb b/app/views/types/index_ordenado.html.erb new file mode 100644 index 0000000..26b15a3 --- /dev/null +++ b/app/views/types/index_ordenado.html.erb @@ -0,0 +1,26 @@ +

Listing types

+ + + + + + + + + + +<% @types.each do |type| %> + + + + + + + + +<% end %> +
NameDescription
<%= type.name %><%= type.description %><%= 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 %> diff --git a/app/views/types/show.html.erb b/app/views/types/show.html.erb index 98b32e7..4400a61 100644 --- a/app/views/types/show.html.erb +++ b/app/views/types/show.html.erb @@ -10,6 +10,10 @@ <%= @type.description %>

+

+ Updated at: + <%= @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 100644 index 0000000..98b32e7 --- /dev/null +++ b/app/views/types/show.html.erb~ @@ -0,0 +1,15 @@ +

<%= notice %>

+ +

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

+ +

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

+ + +<%= link_to 'Edit', edit_type_path(@type) %> | +<%= link_to 'Back', types_path %> diff --git a/config/routes.rb b/config/routes.rb index 4cd1976..0572b25 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,10 @@ get "planet/ejemplo" + get "planet/author" + + get "types/index_ordenado" + # 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..9e0930a --- /dev/null +++ b/config/routes.rb~ @@ -0,0 +1,70 @@ +Planet::Application.routes.draw do + resources :types + + get "planet/index" + + get "planet/contact" + + get "planet/ejemplo" + + get "planet/author" + + # 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 diff --git a/test/unit/helpers/planet_controller_test.rb b/test/unit/helpers/planet_controller_test.rb new file mode 100644 index 0000000..8ca34e8 --- /dev/null +++ b/test/unit/helpers/planet_controller_test.rb @@ -0,0 +1,17 @@ +require 'test_helper' +# Rails genera estos tests automaticamente. +# +# Prueban que devuelve correctamente las páginas index y contact +# +class PlanetControllerTest < ActionController::TestCase +test "should get author" do +get :author +# Invoca “get” en acción “author” +assert_response :success # código HTTP: “200 OK” +end +test "should get ejemplo" do +get :ejemplo +# Invoca “get” en acción “ejemplo” +assert_response :success # código HTTP: “200 OK” +end +end diff --git a/test/unit/helpers/planet_controller_test.rb~ b/test/unit/helpers/planet_controller_test.rb~ new file mode 100644 index 0000000..2d2d3ba --- /dev/null +++ b/test/unit/helpers/planet_controller_test.rb~ @@ -0,0 +1,17 @@ +require 'test_helper' +# Rails genera estos tests automaticamente. +# +# Prueban que devuelve correctamente las páginas index y contact +# +class PlanetControllerTest < ActionController::TestCase +test "should get index" do +get :index +# Invoca “get” en acción “index” +assert_response :success # código HTTP: “200 OK” +end +test "should get contact" do +get :contact +# Invoca “get” en acción “contact” +assert_response :success # código HTTP: “200 OK” +end +end From fad30f165c6274fc233112ecb64ffdb0a280c92c Mon Sep 17 00:00:00 2001 From: Fran Gil Date: Tue, 27 Mar 2012 19:10:04 +0200 Subject: [PATCH 2/8] cambios entrega 1 --- app/controllers/types_controller.rb | 188 +++++++++++----------- app/views/layouts/application.html.erb | 30 ++-- app/views/types/ordered_index.html.erb | 26 +++ test/functional/planet_controller_test.rb | 40 +++-- 4 files changed, 162 insertions(+), 122 deletions(-) create mode 100644 app/views/types/ordered_index.html.erb diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb index 7d15db4..c11eb7f 100644 --- a/app/controllers/types_controller.rb +++ b/app/controllers/types_controller.rb @@ -1,94 +1,94 @@ -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 - # GET /types.json - def index_ordenado - @types = Type.find(:all, :order => :name) - - respond_to do |format| - format.html # index.html.erb - format.json { render json: @types } - 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 +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/ordered_index + # GET /types/ordered_index.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/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 9415fcb..f910914 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,14 +1,16 @@ - - - - Planet - <%= stylesheet_link_tag "application", :media => "all" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - -<%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Index', types_path)+ "|" + link_to('Index ordenado', types_index_ordenado_path) %> -<%= yield %> -<%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Index', types_path)+ "|" + link_to('Index ordenado', types_index_ordenado_path) %> - - + + + + Planet + <%= stylesheet_link_tag "application", :media => "all" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + +<%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', ordered_index_types_path) %> +<%= yield %> +

+<%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', ordered_index_types_path) %> +

+ + \ No newline at end of file diff --git a/app/views/types/ordered_index.html.erb b/app/views/types/ordered_index.html.erb new file mode 100644 index 0000000..a090046 --- /dev/null +++ b/app/views/types/ordered_index.html.erb @@ -0,0 +1,26 @@ +

Listing types

+ + + + + + + + + + +<% @types.each do |type| %> + + + + + + + + +<% end %> +
NameDescription
<%= type.name %><%= type.description %><%= 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 %> diff --git a/test/functional/planet_controller_test.rb b/test/functional/planet_controller_test.rb index 88229e0..84d5ebb 100644 --- a/test/functional/planet_controller_test.rb +++ b/test/functional/planet_controller_test.rb @@ -1,14 +1,26 @@ -require 'test_helper' - -class PlanetControllerTest < ActionController::TestCase - test "should get index" do - get :index - assert_response :success - end - - test "should get contact" do - get :contact - assert_response :success - end - -end +require 'test_helper' + +class PlanetControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + + test "should get contact" do + get :contact + assert_response :success + end + + test "should get author" do + get :author + # Invoca “get” en acción “author” + assert_response :success # código HTTP: “200 OK” + end + + test "should get ejemplo" do + get :ejemplo + # Invoca “get” en acción “ejemplo” + assert_response :success # código HTTP: “200 OK” + end + +end From 322753c1db80ef9e57d6067d7c86b5ab4171729c Mon Sep 17 00:00:00 2001 From: Fran Gil Date: Tue, 10 Apr 2012 22:08:48 +0200 Subject: [PATCH 3/8] version alberto --- Gemfile | 77 ++++---- Gemfile.lock | 235 ++++++++++++----------- Gemfile~ | 38 ++++ README.rdoc | 522 +++++++++++++++++++++++++-------------------------- Rakefile | 14 +- config.ru | 8 +- 6 files changed, 473 insertions(+), 421 deletions(-) create mode 100644 Gemfile~ diff --git a/Gemfile b/Gemfile index 7764763..f408439 100644 --- a/Gemfile +++ b/Gemfile @@ -1,38 +1,39 @@ -source 'https://rubygems.org' - -gem 'rails', '3.2.2' - -# Bundle edge Rails instead: -# gem 'rails', :git => 'git://github.com/rails/rails.git' - -gem 'sqlite3' - - -# Gems used only for assets and not required -# in production environments by default. -group :assets do - gem 'sass-rails', '~> 3.2.3' - gem 'coffee-rails', '~> 3.2.1' - - # See https://github.com/sstephenson/execjs#readme for more supported runtimes - # gem 'therubyracer' - - gem 'uglifier', '>= 1.0.3' -end - -gem 'jquery-rails' - -# To use ActiveModel has_secure_password -# gem 'bcrypt-ruby', '~> 3.0.0' - -# To use Jbuilder templates for JSON -# gem 'jbuilder' - -# Use unicorn as the app server -# gem 'unicorn' - -# Deploy with Capistrano -# gem 'capistrano' - -# To use debugger -# gem 'ruby-debug19', :require => 'ruby-debug' +source 'https://rubygems.org' + +gem 'rails', '3.2.2' + +# Bundle edge Rails instead: +# gem 'rails', :git => 'git://github.com/rails/rails.git' + +gem 'sqlite3' + +gem 'devise' + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + # gem 'therubyracer' + + gem 'uglifier', '>= 1.0.3' +end + +gem 'jquery-rails' + +# To use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.0.0' + +# To use Jbuilder templates for JSON +# gem 'jbuilder' + +# Use unicorn as the app server +# gem 'unicorn' + +# Deploy with Capistrano +# gem 'capistrano' + +# To use debugger +# gem 'ruby-debug19', :require => 'ruby-debug' diff --git a/Gemfile.lock b/Gemfile.lock index 81a3ba7..6405e84 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,111 +1,124 @@ -GEM - remote: https://rubygems.org/ - specs: - actionmailer (3.2.2) - actionpack (= 3.2.2) - mail (~> 2.4.0) - actionpack (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.1) - rack (~> 1.4.0) - rack-cache (~> 1.1) - rack-test (~> 0.6.1) - sprockets (~> 2.1.2) - activemodel (3.2.2) - activesupport (= 3.2.2) - builder (~> 3.0.0) - activerecord (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - activesupport (3.2.2) - i18n (~> 0.6) - multi_json (~> 1.0) - arel (3.0.2) - builder (3.0.0) - coffee-rails (3.2.2) - coffee-script (>= 2.2.0) - railties (~> 3.2.0) - coffee-script (2.2.0) - coffee-script-source - execjs - coffee-script-source (1.2.0) - erubis (2.7.0) - execjs (1.3.0) - multi_json (~> 1.0) - hike (1.2.1) - i18n (0.6.0) - journey (1.0.3) - jquery-rails (2.0.1) - railties (>= 3.2.0, < 5.0) - thor (~> 0.14) - json (1.6.5) - mail (2.4.4) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.17.2) - multi_json (1.1.0) - polyglot (0.3.3) - rack (1.4.1) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.2) - rack - rack-test (0.6.1) - rack (>= 1.0) - rails (3.2.2) - actionmailer (= 3.2.2) - actionpack (= 3.2.2) - activerecord (= 3.2.2) - activeresource (= 3.2.2) - activesupport (= 3.2.2) - bundler (~> 1.0) - railties (= 3.2.2) - railties (3.2.2) - actionpack (= 3.2.2) - activesupport (= 3.2.2) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.6) - rake (0.9.2.2) - rdoc (3.12) - json (~> 1.4) - sass (3.1.15) - sass-rails (3.2.4) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - sprockets (2.1.2) - hike (~> 1.2) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.5) - thor (0.14.6) - tilt (1.3.3) - treetop (1.4.10) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.32) - uglifier (1.2.3) - execjs (>= 0.3.0) - multi_json (>= 1.0.2) - -PLATFORMS - ruby - -DEPENDENCIES - coffee-rails (~> 3.2.1) - jquery-rails - rails (= 3.2.2) - sass-rails (~> 3.2.3) - sqlite3 - uglifier (>= 1.0.3) +GEM + remote: https://rubygems.org/ + specs: + actionmailer (3.2.2) + actionpack (= 3.2.2) + mail (~> 2.4.0) + actionpack (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.1) + rack (~> 1.4.0) + rack-cache (~> 1.1) + rack-test (~> 0.6.1) + sprockets (~> 2.1.2) + activemodel (3.2.2) + activesupport (= 3.2.2) + builder (~> 3.0.0) + activerecord (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + activesupport (3.2.2) + i18n (~> 0.6) + multi_json (~> 1.0) + arel (3.0.2) + bcrypt-ruby (3.0.1) + bcrypt-ruby (3.0.1-x86-mingw32) + builder (3.0.0) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.2.0) + devise (2.0.4) + bcrypt-ruby (~> 3.0) + orm_adapter (~> 0.0.3) + railties (~> 3.1) + warden (~> 1.1.1) + erubis (2.7.0) + execjs (1.3.0) + multi_json (~> 1.0) + hike (1.2.1) + i18n (0.6.0) + journey (1.0.3) + jquery-rails (2.0.1) + railties (>= 3.2.0, < 5.0) + thor (~> 0.14) + json (1.6.5) + mail (2.4.4) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.17.2) + multi_json (1.1.0) + orm_adapter (0.0.7) + polyglot (0.3.3) + rack (1.4.1) + rack-cache (1.2) + rack (>= 0.4) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) + rack (>= 1.0) + rails (3.2.2) + actionmailer (= 3.2.2) + actionpack (= 3.2.2) + activerecord (= 3.2.2) + activeresource (= 3.2.2) + activesupport (= 3.2.2) + bundler (~> 1.0) + railties (= 3.2.2) + railties (3.2.2) + actionpack (= 3.2.2) + activesupport (= 3.2.2) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (~> 0.14.6) + rake (0.9.2.2) + rdoc (3.12) + json (~> 1.4) + sass (3.1.15) + sass-rails (3.2.4) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + sprockets (2.1.2) + hike (~> 1.2) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sqlite3 (1.3.5) + sqlite3 (1.3.5-x86-mingw32) + thor (0.14.6) + tilt (1.3.3) + treetop (1.4.10) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.32) + uglifier (1.2.3) + execjs (>= 0.3.0) + multi_json (>= 1.0.2) + warden (1.1.1) + rack (>= 1.0) + +PLATFORMS + ruby + x86-mingw32 + +DEPENDENCIES + coffee-rails (~> 3.2.1) + devise + jquery-rails + rails (= 3.2.2) + sass-rails (~> 3.2.3) + sqlite3 + uglifier (>= 1.0.3) diff --git a/Gemfile~ b/Gemfile~ new file mode 100644 index 0000000..7764763 --- /dev/null +++ b/Gemfile~ @@ -0,0 +1,38 @@ +source 'https://rubygems.org' + +gem 'rails', '3.2.2' + +# Bundle edge Rails instead: +# gem 'rails', :git => 'git://github.com/rails/rails.git' + +gem 'sqlite3' + + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + # gem 'therubyracer' + + gem 'uglifier', '>= 1.0.3' +end + +gem 'jquery-rails' + +# To use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.0.0' + +# To use Jbuilder templates for JSON +# gem 'jbuilder' + +# Use unicorn as the app server +# gem 'unicorn' + +# Deploy with Capistrano +# gem 'capistrano' + +# To use debugger +# gem 'ruby-debug19', :require => 'ruby-debug' diff --git a/README.rdoc b/README.rdoc index 7c36f23..0f00a42 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,261 +1,261 @@ -== Welcome to Rails - -Rails is a web-application framework that includes everything needed to create -database-backed web applications according to the Model-View-Control pattern. - -This pattern splits the view (also called the presentation) into "dumb" -templates that are primarily responsible for inserting pre-built data in between -HTML tags. The model contains the "smart" domain objects (such as Account, -Product, Person, Post) that holds all the business logic and knows how to -persist themselves to a database. The controller handles the incoming requests -(such as Save New Account, Update Product, Show Post) by manipulating the model -and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting Started - -1. At the command prompt, create a new Rails application: - rails new myapp (where myapp is the application name) - -2. Change directory to myapp and start the web server: - cd myapp; rails server (run with --help for options) - -3. Go to http://localhost:3000/ and you'll see: - "Welcome aboard: You're riding Ruby on Rails!" - -4. Follow the guidelines to start developing your application. You can find -the following resources handy: - -* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html -* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ - - -== Debugging Rails - -Sometimes your application goes wrong. Fortunately there are a lot of tools that -will help you debug it and get it back on the rails. - -First area to check is the application log files. Have "tail -f" commands -running on the server.log and development.log. Rails will automatically display -debugging and runtime information to these files. Debugging info will also be -shown in the browser on requests from 127.0.0.1. - -You can also log your own messages directly into the log file from your code -using the Ruby logger class from inside your controllers. Example: - - class WeblogController < ActionController::Base - def destroy - @weblog = Weblog.find(params[:id]) - @weblog.destroy - logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") - end - end - -The result will be a message in your log file along the lines of: - - Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! - -More information on how to use the logger is at http://www.ruby-doc.org/core/ - -Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are -several books available online as well: - -* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) -* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) - -These two books will bring you up to speed on the Ruby language and also on -programming in general. - - -== Debugger - -Debugger support is available through the debugger command when you start your -Mongrel or WEBrick server with --debugger. This means that you can break out of -execution at any point in the code, investigate and change the model, and then, -resume execution! You need to install ruby-debug to run the server in debugging -mode. With gems, use sudo gem install ruby-debug. Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.all - debugger - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the server window. Here you can do things like: - - >> @posts.inspect - => "[#nil, "body"=>nil, "id"=>"1"}>, - #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" - >> @posts.first.title = "hello from a debugger" - => "hello from a debugger" - -...and even better, you can examine how your runtime objects actually work: - - >> f = @posts.first - => #nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you can enter "cont". - - -== Console - -The console is a Ruby shell, which allows you to interact with your -application's domain model. Here you'll have all parts of the application -configured, just like it is when the application is running. You can inspect -domain models, change values, and save to the database. Starting the script -without arguments will launch it in the development environment. - -To start the console, run rails console from the application -directory. - -Options: - -* Passing the -s, --sandbox argument will rollback any modifications - made to the database. -* Passing an environment name as an argument will load the corresponding - environment. Example: rails console production. - -To reload your controllers and models after launching the console run -reload! - -More information about irb can be found at: -link:http://www.rubycentral.org/pickaxe/irb.html - - -== dbconsole - -You can go to the command line of your database directly through rails -dbconsole. You would be connected to the database with the credentials -defined in database.yml. Starting the script without arguments will connect you -to the development database. Passing an argument will connect you to a different -database, like rails dbconsole production. Currently works for MySQL, -PostgreSQL and SQLite 3. - -== Description of Contents - -The default directory structure of a generated Ruby on Rails application: - - |-- app - | |-- assets - | |-- images - | |-- javascripts - | `-- stylesheets - | |-- controllers - | |-- helpers - | |-- mailers - | |-- models - | `-- views - | `-- layouts - |-- config - | |-- environments - | |-- initializers - | `-- locales - |-- db - |-- doc - |-- lib - | `-- tasks - |-- log - |-- public - |-- script - |-- test - | |-- fixtures - | |-- functional - | |-- integration - | |-- performance - | `-- unit - |-- tmp - | |-- cache - | |-- pids - | |-- sessions - | `-- sockets - `-- vendor - |-- assets - `-- stylesheets - `-- plugins - -app - Holds all the code that's specific to this particular application. - -app/assets - Contains subdirectories for images, stylesheets, and JavaScript files. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from - ApplicationController which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. Models descend from - ActiveRecord::Base by default. - -app/views - Holds the template files for the view that should be named like - weblogs/index.html.erb for the WeblogsController#index action. All views use - eRuby syntax by default. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the - common header/footer method of wrapping views. In your views, define a layout - using the layout :default and create a file named default.html.erb. - Inside default.html.erb, call <% yield %> to render the view using this - layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are - generated for you automatically when using generators for controllers. - Helpers can be used to wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, - and other dependencies. - -db - Contains the database schema in schema.rb. db/migrate contains all the - sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when - generated using rake doc:app - -lib - Application specific libraries. Basically, any kind of custom code that - doesn't belong under controllers, models, or helpers. This directory is in - the load path. - -public - The directory available for the web server. Also contains the dispatchers and the - default HTML files. This should be set as the DOCUMENT_ROOT of your web - server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the rails generate - command, template test files will be generated for you and placed in this - directory. - -vendor - External libraries that the application depends on. Also includes the plugins - subdirectory. If the app has frozen rails, those gems also go here, under - vendor/rails/. This directory is in the load path. +== Welcome to Rails + +Rails is a web-application framework that includes everything needed to create +database-backed web applications according to the Model-View-Control pattern. + +This pattern splits the view (also called the presentation) into "dumb" +templates that are primarily responsible for inserting pre-built data in between +HTML tags. The model contains the "smart" domain objects (such as Account, +Product, Person, Post) that holds all the business logic and knows how to +persist themselves to a database. The controller handles the incoming requests +(such as Save New Account, Update Product, Show Post) by manipulating the model +and directing data to the view. + +In Rails, the model is handled by what's called an object-relational mapping +layer entitled Active Record. This layer allows you to present the data from +database rows as objects and embellish these data objects with business logic +methods. You can read more about Active Record in +link:files/vendor/rails/activerecord/README.html. + +The controller and view are handled by the Action Pack, which handles both +layers by its two parts: Action View and Action Controller. These two layers +are bundled in a single package due to their heavy interdependence. This is +unlike the relationship between the Active Record and Action Pack that is much +more separate. Each of these packages can be used independently outside of +Rails. You can read more about Action Pack in +link:files/vendor/rails/actionpack/README.html. + + +== Getting Started + +1. At the command prompt, create a new Rails application: + rails new myapp (where myapp is the application name) + +2. Change directory to myapp and start the web server: + cd myapp; rails server (run with --help for options) + +3. Go to http://localhost:3000/ and you'll see: + "Welcome aboard: You're riding Ruby on Rails!" + +4. Follow the guidelines to start developing your application. You can find +the following resources handy: + +* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html +* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ + + +== Debugging Rails + +Sometimes your application goes wrong. Fortunately there are a lot of tools that +will help you debug it and get it back on the rails. + +First area to check is the application log files. Have "tail -f" commands +running on the server.log and development.log. Rails will automatically display +debugging and runtime information to these files. Debugging info will also be +shown in the browser on requests from 127.0.0.1. + +You can also log your own messages directly into the log file from your code +using the Ruby logger class from inside your controllers. Example: + + class WeblogController < ActionController::Base + def destroy + @weblog = Weblog.find(params[:id]) + @weblog.destroy + logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") + end + end + +The result will be a message in your log file along the lines of: + + Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! + +More information on how to use the logger is at http://www.ruby-doc.org/core/ + +Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are +several books available online as well: + +* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) +* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) + +These two books will bring you up to speed on the Ruby language and also on +programming in general. + + +== Debugger + +Debugger support is available through the debugger command when you start your +Mongrel or WEBrick server with --debugger. This means that you can break out of +execution at any point in the code, investigate and change the model, and then, +resume execution! You need to install ruby-debug to run the server in debugging +mode. With gems, use sudo gem install ruby-debug. Example: + + class WeblogController < ActionController::Base + def index + @posts = Post.all + debugger + end + end + +So the controller will accept the action, run the first line, then present you +with a IRB prompt in the server window. Here you can do things like: + + >> @posts.inspect + => "[#nil, "body"=>nil, "id"=>"1"}>, + #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" + >> @posts.first.title = "hello from a debugger" + => "hello from a debugger" + +...and even better, you can examine how your runtime objects actually work: + + >> f = @posts.first + => #nil, "body"=>nil, "id"=>"1"}> + >> f. + Display all 152 possibilities? (y or n) + +Finally, when you're ready to resume execution, you can enter "cont". + + +== Console + +The console is a Ruby shell, which allows you to interact with your +application's domain model. Here you'll have all parts of the application +configured, just like it is when the application is running. You can inspect +domain models, change values, and save to the database. Starting the script +without arguments will launch it in the development environment. + +To start the console, run rails console from the application +directory. + +Options: + +* Passing the -s, --sandbox argument will rollback any modifications + made to the database. +* Passing an environment name as an argument will load the corresponding + environment. Example: rails console production. + +To reload your controllers and models after launching the console run +reload! + +More information about irb can be found at: +link:http://www.rubycentral.org/pickaxe/irb.html + + +== dbconsole + +You can go to the command line of your database directly through rails +dbconsole. You would be connected to the database with the credentials +defined in database.yml. Starting the script without arguments will connect you +to the development database. Passing an argument will connect you to a different +database, like rails dbconsole production. Currently works for MySQL, +PostgreSQL and SQLite 3. + +== Description of Contents + +The default directory structure of a generated Ruby on Rails application: + + |-- app + | |-- assets + | |-- images + | |-- javascripts + | `-- stylesheets + | |-- controllers + | |-- helpers + | |-- mailers + | |-- models + | `-- views + | `-- layouts + |-- config + | |-- environments + | |-- initializers + | `-- locales + |-- db + |-- doc + |-- lib + | `-- tasks + |-- log + |-- public + |-- script + |-- test + | |-- fixtures + | |-- functional + | |-- integration + | |-- performance + | `-- unit + |-- tmp + | |-- cache + | |-- pids + | |-- sessions + | `-- sockets + `-- vendor + |-- assets + `-- stylesheets + `-- plugins + +app + Holds all the code that's specific to this particular application. + +app/assets + Contains subdirectories for images, stylesheets, and JavaScript files. + +app/controllers + Holds controllers that should be named like weblogs_controller.rb for + automated URL mapping. All controllers should descend from + ApplicationController which itself descends from ActionController::Base. + +app/models + Holds models that should be named like post.rb. Models descend from + ActiveRecord::Base by default. + +app/views + Holds the template files for the view that should be named like + weblogs/index.html.erb for the WeblogsController#index action. All views use + eRuby syntax by default. + +app/views/layouts + Holds the template files for layouts to be used with views. This models the + common header/footer method of wrapping views. In your views, define a layout + using the layout :default and create a file named default.html.erb. + Inside default.html.erb, call <% yield %> to render the view using this + layout. + +app/helpers + Holds view helpers that should be named like weblogs_helper.rb. These are + generated for you automatically when using generators for controllers. + Helpers can be used to wrap functionality for your views into methods. + +config + Configuration files for the Rails environment, the routing map, the database, + and other dependencies. + +db + Contains the database schema in schema.rb. db/migrate contains all the + sequence of Migrations for your schema. + +doc + This directory is where your application documentation will be stored when + generated using rake doc:app + +lib + Application specific libraries. Basically, any kind of custom code that + doesn't belong under controllers, models, or helpers. This directory is in + the load path. + +public + The directory available for the web server. Also contains the dispatchers and the + default HTML files. This should be set as the DOCUMENT_ROOT of your web + server. + +script + Helper scripts for automation and generation. + +test + Unit and functional tests along with fixtures. When using the rails generate + command, template test files will be generated for you and placed in this + directory. + +vendor + External libraries that the application depends on. Also includes the plugins + subdirectory. If the app has frozen rails, those gems also go here, under + vendor/rails/. This directory is in the load path. diff --git a/Rakefile b/Rakefile index 8d9611e..adc01ca 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ -#!/usr/bin/env rake -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require File.expand_path('../config/application', __FILE__) - -Planet::Application.load_tasks +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Planet::Application.load_tasks diff --git a/config.ru b/config.ru index 0a9abb6..1ec20e0 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,4 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run Planet::Application +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Planet::Application From 996eee2949f79ef7244536b6ebbec0e0f8e17941 Mon Sep 17 00:00:00 2001 From: Fran Gil Date: Tue, 17 Apr 2012 19:00:55 +0200 Subject: [PATCH 4/8] Entrega comentarios --- app/assets/javascripts/comments.js.coffee | 3 + app/assets/stylesheets/comments.css.scss | 3 + app/controllers/comments_controller.rb | 91 +++++++++++ app/controllers/comments_controller.rb~ | 91 +++++++++++ app/controllers/sites_controller.rb | 1 + app/controllers/sites_controller.rb~ | 90 +++++++++++ app/helpers/comments_helper.rb | 2 + app/models/comment.rb | 12 ++ app/models/comment.rb~ | 4 + app/models/site.rb | 2 + app/models/site.rb~ | 10 ++ app/models/user.rb | 1 + app/models/user.rb~ | 15 ++ app/views/comments/_comment.html.erb | 28 ++++ app/views/comments/_form.html.erb | 23 +++ app/views/comments/_form.html.erb~ | 33 ++++ app/views/comments/edit.html.erb | 6 + app/views/comments/edit.html.erb~ | 6 + app/views/comments/index.html.erb | 7 + app/views/comments/index.html.erb~ | 7 + app/views/comments/new.html.erb | 5 + app/views/comments/new.html.erb~ | 5 + app/views/comments/show.html.erb | 21 +++ app/views/comments/show.html.erb~ | 21 +++ app/views/sites/index.html.erb | 3 + app/views/sites/index.html.erb~ | 39 +++++ app/views/sites/show.html.erb | 10 +- config/routes.rb | 6 +- config/routes.rb~ | 159 ++++++++++--------- db/migrate/20120410171102_create_comments.rb | 11 ++ db/migrate/20120410202832_create_comments.rb | 11 ++ db/schema.rb | 10 +- test/fixtures/comments.yml | 11 ++ test/functional/comments_controller_test.rb | 49 ++++++ test/unit/comment_test.rb | 7 + test/unit/helpers/comments_helper_test.rb | 4 + 36 files changed, 726 insertions(+), 81 deletions(-) create mode 100644 app/assets/javascripts/comments.js.coffee create mode 100644 app/assets/stylesheets/comments.css.scss create mode 100644 app/controllers/comments_controller.rb create mode 100644 app/controllers/comments_controller.rb~ create mode 100644 app/controllers/sites_controller.rb~ create mode 100644 app/helpers/comments_helper.rb create mode 100644 app/models/comment.rb create mode 100644 app/models/comment.rb~ create mode 100644 app/models/site.rb~ create mode 100644 app/models/user.rb~ create mode 100644 app/views/comments/_comment.html.erb create mode 100644 app/views/comments/_form.html.erb create mode 100644 app/views/comments/_form.html.erb~ create mode 100644 app/views/comments/edit.html.erb create mode 100644 app/views/comments/edit.html.erb~ create mode 100644 app/views/comments/index.html.erb create mode 100644 app/views/comments/index.html.erb~ create mode 100644 app/views/comments/new.html.erb create mode 100644 app/views/comments/new.html.erb~ create mode 100644 app/views/comments/show.html.erb create mode 100644 app/views/comments/show.html.erb~ create mode 100644 app/views/sites/index.html.erb~ create mode 100644 db/migrate/20120410171102_create_comments.rb create mode 100644 db/migrate/20120410202832_create_comments.rb create mode 100644 test/fixtures/comments.yml create mode 100644 test/functional/comments_controller_test.rb create mode 100644 test/unit/comment_test.rb create mode 100644 test/unit/helpers/comments_helper_test.rb diff --git a/app/assets/javascripts/comments.js.coffee b/app/assets/javascripts/comments.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/comments.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/comments.css.scss b/app/assets/stylesheets/comments.css.scss new file mode 100644 index 0000000..3722c12 --- /dev/null +++ b/app/assets/stylesheets/comments.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the comments 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/comments_controller.rb b/app/controllers/comments_controller.rb new file mode 100644 index 0000000..eda8d8a --- /dev/null +++ b/app/controllers/comments_controller.rb @@ -0,0 +1,91 @@ +class CommentsController < ApplicationController + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] + + # GET /comments + # GET /comments.json + def index + @site = Site.find(params[:site_id]) + @comments = @site.comments + @comment = current_user.comments.build + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @comments } + end + end + + # GET /comments/1 + # GET /comments/1.json + def show + @comment = Comment.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comment } + end + end + + # GET /comments/new + # GET /comments/new.json + def new + @comment = current_user.comments.build + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @comment } + end + end + + # GET /comments/1/edit + def edit + @comment = current_user.comments.find(params[:id]) + @site = @comment.site + end + + # POST /comments + # POST /comments.json + def create + @comment = current_user.comments.build(params[:comment]) + + respond_to do |format| + if @comment.save + format.html { redirect_to site_path(@comment.site), notice: 'Comment was successfully created.' } + format.json { render json: @comment, status: :created, location: @comment } + else + format.html { render action: "new" } + format.json { render json: @comment.errors, status: :unprocessable_entity } + end + end + end + + # PUT /comments/1 + # PUT /comments/1.json + def update + @comment = current_user.comments.find(params[:id]) + + respond_to do |format| + if @comment.update_attributes(params[:comment]) + format.html { redirect_to site_path(@comment.site), notice: 'Comment was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comment.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comments/1 + # DELETE /comments/1.json + def destroy + @comment = current_user.comments.find(params[:id]) + site = @comment.site + @comment.destroy + + respond_to do |format| + format.html { redirect_to site_path(site) } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/comments_controller.rb~ b/app/controllers/comments_controller.rb~ new file mode 100644 index 0000000..86a4240 --- /dev/null +++ b/app/controllers/comments_controller.rb~ @@ -0,0 +1,91 @@ +class CommentsController < ApplicationController + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] + + # GET /comments + # GET /comments.json + def index + @site = Site.find(params[:site_id]) + @comments = @site.comments + # @comment = current_user.comments.build + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @comments } + end + end + + # GET /comments/1 + # GET /comments/1.json + def show + @comment = Comment.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comment } + end + end + + # GET /comments/new + # GET /comments/new.json + def new + @comment = current_user.comments.build + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @comment } + end + end + + # GET /comments/1/edit + def edit + @comment = current_user.comments.find(params[:id]) + @site = @comment.site + end + + # POST /comments + # POST /comments.json + def create + @comment = current_user.comments.build(params[:comment]) + + respond_to do |format| + if @comment.save + format.html { redirect_to site_path(@comment.site), notice: 'Comment was successfully created.' } + format.json { render json: @comment, status: :created, location: @comment } + else + format.html { render action: "new" } + format.json { render json: @comment.errors, status: :unprocessable_entity } + end + end + end + + # PUT /comments/1 + # PUT /comments/1.json + def update + @comment = current_user.comments.find(params[:id]) + + respond_to do |format| + if @comment.update_attributes(params[:comment]) + format.html { redirect_to site_path(@comment.site), notice: 'Comment was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comment.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comments/1 + # DELETE /comments/1.json + def destroy + @comment = current_user.comments.find(params[:id]) + site = @comment.site + @comment.destroy + + respond_to do |format| + format.html { redirect_to site_path(site) } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 90390bb..8d44a66 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -21,6 +21,7 @@ def index # GET /sites/1.json def show @site = Site.find(params[:id]) + @comment = current_user.comments.build respond_to do |format| format.html # show.html.erb diff --git a/app/controllers/sites_controller.rb~ b/app/controllers/sites_controller.rb~ new file mode 100644 index 0000000..90390bb --- /dev/null +++ b/app/controllers/sites_controller.rb~ @@ -0,0 +1,90 @@ +class SitesController < ApplicationController + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :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 +end diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb new file mode 100644 index 0000000..0ec9ca5 --- /dev/null +++ b/app/helpers/comments_helper.rb @@ -0,0 +1,2 @@ +module CommentsHelper +end diff --git a/app/models/comment.rb b/app/models/comment.rb new file mode 100644 index 0000000..8b7c248 --- /dev/null +++ b/app/models/comment.rb @@ -0,0 +1,12 @@ +class Comment < ActiveRecord::Base + belongs_to :site + belongs_to :user + + # Debe estar protegido para evitar accesos indeseados + #attr_protected :user_id + + # Se añaden estas definiciones + validates :comment, :user_id, :site_id, :presence => true # campo obligatorio + validates :comment, :length => { :maximum => 240 } + +end diff --git a/app/models/comment.rb~ b/app/models/comment.rb~ new file mode 100644 index 0000000..c7ec0ca --- /dev/null +++ b/app/models/comment.rb~ @@ -0,0 +1,4 @@ +class Comment < ActiveRecord::Base +belongs_to :user +belongs_to :site +end diff --git a/app/models/site.rb b/app/models/site.rb index ec39f92..ab32f25 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -1,6 +1,8 @@ class Site < ActiveRecord::Base belongs_to :type belongs_to :user + + has_many :comments # Debe estar protegido para evitar accesos indeseados attr_protected :user_id diff --git a/app/models/site.rb~ b/app/models/site.rb~ new file mode 100644 index 0000000..ec39f92 --- /dev/null +++ b/app/models/site.rb~ @@ -0,0 +1,10 @@ +class Site < ActiveRecord::Base + belongs_to :type + belongs_to :user + + # 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 a3684f5..0925503 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,7 @@ class User < ActiveRecord::Base has_many :sites + has_many :comments # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable diff --git a/app/models/user.rb~ b/app/models/user.rb~ new file mode 100644 index 0000000..0925503 --- /dev/null +++ b/app/models/user.rb~ @@ -0,0 +1,15 @@ +class User < ActiveRecord::Base + + has_many :sites + has_many :comments + + # 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/comments/_comment.html.erb b/app/views/comments/_comment.html.erb new file mode 100644 index 0000000..ec80a87 --- /dev/null +++ b/app/views/comments/_comment.html.erb @@ -0,0 +1,28 @@ +
+ + <% @comments.each do |comment| %> + + + + + + + <% end %> +
+
+ <% if comment.user == current_user %> +
<%= link_to comment.user.name + ":", edit_user_registration_path %>
+ <% else %> +
<%= comment.user.name + ":" %>
+ <% end %> +
<%= strip_tags(comment.comment) %>
+
+
+ <% if comment.user == current_user %> + <%= link_to 'Edit', edit_comment_path(comment) %>
+ <%= link_to 'Destroy', comment, + :confirm => 'Are you sure?', + :method => :delete if comment.user == current_user %> + <% end %> +
+
\ No newline at end of file diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb new file mode 100644 index 0000000..8701bb3 --- /dev/null +++ b/app/views/comments/_form.html.erb @@ -0,0 +1,23 @@ +<%= form_for(@comment) do |f| %> + <% if @comment.errors.any? %> +
+

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

+ +
    + <% @comment.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +

Añada su comentario

+
+ <%= f.text_area :comment, :maxlength => 240, :rows => 6 %> +
+ <%= f.number_field :user_id, :value => current_user.id, :hidden => true %> + <%= f.number_field :site_id, :value => @site.id, :hidden => true %> +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/comments/_form.html.erb~ b/app/views/comments/_form.html.erb~ new file mode 100644 index 0000000..ab5f21a --- /dev/null +++ b/app/views/comments/_form.html.erb~ @@ -0,0 +1,33 @@ +<%= 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.submit %> +
+<% end %> diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb new file mode 100644 index 0000000..09acee5 --- /dev/null +++ b/app/views/comments/edit.html.erb @@ -0,0 +1,6 @@ +

Editing comment

+ +<%= render 'form' %> + +<%= link_to 'Back', site_path(@comment.site) %> + diff --git a/app/views/comments/edit.html.erb~ b/app/views/comments/edit.html.erb~ new file mode 100644 index 0000000..af18cc3 --- /dev/null +++ b/app/views/comments/edit.html.erb~ @@ -0,0 +1,6 @@ +

Editing site

+ +<%= render 'form' %> + +<%= link_to 'Show', @site %> | +<%= link_to 'Back', sites_path %> diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb new file mode 100644 index 0000000..51288d3 --- /dev/null +++ b/app/views/comments/index.html.erb @@ -0,0 +1,7 @@ +

Comentarios de <%= @site.name %>

+ +<%= render 'comment' %> + +<%= render 'form' %> + +<%= link_to 'Back', sites_path %> diff --git a/app/views/comments/index.html.erb~ b/app/views/comments/index.html.erb~ new file mode 100644 index 0000000..684f636 --- /dev/null +++ b/app/views/comments/index.html.erb~ @@ -0,0 +1,7 @@ +

Comentarios de <%= @site.name %>

+ +<%= render'comment' %> + +<%= render 'form' %> + +<%= link_to 'Back', sites_path %> diff --git a/app/views/comments/new.html.erb b/app/views/comments/new.html.erb new file mode 100644 index 0000000..07a754a --- /dev/null +++ b/app/views/comments/new.html.erb @@ -0,0 +1,5 @@ +

New comment

+ +<%= render 'form' %> + +<%= link_to 'Back', comments_path %> diff --git a/app/views/comments/new.html.erb~ b/app/views/comments/new.html.erb~ new file mode 100644 index 0000000..37340dc --- /dev/null +++ b/app/views/comments/new.html.erb~ @@ -0,0 +1,5 @@ +

New site

+ +<%= render 'form' %> + +<%= link_to 'Back', sites_path %> diff --git a/app/views/comments/show.html.erb b/app/views/comments/show.html.erb new file mode 100644 index 0000000..ba05818 --- /dev/null +++ b/app/views/comments/show.html.erb @@ -0,0 +1,21 @@ +

<%= notice %>

+ +

+ Comment: + <%= @comment.comment %> +

+ +

+ User: + <%= @comment.user.name %> +

+ +

+ Site: + <%= @comment.site.name %> +

+ +<% if @comment.user == current_user %> + <%= link_to 'Edit', edit_comment_path(@comment) %> | +<% end %> +<%= link_to 'Back', site_path(@comment.site) %> diff --git a/app/views/comments/show.html.erb~ b/app/views/comments/show.html.erb~ new file mode 100644 index 0000000..904b6d4 --- /dev/null +++ b/app/views/comments/show.html.erb~ @@ -0,0 +1,21 @@ +
+ +

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

+ +
+ +

+ +<% if @site.user == current_user %> + <%= link_to 'Edit', edit_site_path(@site) %> | +<% end %> +<%= link_to 'Back', sites_path %> diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index 547fb29..1ecde21 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -14,6 +14,9 @@

<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
+ <% unless site.comments.empty? %> +
<%= link_to 'Comentarios', site_comments_path(site) %>
+ <% end %> diff --git a/app/views/sites/index.html.erb~ b/app/views/sites/index.html.erb~ new file mode 100644 index 0000000..9cac379 --- /dev/null +++ b/app/views/sites/index.html.erb~ @@ -0,0 +1,39 @@ +
+

<%= @sites == Site.all ? "Todos los sitios" : Type.find(params[:type_id]).name %>

+ + + <% @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) %>
+ <% if site.comments %> + <%= link_to 'comentarios', comments_path(site) %>
+ <% end %> +
+
+ <%= 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 %> diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 904b6d4..a658b4a 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -9,7 +9,15 @@

<%=sanitize @site.description %>

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

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

+ + <% unless @site.comments.empty? %> +

Comentarios:

+ <% @comments = @site.comments %> + <%= render(@comment) %> + <% end %> + + <%= render 'comments/form' %> diff --git a/config/routes.rb b/config/routes.rb index 26ce331..ff5a379 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,12 @@ Planet::Application.routes.draw do + resources :comments, :except => [ :new, :index ] + devise_for :users - resources :sites + resources :sites do + resources :comments, :only => [ :index ] + end resources :types do get 'ordered_index', :on => :collection diff --git a/config/routes.rb~ b/config/routes.rb~ index 10dd011..833f19c 100644 --- a/config/routes.rb~ +++ b/config/routes.rb~ @@ -1,78 +1,81 @@ -Planet::Application.routes.draw do - - resources :sites - get "types/ordered_index" - resources :types do # Rutas anidadas /types/id/sites..., - get 'ordered_index', :on => :collection - resources :sites, :only => [ :index ] # Restringe a acción “index” - end - - get "planet/index" - - get "planet/contact" - - get "planet/ejemplo" - - get "planet/author" - - get "types/index_ordenado" - - # 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 +Planet::Application.routes.draw do + + resources :comments, :except => [ :new, :index ] + devise_for :users + + resources :sites do + resources :comments, :only => [ :index ] + end + + resources :types do + get 'ordered_index', :on => :collection + resources :sites, :only => [ :index ] # Rutas anidadas /types/id/sites. Restringe a acción “index” + end + + get "planet/index" + + get "planet/contact" + + get "planet/ejemplo" + + get "planet/author" + + # 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 diff --git a/db/migrate/20120410171102_create_comments.rb b/db/migrate/20120410171102_create_comments.rb new file mode 100644 index 0000000..36d0b14 --- /dev/null +++ b/db/migrate/20120410171102_create_comments.rb @@ -0,0 +1,11 @@ +class CreateComments < ActiveRecord::Migration + def change + create_table :comments do |t| + t.string :comment + t.integer :user_id + t.integer :site_id + + t.timestamps + end + end +end diff --git a/db/migrate/20120410202832_create_comments.rb b/db/migrate/20120410202832_create_comments.rb new file mode 100644 index 0000000..36d0b14 --- /dev/null +++ b/db/migrate/20120410202832_create_comments.rb @@ -0,0 +1,11 @@ +class CreateComments < ActiveRecord::Migration + def change + create_table :comments do |t| + t.string :comment + t.integer :user_id + t.integer :site_id + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 75278a9..7cf564d 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 => 20120329080433) do +ActiveRecord::Schema.define(:version => 20120410171102) do + + create_table "comments", :force => true do |t| + t.string "comment" + t.integer "user_id" + t.integer "site_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end create_table "sites", :force => true do |t| t.string "name" diff --git a/test/fixtures/comments.yml b/test/fixtures/comments.yml new file mode 100644 index 0000000..29c9999 --- /dev/null +++ b/test/fixtures/comments.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + comment: MyString + user_id: 1 + site_id: 1 + +two: + comment: MyString + user_id: 1 + site_id: 1 diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb new file mode 100644 index 0000000..b2b500c --- /dev/null +++ b/test/functional/comments_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class CommentsControllerTest < ActionController::TestCase + setup do + @comment = comments(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:comments) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create comment" do + assert_difference('Comment.count') do + post :create, comment: @comment.attributes + end + + assert_redirected_to comment_path(assigns(:comment)) + end + + test "should show comment" do + get :show, id: @comment + assert_response :success + end + + test "should get edit" do + get :edit, id: @comment + assert_response :success + end + + test "should update comment" do + put :update, id: @comment, comment: @comment.attributes + assert_redirected_to comment_path(assigns(:comment)) + end + + test "should destroy comment" do + assert_difference('Comment.count', -1) do + delete :destroy, id: @comment + end + + assert_redirected_to comments_path + end +end diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb new file mode 100644 index 0000000..b6d6131 --- /dev/null +++ b/test/unit/comment_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class CommentTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/comments_helper_test.rb b/test/unit/helpers/comments_helper_test.rb new file mode 100644 index 0000000..2518c16 --- /dev/null +++ b/test/unit/helpers/comments_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class CommentsHelperTest < ActionView::TestCase +end From 2e29504d090c2c7f73e39e49ee72a1231938a781 Mon Sep 17 00:00:00 2001 From: Fran Gil Date: Tue, 17 Apr 2012 19:53:25 +0200 Subject: [PATCH 5/8] planet con visits y trips --- Gemfile | 1 + Gemfile.lock | 2 + Gemfile~ | 78 ++++++------ app/assets/javascripts/application.js | 1 + app/assets/javascripts/application.js~ | 15 +++ app/assets/javascripts/trips.js.coffee | 3 + app/assets/javascripts/visits.js.coffee | 3 + app/assets/stylesheets/application.css | 1 + app/assets/stylesheets/application.css~ | 13 ++ app/assets/stylesheets/trips.css.scss | 3 + app/assets/stylesheets/visits.css.scss | 3 + app/controllers/trips_controller.rb | 86 +++++++++++++ app/controllers/trips_controller.rb~ | 85 +++++++++++++ app/controllers/visits_controller.rb | 84 +++++++++++++ app/controllers/visits_controller.rb~ | 83 +++++++++++++ app/helpers/trips_helper.rb | 2 + app/helpers/visits_helper.rb | 2 + app/models/site.rb | 3 +- app/models/site.rb~ | 2 + app/models/trip.rb | 9 ++ app/models/trip.rb~ | 9 ++ app/models/user.rb | 1 + app/models/visit.rb | 4 + app/models/visit.rb~ | 2 + app/views/layouts/application.html.erb | 3 +- app/views/layouts/application.html.erb~ | 91 ++++++++------ app/views/trips/_form.html.erb | 29 +++++ app/views/trips/_form.html.erb~ | 33 +++++ app/views/trips/_trip.html.erb | 30 +++++ app/views/trips/edit.html.erb | 6 + app/views/trips/index.html.erb | 28 +++++ app/views/trips/index.html.erb~ | 29 +++++ app/views/trips/new.html.erb | 5 + app/views/trips/show.html.erb | 22 ++++ app/views/trips/show.html.erb~ | 22 ++++ app/views/visits/_form.html.erb | 29 +++++ app/views/visits/create.js.erb | 5 + app/views/visits/edit.html.erb | 6 + app/views/visits/index.html.erb | 27 ++++ app/views/visits/new.html.erb | 5 + app/views/visits/show.html.erb | 20 +++ config/routes.rb | 4 + db/migrate/20120417170638_create_trips.rb | 12 ++ db/migrate/20120417172936_create_visits.rb | 11 ++ db/schema.rb | 137 ++++++++++++--------- test/fixtures/trips.yml | 13 ++ test/fixtures/visits.yml | 11 ++ test/functional/trips_controller_test.rb | 49 ++++++++ test/functional/visits_controller_test.rb | 49 ++++++++ test/unit/helpers/trips_helper_test.rb | 4 + test/unit/helpers/visits_helper_test.rb | 4 + test/unit/trip_test.rb | 7 ++ test/unit/visit_test.rb | 7 ++ 53 files changed, 1057 insertions(+), 136 deletions(-) create mode 100644 app/assets/javascripts/application.js~ create mode 100644 app/assets/javascripts/trips.js.coffee create mode 100644 app/assets/javascripts/visits.js.coffee create mode 100644 app/assets/stylesheets/application.css~ create mode 100644 app/assets/stylesheets/trips.css.scss create mode 100644 app/assets/stylesheets/visits.css.scss create mode 100644 app/controllers/trips_controller.rb create mode 100644 app/controllers/trips_controller.rb~ create mode 100644 app/controllers/visits_controller.rb create mode 100644 app/controllers/visits_controller.rb~ create mode 100644 app/helpers/trips_helper.rb create mode 100644 app/helpers/visits_helper.rb create mode 100644 app/models/trip.rb create mode 100644 app/models/trip.rb~ create mode 100644 app/models/visit.rb create mode 100644 app/models/visit.rb~ create mode 100644 app/views/trips/_form.html.erb create mode 100644 app/views/trips/_form.html.erb~ create mode 100644 app/views/trips/_trip.html.erb create mode 100644 app/views/trips/edit.html.erb create mode 100644 app/views/trips/index.html.erb create mode 100644 app/views/trips/index.html.erb~ create mode 100644 app/views/trips/new.html.erb create mode 100644 app/views/trips/show.html.erb create mode 100644 app/views/trips/show.html.erb~ create mode 100644 app/views/visits/_form.html.erb create mode 100644 app/views/visits/create.js.erb create mode 100644 app/views/visits/edit.html.erb create mode 100644 app/views/visits/index.html.erb create mode 100644 app/views/visits/new.html.erb create mode 100644 app/views/visits/show.html.erb create mode 100644 db/migrate/20120417170638_create_trips.rb create mode 100644 db/migrate/20120417172936_create_visits.rb create mode 100644 test/fixtures/trips.yml create mode 100644 test/fixtures/visits.yml create mode 100644 test/functional/trips_controller_test.rb create mode 100644 test/functional/visits_controller_test.rb create mode 100644 test/unit/helpers/trips_helper_test.rb create mode 100644 test/unit/helpers/visits_helper_test.rb create mode 100644 test/unit/trip_test.rb create mode 100644 test/unit/visit_test.rb diff --git a/Gemfile b/Gemfile index f408439..91af3d8 100644 --- a/Gemfile +++ b/Gemfile @@ -22,6 +22,7 @@ group :assets do end gem 'jquery-rails' +gem 'cleditor_rails' # To use ActiveModel has_secure_password # gem 'bcrypt-ruby', '~> 3.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index 6405e84..c002e49 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,6 +32,7 @@ GEM bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1-x86-mingw32) builder (3.0.0) + cleditor_rails (0.0.3) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) @@ -115,6 +116,7 @@ PLATFORMS x86-mingw32 DEPENDENCIES + cleditor_rails coffee-rails (~> 3.2.1) devise jquery-rails diff --git a/Gemfile~ b/Gemfile~ index 7764763..3626fa1 100644 --- a/Gemfile~ +++ b/Gemfile~ @@ -1,38 +1,40 @@ -source 'https://rubygems.org' - -gem 'rails', '3.2.2' - -# Bundle edge Rails instead: -# gem 'rails', :git => 'git://github.com/rails/rails.git' - -gem 'sqlite3' - - -# Gems used only for assets and not required -# in production environments by default. -group :assets do - gem 'sass-rails', '~> 3.2.3' - gem 'coffee-rails', '~> 3.2.1' - - # See https://github.com/sstephenson/execjs#readme for more supported runtimes - # gem 'therubyracer' - - gem 'uglifier', '>= 1.0.3' -end - -gem 'jquery-rails' - -# To use ActiveModel has_secure_password -# gem 'bcrypt-ruby', '~> 3.0.0' - -# To use Jbuilder templates for JSON -# gem 'jbuilder' - -# Use unicorn as the app server -# gem 'unicorn' - -# Deploy with Capistrano -# gem 'capistrano' - -# To use debugger -# gem 'ruby-debug19', :require => 'ruby-debug' +source 'https://rubygems.org' + +gem 'rails', '3.2.2' + +# Bundle edge Rails instead: +# gem 'rails', :git => 'git://github.com/rails/rails.git' + +gem 'sqlite3' + +gem 'devise' + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + # gem 'therubyracer' + + gem 'uglifier', '>= 1.0.3' +end + +gem 'jquery-rails' +gem 'cleditor-rails' + +# To use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.0.0' + +# To use Jbuilder templates for JSON +# gem 'jbuilder' + +# Use unicorn as the app server +# gem 'unicorn' + +# Deploy with Capistrano +# gem 'capistrano' + +# To use debugger +# gem 'ruby-debug19', :require => 'ruby-debug' diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c690d2a..1d4dbd6 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,3 +13,4 @@ //= require jquery //= require jquery_ujs //= require_tree . +//= require cleditor diff --git a/app/assets/javascripts/application.js~ b/app/assets/javascripts/application.js~ new file mode 100644 index 0000000..c690d2a --- /dev/null +++ b/app/assets/javascripts/application.js~ @@ -0,0 +1,15 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/app/assets/javascripts/trips.js.coffee b/app/assets/javascripts/trips.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/trips.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/javascripts/visits.js.coffee b/app/assets/javascripts/visits.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/visits.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/application.css b/app/assets/stylesheets/application.css index 4561cc1..ce0584f 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -9,5 +9,6 @@ * compiled file, but it's generally better to create a new file per style scope. * *= require_self + *= require cleditor *= require_tree . */ diff --git a/app/assets/stylesheets/application.css~ b/app/assets/stylesheets/application.css~ new file mode 100644 index 0000000..4561cc1 --- /dev/null +++ b/app/assets/stylesheets/application.css~ @@ -0,0 +1,13 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the top of the + * compiled file, but it's generally better to create a new file per style scope. + * + *= require_self + *= require_tree . +*/ diff --git a/app/assets/stylesheets/trips.css.scss b/app/assets/stylesheets/trips.css.scss new file mode 100644 index 0000000..473cbc3 --- /dev/null +++ b/app/assets/stylesheets/trips.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the trips controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/visits.css.scss b/app/assets/stylesheets/visits.css.scss new file mode 100644 index 0000000..99b00b9 --- /dev/null +++ b/app/assets/stylesheets/visits.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the visits 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/trips_controller.rb b/app/controllers/trips_controller.rb new file mode 100644 index 0000000..7232e00 --- /dev/null +++ b/app/controllers/trips_controller.rb @@ -0,0 +1,86 @@ +class TripsController < ApplicationController +before_filter :authenticate_user!, :except => [ :index, :show ] + + # GET /trips + # GET /trips.json + def index + @trips = Trip.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @trips } + end + end + + # GET /trips/1 + # GET /trips/1.json + def show + @trip = Trip.find(params[:id]) + @visit = @trip.visits.build + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @trip } + end + end + + # GET /trips/new + # GET /trips/new.json + def new + @trip = current_user.trips.build + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @trip } + end + end + + # GET /trips/1/edit + def edit + @trip = current_user.trips.find(params[:id]) + end + + # POST /trips + # POST /trips.json + def create + @trip = current_user.trips.build(params[:trip]) + + respond_to do |format| + if @trip.save + format.html { redirect_to @trip, notice: 'Trip was successfully created.' } + format.json { render json: @trip, status: :created, location: @trip } + else + format.html { render action: "new" } + format.json { render json: @trip.errors, status: :unprocessable_entity } + end + end + end + + # PUT /trips/1 + # PUT /trips/1.json + def update + @trip = current_user.trips.find(params[:id]) + + respond_to do |format| + if @trip.update_attributes(params[:trip]) + format.html { redirect_to @trip, notice: 'Trip was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @trip.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /trips/1 + # DELETE /trips/1.json + def destroy + @trip = current_user.trips.find(params[:id]) + @trip.destroy + + respond_to do |format| + format.html { redirect_to trips_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/trips_controller.rb~ b/app/controllers/trips_controller.rb~ new file mode 100644 index 0000000..7d256ff --- /dev/null +++ b/app/controllers/trips_controller.rb~ @@ -0,0 +1,85 @@ +class TripsController < ApplicationController +before_filter :authenticate_user!, :except => [ :index, :show ] + + # GET /trips + # GET /trips.json + def index + @trips = Trip.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @trips } + end + end + + # GET /trips/1 + # GET /trips/1.json + def show + @trip = Trip.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @trip } + end + end + + # GET /trips/new + # GET /trips/new.json + def new + @trip = current_user.trips.build + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @trip } + end + end + + # GET /trips/1/edit + def edit + @trip = current_user.trips.find(params[:id]) + end + + # POST /trips + # POST /trips.json + def create + @trip = current_user.trips.build(params[:trip]) + + respond_to do |format| + if @trip.save + format.html { redirect_to @trip, notice: 'Trip was successfully created.' } + format.json { render json: @trip, status: :created, location: @trip } + else + format.html { render action: "new" } + format.json { render json: @trip.errors, status: :unprocessable_entity } + end + end + end + + # PUT /trips/1 + # PUT /trips/1.json + def update + @trip = current_user.trips.find(params[:id]) + + respond_to do |format| + if @trip.update_attributes(params[:trip]) + format.html { redirect_to @trip, notice: 'Trip was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @trip.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /trips/1 + # DELETE /trips/1.json + def destroy + @trip = current_user.trips.find(params[:id]) + @trip.destroy + + respond_to do |format| + format.html { redirect_to trips_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/visits_controller.rb b/app/controllers/visits_controller.rb new file mode 100644 index 0000000..52d83b1 --- /dev/null +++ b/app/controllers/visits_controller.rb @@ -0,0 +1,84 @@ +class VisitsController < ApplicationController + # GET /visits + # GET /visits.json + def index + @visits = Visit.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @visits } + end + end + + # GET /visits/1 + # GET /visits/1.json + def show + @visit = Visit.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @visit } + end + end + + # GET /visits/new + # GET /visits/new.json + def new + @visit = Visit.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @visit } + end + end + + # GET /visits/1/edit + def edit + @visit = Visit.find(params[:id]) + end + + # POST /visits + # POST /visits.json + def create + @visit = Visit.new(params[:visit]) + + respond_to do |format| + if @visit.save + format.html { redirect_to @visit.trip, notice: 'Visit was successfully created.' } + format.js + format.json { render json: @visit, status: :created, location: @visit } + else + format.html { render action: "new" } + format.json { render json: @visit.errors, status: :unprocessable_entity } + end + end + end + + # PUT /visits/1 + # PUT /visits/1.json + def update + @visit = Visit.find(params[:id]) + + respond_to do |format| + if @visit.update_attributes(params[:visit]) + format.html { redirect_to @visit.trip, notice: 'Visit was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @visit.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /visits/1 + # DELETE /visits/1.json + def destroy + @visit = Visit.find(params[:id]) + @visit.destroy + + respond_to do |format| + format.html { redirect_to @visits.trip } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/visits_controller.rb~ b/app/controllers/visits_controller.rb~ new file mode 100644 index 0000000..4d9ff9d --- /dev/null +++ b/app/controllers/visits_controller.rb~ @@ -0,0 +1,83 @@ +class VisitsController < ApplicationController + # GET /visits + # GET /visits.json + def index + @visits = Visit.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @visits } + end + end + + # GET /visits/1 + # GET /visits/1.json + def show + @visit = Visit.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @visit } + end + end + + # GET /visits/new + # GET /visits/new.json + def new + @visit = Visit.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @visit } + end + end + + # GET /visits/1/edit + def edit + @visit = Visit.find(params[:id]) + end + + # POST /visits + # POST /visits.json + def create + @visit = Visit.new(params[:visit]) + + respond_to do |format| + if @visit.save + format.html { redirect_to @visit.trip, notice: 'Visit was successfully created.' } + format.json { render json: @visit, status: :created, location: @visit } + else + format.html { render action: "new" } + format.json { render json: @visit.errors, status: :unprocessable_entity } + end + end + end + + # PUT /visits/1 + # PUT /visits/1.json + def update + @visit = Visit.find(params[:id]) + + respond_to do |format| + if @visit.update_attributes(params[:visit]) + format.html { redirect_to @visit.trip, notice: 'Visit was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @visit.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /visits/1 + # DELETE /visits/1.json + def destroy + @visit = Visit.find(params[:id]) + @visit.destroy + + respond_to do |format| + format.html { redirect_to @visits.trip } + format.json { head :no_content } + end + end +end diff --git a/app/helpers/trips_helper.rb b/app/helpers/trips_helper.rb new file mode 100644 index 0000000..04f333d --- /dev/null +++ b/app/helpers/trips_helper.rb @@ -0,0 +1,2 @@ +module TripsHelper +end diff --git a/app/helpers/visits_helper.rb b/app/helpers/visits_helper.rb new file mode 100644 index 0000000..8ce5f83 --- /dev/null +++ b/app/helpers/visits_helper.rb @@ -0,0 +1,2 @@ +module VisitsHelper +end diff --git a/app/models/site.rb b/app/models/site.rb index ab32f25..fe27311 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -1,7 +1,8 @@ class Site < ActiveRecord::Base belongs_to :type belongs_to :user - + has_many :visits + has_many :trips, :through => :visits has_many :comments # Debe estar protegido para evitar accesos indeseados diff --git a/app/models/site.rb~ b/app/models/site.rb~ index ec39f92..ab32f25 100644 --- a/app/models/site.rb~ +++ b/app/models/site.rb~ @@ -1,6 +1,8 @@ class Site < ActiveRecord::Base belongs_to :type belongs_to :user + + has_many :comments # Debe estar protegido para evitar accesos indeseados attr_protected :user_id diff --git a/app/models/trip.rb b/app/models/trip.rb new file mode 100644 index 0000000..dfb6c60 --- /dev/null +++ b/app/models/trip.rb @@ -0,0 +1,9 @@ +# Modelo de Trip y User con relación uno-a-muchos: +# -> belongs_to :user referencia un objeto User +class Trip < ActiveRecord::Base +belongs_to :user +has_many :visits +has_many :sites, :through => :visits +# Se añade relacion +attr_protected :user_id # Por seguridad +end diff --git a/app/models/trip.rb~ b/app/models/trip.rb~ new file mode 100644 index 0000000..dfb6c60 --- /dev/null +++ b/app/models/trip.rb~ @@ -0,0 +1,9 @@ +# Modelo de Trip y User con relación uno-a-muchos: +# -> belongs_to :user referencia un objeto User +class Trip < ActiveRecord::Base +belongs_to :user +has_many :visits +has_many :sites, :through => :visits +# Se añade relacion +attr_protected :user_id # Por seguridad +end diff --git a/app/models/user.rb b/app/models/user.rb index 0925503..b3643df 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,6 +2,7 @@ class User < ActiveRecord::Base has_many :sites has_many :comments + has_many :trips # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable diff --git a/app/models/visit.rb b/app/models/visit.rb new file mode 100644 index 0000000..6ae1de6 --- /dev/null +++ b/app/models/visit.rb @@ -0,0 +1,4 @@ +class Visit < ActiveRecord::Base +belongs_to :trip +belongs_to :site +end diff --git a/app/models/visit.rb~ b/app/models/visit.rb~ new file mode 100644 index 0000000..a950b2a --- /dev/null +++ b/app/models/visit.rb~ @@ -0,0 +1,2 @@ +class Visit < ActiveRecord::Base +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e674df2..879f9bb 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -39,6 +39,7 @@
  • <%= link_to type.name, type_sites_path(type) %>
  • <% end %> + <%= link_to "Viajes", trips_path %>
    <%= link_to "Contact", planet_contact_path %>
    <%= link_to "Sign up", new_user_registration_path if !current_user %> @@ -52,4 +53,4 @@ - \ No newline at end of file + diff --git a/app/views/layouts/application.html.erb~ b/app/views/layouts/application.html.erb~ index 235508a..e674df2 100644 --- a/app/views/layouts/application.html.erb~ +++ b/app/views/layouts/application.html.erb~ @@ -1,36 +1,55 @@ - - - - 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 "Contact", planet_contact_path %> -
    -
    -<%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', ordered_index_path) %> - <%= yield %> -<%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', ordered_index_path) %> -
    -
    - - - + + + + Planet + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + + + + + +
    + <% if current_user %> + <%= link_to current_user.name, + edit_user_registration_path %> | + <%= link_to "Sign out", destroy_user_session_path, :method => :delete %> + <% else %> + <%= link_to "Sign in", new_user_session_path %> + <% end %> +
    + +
    +
    + <%= link_to "Home", planet_index_path %>
    + <%= link_to "Tipos", types_path %>
    + <%= link_to "Sitios", sites_path %>
    +
      + <% Type.all.each do |type| %> +
    • <%= link_to type.name, type_sites_path(type) %>
    • + <% end %> +
    + <%= link_to "Contact", planet_contact_path %>
    + <%= link_to "Sign up", new_user_registration_path if !current_user %> +
    +
    +

    <%= notice %>

    <%= alert %>

    + <%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', ordered_index_types_path) %> + <%= yield %> +

    + <%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', ordered_index_types_path) %> +

    +
    +
    + + \ No newline at end of file diff --git a/app/views/trips/_form.html.erb b/app/views/trips/_form.html.erb new file mode 100644 index 0000000..34b1a6f --- /dev/null +++ b/app/views/trips/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for(@trip) do |f| %> + <% if @trip.errors.any? %> +
    +

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

    + +
      + <% @trip.errors.full_messages.each do |msg| %> +
    • <%= msg %>
    • + <% end %> +
    +
    + <% end %> + +
    + <%= f.label :name %>
    + <%= f.text_field :name %> +
    +
    + <%= f.label :description %>
    + <%= f.text_area :description %> +
    +
    + <%= f.label :date %>
    + <%= f.date_select :date %> +
    +
    + <%= f.submit %> +
    +<% end %> diff --git a/app/views/trips/_form.html.erb~ b/app/views/trips/_form.html.erb~ new file mode 100644 index 0000000..3f1ef01 --- /dev/null +++ b/app/views/trips/_form.html.erb~ @@ -0,0 +1,33 @@ +<%= form_for(@trip) do |f| %> + <% if @trip.errors.any? %> +
    +

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

    + +
      + <% @trip.errors.full_messages.each do |msg| %> +
    • <%= msg %>
    • + <% end %> +
    +
    + <% end %> + +
    + <%= f.label :name %>
    + <%= f.text_field :name %> +
    +
    + <%= f.label :description %>
    + <%= f.text_area :description %> +
    +
    + <%= f.label :date %>
    + <%= f.date_select :date %> +
    +
    + <%= f.label :user_id %>
    + <%= f.number_field :user_id %> +
    +
    + <%= f.submit %> +
    +<% end %> diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb new file mode 100644 index 0000000..fd146f2 --- /dev/null +++ b/app/views/trips/_trip.html.erb @@ -0,0 +1,30 @@ +
    + + <% 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/trips/edit.html.erb b/app/views/trips/edit.html.erb new file mode 100644 index 0000000..71287a4 --- /dev/null +++ b/app/views/trips/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing trip

    + +<%= render 'form' %> + +<%= link_to 'Show', @trip %> | +<%= link_to 'Back', trips_path %> diff --git a/app/views/trips/index.html.erb b/app/views/trips/index.html.erb new file mode 100644 index 0000000..61a904c --- /dev/null +++ b/app/views/trips/index.html.erb @@ -0,0 +1,28 @@ +
    +

    Viajes

    + + <% @trips.each do |trip| %> + + + + +<% end %> +
    +
    +
    <%= link_to trip.name, trip_path(trip) %>
    +
    <%= truncate(strip_tags(trip.description), + :length => 80) + ', ' + trip.date.to_s %>
    +
    +
    + <%= link_to 'Show', trip %>
    + <% if site.user == current_user %> + <%= link_to 'Edit', edit_trip_path(trip) %>
    + <%= link_to 'Destroy', trip, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %> +
    +

    + +<%= link_to 'New Trip', new_trip_path %> + diff --git a/app/views/trips/index.html.erb~ b/app/views/trips/index.html.erb~ new file mode 100644 index 0000000..47f649b --- /dev/null +++ b/app/views/trips/index.html.erb~ @@ -0,0 +1,29 @@ +

    Listing trips

    + + + + + + + + + + + + +<% @trips.each do |trip| %> + + + + + + + + + +<% end %> +
    NameDescriptionDateUser
    <%= trip.name %><%= trip.description %><%= trip.date %><%= trip.user_id %><%= link_to 'Show', trip %><%= link_to 'Edit', edit_trip_path(trip) %><%= link_to 'Destroy', trip, confirm: 'Are you sure?', method: :delete %>
    + +
    + +<%= link_to 'New Trip', new_trip_path %> diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb new file mode 100644 index 0000000..dd3e49d --- /dev/null +++ b/app/views/trips/new.html.erb @@ -0,0 +1,5 @@ +

    New trip

    + +<%= render 'form' %> + +<%= link_to 'Back', trips_path %> diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb new file mode 100644 index 0000000..98fa460 --- /dev/null +++ b/app/views/trips/show.html.erb @@ -0,0 +1,22 @@ +

    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, :remote => true) 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 %> + diff --git a/app/views/trips/show.html.erb~ b/app/views/trips/show.html.erb~ new file mode 100644 index 0000000..f164547 --- /dev/null +++ b/app/views/trips/show.html.erb~ @@ -0,0 +1,22 @@ +

    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 %> + diff --git a/app/views/visits/_form.html.erb b/app/views/visits/_form.html.erb new file mode 100644 index 0000000..12ab912 --- /dev/null +++ b/app/views/visits/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for(@visit) do |f| %> + <% if @visit.errors.any? %> +
    +

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

    + +
      + <% @visit.errors.full_messages.each do |msg| %> +
    • <%= msg %>
    • + <% end %> +
    +
    + <% end %> + +
    + <%= f.label :trip_id %>
    + <%= f.number_field :trip_id %> +
    +
    + <%= f.label :site_id %>
    + <%= f.number_field :site_id %> +
    +
    + <%= f.label :hour %>
    + <%= f.number_field :hour %> +
    +
    + <%= f.submit %> +
    +<% end %> diff --git a/app/views/visits/create.js.erb b/app/views/visits/create.js.erb new file mode 100644 index 0000000..4619ec3 --- /dev/null +++ b/app/views/visits/create.js.erb @@ -0,0 +1,5 @@ +// Programa jQuery/Javascript +// -> sustituye la lista de visitas de un viaje en DOM +// -> HTML se genera en servidor con ERb +$('#visit').html("<%= j render @visit.trip %>"); + diff --git a/app/views/visits/edit.html.erb b/app/views/visits/edit.html.erb new file mode 100644 index 0000000..66d34d9 --- /dev/null +++ b/app/views/visits/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing visit

    + +<%= render 'form' %> + +<%= link_to 'Show', @visit %> | +<%= link_to 'Back', visits_path %> diff --git a/app/views/visits/index.html.erb b/app/views/visits/index.html.erb new file mode 100644 index 0000000..c7bea46 --- /dev/null +++ b/app/views/visits/index.html.erb @@ -0,0 +1,27 @@ +

    Listing visits

    + + + + + + + + + + + +<% @visits.each do |visit| %> + + + + + + + + +<% end %> +
    TripSiteHour
    <%= visit.trip_id %><%= visit.site_id %><%= visit.hour %><%= link_to 'Show', visit %><%= link_to 'Edit', edit_visit_path(visit) %><%= link_to 'Destroy', visit, confirm: 'Are you sure?', method: :delete %>
    + +
    + +<%= link_to 'New Visit', new_visit_path %> diff --git a/app/views/visits/new.html.erb b/app/views/visits/new.html.erb new file mode 100644 index 0000000..1be1930 --- /dev/null +++ b/app/views/visits/new.html.erb @@ -0,0 +1,5 @@ +

    New visit

    + +<%= render 'form' %> + +<%= link_to 'Back', visits_path %> diff --git a/app/views/visits/show.html.erb b/app/views/visits/show.html.erb new file mode 100644 index 0000000..2bf41f5 --- /dev/null +++ b/app/views/visits/show.html.erb @@ -0,0 +1,20 @@ +

    <%= notice %>

    + +

    + Trip: + <%= @visit.trip_id %> +

    + +

    + Site: + <%= @visit.site_id %> +

    + +

    + Hour: + <%= @visit.hour %> +

    + + +<%= link_to 'Edit', edit_visit_path(@visit) %> | +<%= link_to 'Back', visits_path %> diff --git a/config/routes.rb b/config/routes.rb index ff5a379..73e0ef0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,9 @@ Planet::Application.routes.draw do + resources :visits + + resources :trips + resources :comments, :except => [ :new, :index ] devise_for :users diff --git a/db/migrate/20120417170638_create_trips.rb b/db/migrate/20120417170638_create_trips.rb new file mode 100644 index 0000000..9acf33c --- /dev/null +++ b/db/migrate/20120417170638_create_trips.rb @@ -0,0 +1,12 @@ +class CreateTrips < ActiveRecord::Migration + def change + create_table :trips do |t| + t.string :name + t.text :description + t.date :date + t.integer :user_id + + t.timestamps + end + end +end diff --git a/db/migrate/20120417172936_create_visits.rb b/db/migrate/20120417172936_create_visits.rb new file mode 100644 index 0000000..248b6be --- /dev/null +++ b/db/migrate/20120417172936_create_visits.rb @@ -0,0 +1,11 @@ +class CreateVisits < ActiveRecord::Migration + def change + create_table :visits do |t| + t.integer :trip_id + t.integer :site_id + t.integer :hour + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 7cf564d..b20a373 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,60 +1,77 @@ -# 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 => 20120410171102) do - - create_table "comments", :force => true do |t| - t.string "comment" - t.integer "user_id" - t.integer "site_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "sites", :force => true do |t| - t.string "name" - 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" - 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 - -end +# 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 => 20120417172936) do + + create_table "comments", :force => true do |t| + t.string "comment" + t.integer "user_id" + t.integer "site_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "sites", :force => true do |t| + t.string "name" + 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" + 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 diff --git a/test/fixtures/trips.yml b/test/fixtures/trips.yml new file mode 100644 index 0000000..4afcf18 --- /dev/null +++ b/test/fixtures/trips.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + name: MyString + description: MyText + date: 2012-04-17 + user_id: 1 + +two: + name: MyString + description: MyText + date: 2012-04-17 + user_id: 1 diff --git a/test/fixtures/visits.yml b/test/fixtures/visits.yml new file mode 100644 index 0000000..6a15000 --- /dev/null +++ b/test/fixtures/visits.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + trip_id: 1 + site_id: 1 + hour: 1 + +two: + trip_id: 1 + site_id: 1 + hour: 1 diff --git a/test/functional/trips_controller_test.rb b/test/functional/trips_controller_test.rb new file mode 100644 index 0000000..b09dce2 --- /dev/null +++ b/test/functional/trips_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class TripsControllerTest < ActionController::TestCase + setup do + @trip = trips(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:trips) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create trip" do + assert_difference('Trip.count') do + post :create, trip: @trip.attributes + end + + assert_redirected_to trip_path(assigns(:trip)) + end + + test "should show trip" do + get :show, id: @trip + assert_response :success + end + + test "should get edit" do + get :edit, id: @trip + assert_response :success + end + + test "should update trip" do + put :update, id: @trip, trip: @trip.attributes + assert_redirected_to trip_path(assigns(:trip)) + end + + test "should destroy trip" do + assert_difference('Trip.count', -1) do + delete :destroy, id: @trip + end + + assert_redirected_to trips_path + end +end diff --git a/test/functional/visits_controller_test.rb b/test/functional/visits_controller_test.rb new file mode 100644 index 0000000..45397e3 --- /dev/null +++ b/test/functional/visits_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class VisitsControllerTest < ActionController::TestCase + setup do + @visit = visits(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:visits) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create visit" do + assert_difference('Visit.count') do + post :create, visit: @visit.attributes + end + + assert_redirected_to visit_path(assigns(:visit)) + end + + test "should show visit" do + get :show, id: @visit + assert_response :success + end + + test "should get edit" do + get :edit, id: @visit + assert_response :success + end + + test "should update visit" do + put :update, id: @visit, visit: @visit.attributes + assert_redirected_to visit_path(assigns(:visit)) + end + + test "should destroy visit" do + assert_difference('Visit.count', -1) do + delete :destroy, id: @visit + end + + assert_redirected_to visits_path + end +end diff --git a/test/unit/helpers/trips_helper_test.rb b/test/unit/helpers/trips_helper_test.rb new file mode 100644 index 0000000..dcfddff --- /dev/null +++ b/test/unit/helpers/trips_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class TripsHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/visits_helper_test.rb b/test/unit/helpers/visits_helper_test.rb new file mode 100644 index 0000000..6f1596c --- /dev/null +++ b/test/unit/helpers/visits_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class VisitsHelperTest < ActionView::TestCase +end diff --git a/test/unit/trip_test.rb b/test/unit/trip_test.rb new file mode 100644 index 0000000..1ed8ca6 --- /dev/null +++ b/test/unit/trip_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TripTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/visit_test.rb b/test/unit/visit_test.rb new file mode 100644 index 0000000..a34aa33 --- /dev/null +++ b/test/unit/visit_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class VisitTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From cdf44eca4fd362b91d693cddf3012a9488d78325 Mon Sep 17 00:00:00 2001 From: Fran Gil Date: Tue, 17 Apr 2012 22:28:05 +0200 Subject: [PATCH 6/8] Visits funcionando --- app/models/site.rb | 2 +- app/models/site.rb~ | 3 +- app/views/trips/_trip.html.erb | 2 +- app/views/trips/_trip.html.erb~ | 30 +++++++++++++++++ app/views/trips/index.html.erb | 2 +- app/views/trips/index.html.erb~ | 49 ++++++++++++++-------------- app/views/trips/show.html.erb | 55 +++++++++++++++++++++---------- app/views/trips/show.html.erb~ | 58 ++++++++++++++++++++++++--------- 8 files changed, 139 insertions(+), 62 deletions(-) create mode 100644 app/views/trips/_trip.html.erb~ diff --git a/app/models/site.rb b/app/models/site.rb index fe27311..c1145b7 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -2,7 +2,7 @@ class Site < ActiveRecord::Base belongs_to :type belongs_to :user has_many :visits - has_many :trips, :through => :visits + has_many :trips, :through => :visits has_many :comments # Debe estar protegido para evitar accesos indeseados diff --git a/app/models/site.rb~ b/app/models/site.rb~ index ab32f25..c1145b7 100644 --- a/app/models/site.rb~ +++ b/app/models/site.rb~ @@ -1,7 +1,8 @@ class Site < ActiveRecord::Base belongs_to :type belongs_to :user - + has_many :visits + has_many :trips, :through => :visits has_many :comments # Debe estar protegido para evitar accesos indeseados diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb index fd146f2..779594c 100644 --- 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| %> - <%= 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 100644 index 0000000..779594c --- /dev/null +++ b/app/views/trips/_trip.html.erb~ @@ -0,0 +1,30 @@ +
    + + <% 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/trips/index.html.erb b/app/views/trips/index.html.erb index 61a904c..dbab91f 100644 --- a/app/views/trips/index.html.erb +++ b/app/views/trips/index.html.erb @@ -12,7 +12,7 @@ <%= link_to 'Show', trip %>
    - <% if site.user == current_user %> + <% if trip.user == current_user %> <%= link_to 'Edit', edit_trip_path(trip) %>
    <%= link_to 'Destroy', trip, :confirm => 'Are you sure?', diff --git a/app/views/trips/index.html.erb~ b/app/views/trips/index.html.erb~ index 47f649b..61a904c 100644 --- a/app/views/trips/index.html.erb~ +++ b/app/views/trips/index.html.erb~ @@ -1,29 +1,28 @@ -

    Listing trips

    - - - - - - - - - - - - -<% @trips.each do |trip| %> - - - - - - - - - +
    +

    Viajes

    +
    NameDescriptionDateUser
    <%= trip.name %><%= trip.description %><%= trip.date %><%= trip.user_id %><%= link_to 'Show', trip %><%= link_to 'Edit', edit_trip_path(trip) %><%= link_to 'Destroy', trip, confirm: 'Are you sure?', method: :delete %>
    + <% @trips.each do |trip| %> + + + + <% end %>
    +
    +
    <%= link_to trip.name, trip_path(trip) %>
    +
    <%= truncate(strip_tags(trip.description), + :length => 80) + ', ' + trip.date.to_s %>
    +
    +
    + <%= link_to 'Show', trip %>
    + <% if site.user == current_user %> + <%= link_to 'Edit', edit_trip_path(trip) %>
    + <%= link_to 'Destroy', trip, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %> +
    - -
    +
    <%= link_to 'New Trip', new_trip_path %> + diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 98fa460..ec0e077 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -1,22 +1,43 @@ -

    Name: <%= @trip.name %>

    -

    Date: <%= @trip.date %>

    -

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

    -

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

    +

    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, :remote => true) 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 %> + + <%= 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 %> + diff --git a/app/views/trips/show.html.erb~ b/app/views/trips/show.html.erb~ index f164547..8ea0050 100644 --- a/app/views/trips/show.html.erb~ +++ b/app/views/trips/show.html.erb~ @@ -1,22 +1,48 @@ -

    Name: <%= @trip.name %>

    -

    Date: <%= @trip.date %>

    -

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

    -

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

    +

    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 %> + + + + <%= 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 %> + From cfd921fc013f2294dabe972e77df0779a643020e Mon Sep 17 00:00:00 2001 From: Fran Gil Date: Fri, 20 Apr 2012 17:50:58 +0200 Subject: [PATCH 7/8] Entrega 7 --- app/assets/stylesheets/planet.css | 9 ++ app/controllers/comments_controller.rb | 8 +- app/controllers/sites_controller.rb | 7 +- app/models/comment.rb | 2 +- app/views/comments/_form.html.erb | 7 +- app/views/comments/edit.html.erb | 4 +- app/views/comments/index.html.erb | 4 +- app/views/comments/new.html.erb | 2 + app/views/comments/show.html.erb | 2 - app/views/sites/_form.html.erb | 12 ++ app/views/sites/_form.html.erb~ | 45 ++++++ app/views/sites/_newform.html.erb | 69 +++++++++ app/views/sites/_newform.html.erb~ | 65 +++++++++ app/views/sites/_newformantiguo.html.erb | 65 +++++++++ app/views/sites/index.html.erb | 4 +- app/views/sites/new.html.erb | 3 +- app/views/sites/new.html.erb~ | 5 + app/views/sites/show.html.erb | 80 ++++++++--- app/views/sites/show.html.erb~ | 62 ++++++++ app/views/sites/showantiguo.html.erb | 61 ++++++++ app/views/trips/show.html.erb | 96 +++++++------ app/views/trips/show.html.erb~ | 64 +++++---- config/routes.rb | 10 +- db/migrate/20120320100145_create_sites.rb | 3 +- db/migrate/20120320100145_create_sites.rb~ | 14 ++ db/migrate/20120329080433_user_sites.rb | 2 + db/migrate/20120329080433_user_sites.rb~ | 19 +++ db/migrate/20120417205239_coords.rb | 18 +++ db/migrate/20120417205239_coords.rb~ | 7 + db/schema.rb | 157 +++++++++++---------- 30 files changed, 720 insertions(+), 186 deletions(-) create mode 100644 app/views/sites/_form.html.erb~ create mode 100644 app/views/sites/_newform.html.erb create mode 100644 app/views/sites/_newform.html.erb~ create mode 100644 app/views/sites/_newformantiguo.html.erb create mode 100644 app/views/sites/new.html.erb~ create mode 100644 app/views/sites/show.html.erb~ create mode 100644 app/views/sites/showantiguo.html.erb create mode 100644 db/migrate/20120320100145_create_sites.rb~ create mode 100644 db/migrate/20120329080433_user_sites.rb~ create mode 100644 db/migrate/20120417205239_coords.rb create mode 100644 db/migrate/20120417205239_coords.rb~ diff --git a/app/assets/stylesheets/planet.css b/app/assets/stylesheets/planet.css index fc22479..1154389 100644 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -100,6 +100,11 @@ background: white; } +#map_canvas { + width: 100%; + height: 600px; +} + #side { float: left; padding-top: 1em; @@ -113,6 +118,10 @@ color: #bfb; font-size: small; } + +#site .visitas { + text-indent: 70%; +} /* END:mainlayout */ /* An entry in the store catalog (no utilizados de momento) */ diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index eda8d8a..57fb033 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -8,7 +8,7 @@ class CommentsController < ApplicationController def index @site = Site.find(params[:site_id]) @comments = @site.comments - @comment = current_user.comments.build + @comment = current_user.comments.build if current_user respond_to do |format| format.html # index.html.erb @@ -48,10 +48,11 @@ def edit # POST /comments.json def create @comment = current_user.comments.build(params[:comment]) + @site = @comment.site respond_to do |format| if @comment.save - format.html { redirect_to site_path(@comment.site), notice: 'Comment was successfully created.' } + format.html { redirect_to site_path(@site), notice: 'Comment was successfully created.' } format.json { render json: @comment, status: :created, location: @comment } else format.html { render action: "new" } @@ -64,10 +65,11 @@ def create # PUT /comments/1.json def update @comment = current_user.comments.find(params[:id]) + @site = @comment.site respond_to do |format| if @comment.update_attributes(params[:comment]) - format.html { redirect_to site_path(@comment.site), notice: 'Comment was successfully updated.' } + format.html { redirect_to site_path(@site), notice: 'Comment was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 8d44a66..a0f1717 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -7,10 +7,11 @@ class SitesController < ApplicationController # GET /sites.json def index if params[:type_id].nil? or params[:type_id].empty? - @sites = Site.all # path: /types - else + @sites = Site.all # path: /sites + 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 } @@ -21,7 +22,7 @@ def index # GET /sites/1.json def show @site = Site.find(params[:id]) - @comment = current_user.comments.build + @comment = current_user.comments.build if current_user respond_to do |format| format.html # show.html.erb diff --git a/app/models/comment.rb b/app/models/comment.rb index 8b7c248..04b8b8b 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -3,7 +3,7 @@ class Comment < ActiveRecord::Base belongs_to :user # Debe estar protegido para evitar accesos indeseados - #attr_protected :user_id + attr_protected :user_id # Se añaden estas definiciones validates :comment, :user_id, :site_id, :presence => true # campo obligatorio diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index 8701bb3..2716990 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -4,9 +4,9 @@

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

      - <% @comment.errors.full_messages.each do |msg| %> -
    • <%= msg %>
    • - <% end %> + <% @comment.errors.full_messages.each do |msg| %> +
    • <%= msg %>
    • + <% end %>
    <% end %> @@ -15,7 +15,6 @@
    <%= f.text_area :comment, :maxlength => 240, :rows => 6 %>
    - <%= f.number_field :user_id, :value => current_user.id, :hidden => true %> <%= f.number_field :site_id, :value => @site.id, :hidden => true %>
    <%= f.submit %> diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb index 09acee5..63612d9 100644 --- a/app/views/comments/edit.html.erb +++ b/app/views/comments/edit.html.erb @@ -2,5 +2,7 @@ <%= render 'form' %> -<%= link_to 'Back', site_path(@comment.site) %> +

    + +<%= link_to 'Back', site_path(@site) %> diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb index 51288d3..62a085a 100644 --- a/app/views/comments/index.html.erb +++ b/app/views/comments/index.html.erb @@ -2,6 +2,8 @@ <%= render 'comment' %> -<%= render 'form' %> +

    + +<%= render 'form' if current_user %> <%= link_to 'Back', sites_path %> diff --git a/app/views/comments/new.html.erb b/app/views/comments/new.html.erb index 07a754a..61c92f4 100644 --- a/app/views/comments/new.html.erb +++ b/app/views/comments/new.html.erb @@ -2,4 +2,6 @@ <%= render 'form' %> +

    + <%= link_to 'Back', comments_path %> diff --git a/app/views/comments/show.html.erb b/app/views/comments/show.html.erb index ba05818..21b60e6 100644 --- a/app/views/comments/show.html.erb +++ b/app/views/comments/show.html.erb @@ -1,5 +1,3 @@ -

    <%= notice %>

    -

    Comment: <%= @comment.comment %> diff --git a/app/views/sites/_form.html.erb b/app/views/sites/_form.html.erb index ab5f21a..68b318d 100644 --- a/app/views/sites/_form.html.erb +++ b/app/views/sites/_form.html.erb @@ -27,6 +27,18 @@ <%= f.label :image_url %>
    <%= f.text_field :image_url %>

    +
    + <%= f.label :latitud %>
    + <%= f.text_field :latitud, id:'latitud' %> +
    +
    + <%= f.label :longitud %>
    + <%= f.text_field :longitud, id:'longitud' %> +
    +
    + <%= f.label :zoom %>
    + <%= f.number_field :zoom %> +
    <%= f.submit %>
    diff --git a/app/views/sites/_form.html.erb~ b/app/views/sites/_form.html.erb~ new file mode 100644 index 0000000..7fdb626 --- /dev/null +++ b/app/views/sites/_form.html.erb~ @@ -0,0 +1,45 @@ +<%= 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 :longitud %>
    + <%= f.text_field :longitud %> +
    +
    + <%= f.label :latitud %>
    + <%= f.text_field :latitud %> +
    +
    + <%= f.label :zoom %>
    + <%= f.text_field :zoom %> +
    +
    + <%= f.submit %> +
    +<% end %> diff --git a/app/views/sites/_newform.html.erb b/app/views/sites/_newform.html.erb new file mode 100644 index 0000000..f8875aa --- /dev/null +++ b/app/views/sites/_newform.html.erb @@ -0,0 +1,69 @@ + + + + + + + + + <%= 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, id:'latitud' %> +
    +
    + <%= f.label :longitud %>
    + <%= f.text_field :longitud, id:'longitud' %> +
    +
    + <%= f.label :zoom %>
    + <%= f.number_field :zoom, :value => 15 %> +
    + +
    + <%= f.submit %> +
    + + <% end %> + + diff --git a/app/views/sites/_newform.html.erb~ b/app/views/sites/_newform.html.erb~ new file mode 100644 index 0000000..8a6cd87 --- /dev/null +++ b/app/views/sites/_newform.html.erb~ @@ -0,0 +1,65 @@ + + + + + + + + + +<%= 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.number_field :latitud, :value => @site.latitud, :hidden => true, :id => "latitud" %> + <%= f.number_field :longitud, :value => @site.longitud, :hidden => true, :id => "longitud" %> +
    + <%= f.label :zoom %>
    + <%= f.number_field :zoom, :value => 15 %> +
    +
    + <%= f.submit %> +
    +<% end %> + + diff --git a/app/views/sites/_newformantiguo.html.erb b/app/views/sites/_newformantiguo.html.erb new file mode 100644 index 0000000..374efc6 --- /dev/null +++ b/app/views/sites/_newformantiguo.html.erb @@ -0,0 +1,65 @@ + + + + + + + + + +<%= 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.number_field :latitud, :value => @site.latitud, :hidden => true, :id => "latitud" %> + <%= f.number_field :longitud, :value => @site.longitud, :hidden => true, :id => "longitud" %> +
    + <%= f.label :zoom %>
    + <%= f.number_field :zoom, :value => 15 %> +
    +
    + <%= f.submit %> +
    +<% end %> + + diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index 1ecde21..12aa4d1 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -14,8 +14,10 @@
    <%= link_to site.name, site %>
    <%= truncate(strip_tags(site.description), :length => 80) %>
    +
    + Viajes: <%= site.trips.size %>
    <% unless site.comments.empty? %> -
    <%= link_to 'Comentarios', site_comments_path(site) %>
    + <%= link_to 'Comentarios', site_comments_path(site) %> <% end %> diff --git a/app/views/sites/new.html.erb b/app/views/sites/new.html.erb index 37340dc..c85a1cc 100644 --- a/app/views/sites/new.html.erb +++ b/app/views/sites/new.html.erb @@ -1,5 +1,6 @@

    New site

    -<%= render 'form' %> +<%= render 'newform' %> <%= link_to 'Back', sites_path %> + \ No newline at end of file diff --git a/app/views/sites/new.html.erb~ b/app/views/sites/new.html.erb~ new file mode 100644 index 0000000..37340dc --- /dev/null +++ b/app/views/sites/new.html.erb~ @@ -0,0 +1,5 @@ +

    New site

    + +<%= render 'form' %> + +<%= link_to 'Back', sites_path %> diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index a658b4a..970cabf 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -1,29 +1,71 @@ -
    + + + + + + + + + + +
    -

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

    +

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

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

    +

    Latitud: + <%= @site.latitud %>

    +

    Longitud: + <%= @site.longitud %>

    +

    Zoom: + <%= @site.zoom %>

    -

    <%= @site.name %>

    +
    +

    Viajes: + <%= @site.trips.size %>

    +
    -

    <%=sanitize @site.description %>

    + <% unless @site.comments.empty? %> +

    Comentarios:

    + <% @comments = @site.comments %> + <%= render 'comments/comment' %> + <% end %> -

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

    +

    - <% unless @site.comments.empty? %> -

    Comentarios:

    - <% @comments = @site.comments %> - <%= render(@comment) %> - <% end %> + <%= render 'comments/form' if current_user%> - <%= render 'comments/form' %> +
    -
    + <% if (@site.latitud && @site.longitud && @site.zoom) %> +

    + <% end %> -

    + <% 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 100644 index 0000000..825412c --- /dev/null +++ b/app/views/sites/show.html.erb~ @@ -0,0 +1,62 @@ + + + + + + + + +

    + +

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

    +

    Latitud: + <%= @site.latitud %>

    +

    Longitud: + <%= @site.longitud %>

    + + <% unless @site.comments.empty? %> +

    Comentarios:

    + <% @comments = @site.comments %> + <%= render(@comment) %> + <% end %> + + <%= render 'comments/form' %> + +
    + +
    +

    +<%= @site.image_url %> +<% if @site.user == current_user %> + <%= link_to 'Edit', edit_site_path(@site) %> | +<% end %> +<%= link_to 'Back', sites_path %> + + + diff --git a/app/views/sites/showantiguo.html.erb b/app/views/sites/showantiguo.html.erb new file mode 100644 index 0000000..415e1ef --- /dev/null +++ b/app/views/sites/showantiguo.html.erb @@ -0,0 +1,61 @@ + + + + + + + + + + +

    + +

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

    +

    Latitud: + <%= @site.latitud %>

    +

    Longitud: + <%= @site.longitud %>

    + + <% unless @site.comments.empty? %> +

    Comentarios:

    + <% @comments = @site.comments %> + <%= render(@comment) %> + <% end %> + + <%= render 'comments/form' %> + +
    + +

    +

    +<% if @site.user == current_user %> + <%= link_to 'Edit', edit_site_path(@site) %> | +<% end %> +<%= link_to 'Back', sites_path %> + + + diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index ec0e077..c0575d1 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -1,43 +1,55 @@ -

    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| %> - + + + + + + + + +

    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 %> + + + diff --git a/app/views/trips/show.html.erb~ b/app/views/trips/show.html.erb~ index 8ea0050..b39b11d 100644 --- a/app/views/trips/show.html.erb~ +++ b/app/views/trips/show.html.erb~ @@ -1,37 +1,51 @@ + + + + + + + +

    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| %> - - + <%= form_for(@visit) do |f| %> <%= f.number_field :trip_id, :value => @trip.id, :hidden => true %> - <%= f.collection_select(:site_id, + <%= f.collection_select(:site_id, Site.all,:id,:name) %> - Site.all, + <%= f.select(:hour, Array.new(24, 0).fill{|i| [(i.to_s + 'H'), i]}) %> - :id, - - :name) %> - - <%= f.select(:hour, Array.new(24, 0).fill {|i| [(i.to_s 'H'), i]}) %> <%= f.submit "Añadir sitio" %> @@ -42,7 +56,9 @@ -
    - <% if @trip.user == current_user %> <%= link_to 'Edit', edit_trip_path(@trip) %> | <% end %> <%= link_to 'Back', trips_path %> - +
    +
    +<% if @trip.user == current_user %> <%= link_to 'Edit', edit_trip_path(@trip) %> | <% end %> <%= link_to 'Back', trips_path %> + + diff --git a/config/routes.rb b/config/routes.rb index 73e0ef0..f587c30 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,10 +1,10 @@ Planet::Application.routes.draw do - resources :visits - - resources :trips - - resources :comments, :except => [ :new, :index ] + resources :visits + + resources :trips + + resources :comments, :except => [ :new, :index, :show ] devise_for :users diff --git a/db/migrate/20120320100145_create_sites.rb b/db/migrate/20120320100145_create_sites.rb index 4e9415c..c7da1e7 100644 --- a/db/migrate/20120320100145_create_sites.rb +++ b/db/migrate/20120320100145_create_sites.rb @@ -4,8 +4,7 @@ def change t.string :name t.text :description t.integer :type_id - t.string :image_url - + t.string :image_url t.timestamps end end diff --git a/db/migrate/20120320100145_create_sites.rb~ b/db/migrate/20120320100145_create_sites.rb~ new file mode 100644 index 0000000..9f009f1 --- /dev/null +++ b/db/migrate/20120320100145_create_sites.rb~ @@ -0,0 +1,14 @@ +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/20120329080433_user_sites.rb b/db/migrate/20120329080433_user_sites.rb index eb56ace..5831683 100644 --- a/db/migrate/20120329080433_user_sites.rb +++ b/db/migrate/20120329080433_user_sites.rb @@ -2,12 +2,14 @@ class UserSites < ActiveRecord::Migration def up change_table :sites do |t| # añade la columna user_id a la tabla sites t.column :user_id, :integer + end end def down change_table :sites do |t| t.remove :user_id + end end end diff --git a/db/migrate/20120329080433_user_sites.rb~ b/db/migrate/20120329080433_user_sites.rb~ new file mode 100644 index 0000000..6ac9682 --- /dev/null +++ b/db/migrate/20120329080433_user_sites.rb~ @@ -0,0 +1,19 @@ +class UserSites < ActiveRecord::Migration + def up + change_table :sites do |t| # añade la columna user_id a la tabla sites + t.column :user_id, :integer + t.column :longitud, :float + t.column :latitud, :float + t.column :zoom, :integer + end + end + + def down + change_table :sites do |t| + t.remove :user_id + t.remove :longitud + t.remove :latitud + t.remove :zoom + end + end +end diff --git a/db/migrate/20120417205239_coords.rb b/db/migrate/20120417205239_coords.rb new file mode 100644 index 0000000..d126511 --- /dev/null +++ b/db/migrate/20120417205239_coords.rb @@ -0,0 +1,18 @@ +class Coords < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :longitud,:float + t.column :latitud, :float + t.column :zoom, :integer + end + end + + def down + change_table :sites do |t| + t.remove :longitud + t.remove :latitud + t.remove :zoom + end + + end +end diff --git a/db/migrate/20120417205239_coords.rb~ b/db/migrate/20120417205239_coords.rb~ new file mode 100644 index 0000000..9d96f17 --- /dev/null +++ b/db/migrate/20120417205239_coords.rb~ @@ -0,0 +1,7 @@ +class Coords < ActiveRecord::Migration + def up + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index b20a373..883f0c7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,77 +1,80 @@ -# 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 => 20120417172936) do - - create_table "comments", :force => true do |t| - t.string "comment" - t.integer "user_id" - t.integer "site_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "sites", :force => true do |t| - t.string "name" - 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" - 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 +# 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 => 20120417205239) do + + create_table "comments", :force => true do |t| + t.string "comment" + t.integer "user_id" + t.integer "site_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "sites", :force => true do |t| + t.string "name" + 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 "longitud" + t.float "latitud" + t.float "zoom" + 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 d1f0326cfa67f54c12a11ee61d6d4192fbec3fe1 Mon Sep 17 00:00:00 2001 From: Fran Gil Date: Wed, 25 Apr 2012 21:43:56 +0200 Subject: [PATCH 8/8] Entrega final sin Heroku --- .gitignore | 4 + .gitignore~ | 18 + Gemfile | 13 +- Gemfile.lock | 10 + app/assets/stylesheets/planet.css | 37 +- app/controllers/comments_controller.rb | 42 +- app/controllers/comments_controller.rb~ | 11 +- app/controllers/planet_controller.rb | 48 +- app/controllers/planet_controller.rb~ | 57 +- app/controllers/sites_controller.rb | 48 +- app/controllers/sites_controller.rb~ | 18 +- app/controllers/trips_controller.rb | 42 +- app/controllers/trips_controller.rb~ | 9 +- app/controllers/types_controller.rb | 42 +- app/controllers/types_controller.rb~ | 192 +++---- app/controllers/visits_controller.rb | 40 +- app/controllers/visits_controller.rb~ | 5 +- app/models/comment.rb | 12 +- app/models/comment.rb~ | 14 +- app/models/site.rb | 21 +- app/models/site.rb~ | 18 +- app/models/trip.rb | 17 +- app/models/trip.rb~ | 11 +- app/models/type.rb | 7 +- app/models/type.rb~ | 7 + app/models/user.rb | 5 +- app/models/user.rb~ | 2 +- app/models/visit.rb | 6 +- app/models/visit.rb~ | 2 + app/views/comments/_form.html.erb | 5 +- app/views/comments/create.js.erb | 4 + app/views/comments/create.js.erb~ | 4 + app/views/comments/edit.html.erb | 27 +- app/views/comments/index.html.erb | 19 +- app/views/comments/new.html.erb | 27 +- app/views/comments/show.html.erb | 10 +- app/views/devise/_links.erb | 40 +- app/views/devise/registrations/edit.html.erb | 9 +- app/views/devise/registrations/new.html.erb | 4 +- app/views/layouts/application.html.erb | 119 ++-- app/views/layouts/application.html.erb~ | 36 +- .../layouts/application_mozilla.html.erb | 77 +++ app/views/planet/index.html.erb | 2 +- app/views/planet/search.html.erb | 11 + app/views/planet/search.html.erb~ | 32 ++ app/views/sites/_form.html.erb | 6 +- app/views/sites/_newform.html.erb | 55 +- app/views/sites/_site.html.erb | 28 + app/views/sites/_sites.html.erb | 33 ++ app/views/sites/edit.html.erb | 6 +- app/views/sites/index.html.erb | 42 +- app/views/sites/new.html.erb | 5 +- app/views/sites/show.html.erb | 48 +- app/views/trips/_trip.html.erb | 36 +- app/views/trips/_trips.html.erb | 27 + app/views/trips/edit.html.erb | 6 +- app/views/trips/index.html.erb | 29 +- app/views/trips/new.html.erb | 4 +- app/views/trips/show.html.erb | 63 +- app/views/types/edit.html.erb | 6 +- app/views/types/index.html.erb | 6 +- app/views/types/new.html.erb | 4 +- app/views/types/ordered_index.html.erb | 6 +- app/views/types/show.html.erb | 7 +- app/views/visits/edit.html.erb | 6 +- app/views/visits/index.html.erb | 6 +- app/views/visits/new.html.erb | 4 +- app/views/visits/show.html.erb | 7 +- config/application.rb | 4 + config/routes.rb | 8 +- config/routes.rb~ | 9 +- .../20120411095828_add_paperclip_to_sites.rb | 19 + db/migrate/20120411160519_site_visitas.rb | 13 + db/schema.rb | 165 +++--- db/seeds.rb | 99 +++- doc/app/ApplicationController.html | 163 ++++++ doc/app/ApplicationHelper.html | 157 +++++ doc/app/Comment.html | 170 ++++++ doc/app/CommentsController.html | 494 ++++++++++++++++ doc/app/CommentsHelper.html | 157 +++++ doc/app/PlanetController.html | 399 +++++++++++++ doc/app/PlanetHelper.html | 157 +++++ doc/app/Site.html | 173 ++++++ doc/app/SitesController.html | 494 ++++++++++++++++ doc/app/SitesHelper.html | 157 +++++ doc/app/Trip.html | 169 ++++++ doc/app/TripsController.html | 484 ++++++++++++++++ doc/app/TripsHelper.html | 157 +++++ doc/app/Type.html | 172 ++++++ doc/app/TypesController.html | 524 +++++++++++++++++ doc/app/TypesHelper.html | 157 +++++ doc/app/User.html | 172 ++++++ doc/app/Visit.html | 168 ++++++ doc/app/VisitsController.html | 484 ++++++++++++++++ doc/app/VisitsHelper.html | 157 +++++ doc/app/created.rid | 22 + doc/app/doc/README_FOR_APP.html | 123 ++++ doc/app/images/add.png | Bin 0 -> 733 bytes doc/app/images/brick.png | Bin 0 -> 452 bytes doc/app/images/brick_link.png | Bin 0 -> 764 bytes doc/app/images/bug.png | Bin 0 -> 774 bytes doc/app/images/bullet_black.png | Bin 0 -> 211 bytes doc/app/images/bullet_toggle_minus.png | Bin 0 -> 207 bytes doc/app/images/bullet_toggle_plus.png | Bin 0 -> 209 bytes doc/app/images/date.png | Bin 0 -> 626 bytes doc/app/images/delete.png | Bin 0 -> 715 bytes doc/app/images/find.png | Bin 0 -> 659 bytes doc/app/images/loadingAnimation.gif | Bin 0 -> 5886 bytes doc/app/images/macFFBgHack.png | Bin 0 -> 207 bytes doc/app/images/package.png | Bin 0 -> 853 bytes doc/app/images/page_green.png | Bin 0 -> 621 bytes doc/app/images/page_white_text.png | Bin 0 -> 342 bytes doc/app/images/page_white_width.png | Bin 0 -> 309 bytes doc/app/images/plugin.png | Bin 0 -> 591 bytes doc/app/images/ruby.png | Bin 0 -> 592 bytes doc/app/images/tag_blue.png | Bin 0 -> 1880 bytes doc/app/images/tag_green.png | Bin 0 -> 613 bytes doc/app/images/transparent.png | Bin 0 -> 97 bytes doc/app/images/wrench.png | Bin 0 -> 610 bytes doc/app/images/wrench_orange.png | Bin 0 -> 584 bytes doc/app/images/zoom.png | Bin 0 -> 692 bytes doc/app/index.html | 116 ++++ doc/app/index.html~ | 116 ++++ doc/app/js/darkfish.js | 153 +++++ doc/app/js/jquery.js | 18 + doc/app/js/navigation.js | 142 +++++ doc/app/js/search.js | 94 +++ doc/app/js/search_index.js | 1 + doc/app/js/searcher.js | 228 ++++++++ doc/app/rdoc.css | 543 ++++++++++++++++++ doc/app/table_of_contents.html | 253 ++++++++ public/doc/README_FOR_APP | 2 + public/doc/app/ApplicationController.html | 163 ++++++ public/doc/app/ApplicationHelper.html | 157 +++++ public/doc/app/Comment.html | 170 ++++++ public/doc/app/CommentsController.html | 494 ++++++++++++++++ public/doc/app/CommentsHelper.html | 157 +++++ public/doc/app/PlanetController.html | 399 +++++++++++++ public/doc/app/PlanetHelper.html | 157 +++++ public/doc/app/Site.html | 173 ++++++ public/doc/app/SitesController.html | 494 ++++++++++++++++ public/doc/app/SitesHelper.html | 157 +++++ public/doc/app/Trip.html | 169 ++++++ public/doc/app/TripsController.html | 484 ++++++++++++++++ public/doc/app/TripsHelper.html | 157 +++++ public/doc/app/Type.html | 172 ++++++ public/doc/app/TypesController.html | 524 +++++++++++++++++ public/doc/app/TypesHelper.html | 157 +++++ public/doc/app/User.html | 172 ++++++ public/doc/app/Visit.html | 168 ++++++ public/doc/app/VisitsController.html | 484 ++++++++++++++++ public/doc/app/VisitsHelper.html | 157 +++++ public/doc/app/created.rid | 22 + public/doc/app/doc/README_FOR_APP.html | 123 ++++ public/doc/app/images/add.png | Bin 0 -> 733 bytes public/doc/app/images/brick.png | Bin 0 -> 452 bytes public/doc/app/images/brick_link.png | Bin 0 -> 764 bytes public/doc/app/images/bug.png | Bin 0 -> 774 bytes public/doc/app/images/bullet_black.png | Bin 0 -> 211 bytes public/doc/app/images/bullet_toggle_minus.png | Bin 0 -> 207 bytes public/doc/app/images/bullet_toggle_plus.png | Bin 0 -> 209 bytes public/doc/app/images/date.png | Bin 0 -> 626 bytes public/doc/app/images/delete.png | Bin 0 -> 715 bytes public/doc/app/images/find.png | Bin 0 -> 659 bytes public/doc/app/images/loadingAnimation.gif | Bin 0 -> 5886 bytes public/doc/app/images/macFFBgHack.png | Bin 0 -> 207 bytes public/doc/app/images/package.png | Bin 0 -> 853 bytes public/doc/app/images/page_green.png | Bin 0 -> 621 bytes public/doc/app/images/page_white_text.png | Bin 0 -> 342 bytes public/doc/app/images/page_white_width.png | Bin 0 -> 309 bytes public/doc/app/images/plugin.png | Bin 0 -> 591 bytes public/doc/app/images/ruby.png | Bin 0 -> 592 bytes public/doc/app/images/tag_blue.png | Bin 0 -> 1880 bytes public/doc/app/images/tag_green.png | Bin 0 -> 613 bytes public/doc/app/images/transparent.png | Bin 0 -> 97 bytes public/doc/app/images/wrench.png | Bin 0 -> 610 bytes public/doc/app/images/wrench_orange.png | Bin 0 -> 584 bytes public/doc/app/images/zoom.png | Bin 0 -> 692 bytes public/doc/app/index.html | 116 ++++ public/doc/app/js/darkfish.js | 153 +++++ public/doc/app/js/jquery.js | 18 + public/doc/app/js/navigation.js | 142 +++++ public/doc/app/js/search.js | 94 +++ public/doc/app/js/search_index.js | 1 + public/doc/app/js/searcher.js | 228 ++++++++ public/doc/app/rdoc.css | 543 ++++++++++++++++++ public/doc/app/table_of_contents.html | 253 ++++++++ test/fixtures/comments.yml | 12 +- test/fixtures/sites.yml | 13 +- test/fixtures/trips.yml | 26 +- test/fixtures/types.yml | 4 +- test/fixtures/users.yml | 10 +- test/fixtures/visits.yml | 22 +- test/functional/comments_controller_test.rb | 21 +- test/functional/planet_controller_test.rb | 22 +- test/functional/planet_controller_test.rb~ | 36 ++ test/functional/sites_controller_test.rb | 11 +- test/functional/trips_controller_test.rb | 105 ++-- test/functional/types_controller_test.rb | 2 + test/functional/visits_controller_test.rb | 99 ++-- test/test_helper.rb | 5 + test/unit/site_test.rb | 2 +- 202 files changed, 15383 insertions(+), 782 deletions(-) create mode 100644 .gitignore~ create mode 100644 app/models/type.rb~ create mode 100644 app/views/comments/create.js.erb create mode 100644 app/views/comments/create.js.erb~ create mode 100644 app/views/layouts/application_mozilla.html.erb create mode 100644 app/views/planet/search.html.erb create mode 100644 app/views/planet/search.html.erb~ create mode 100644 app/views/sites/_site.html.erb create mode 100644 app/views/sites/_sites.html.erb create mode 100644 app/views/trips/_trips.html.erb create mode 100644 db/migrate/20120411095828_add_paperclip_to_sites.rb create mode 100644 db/migrate/20120411160519_site_visitas.rb create mode 100644 doc/app/ApplicationController.html create mode 100644 doc/app/ApplicationHelper.html create mode 100644 doc/app/Comment.html create mode 100644 doc/app/CommentsController.html create mode 100644 doc/app/CommentsHelper.html create mode 100644 doc/app/PlanetController.html create mode 100644 doc/app/PlanetHelper.html create mode 100644 doc/app/Site.html create mode 100644 doc/app/SitesController.html create mode 100644 doc/app/SitesHelper.html create mode 100644 doc/app/Trip.html create mode 100644 doc/app/TripsController.html create mode 100644 doc/app/TripsHelper.html create mode 100644 doc/app/Type.html create mode 100644 doc/app/TypesController.html create mode 100644 doc/app/TypesHelper.html create mode 100644 doc/app/User.html create mode 100644 doc/app/Visit.html create mode 100644 doc/app/VisitsController.html create mode 100644 doc/app/VisitsHelper.html create mode 100644 doc/app/created.rid create mode 100644 doc/app/doc/README_FOR_APP.html create mode 100644 doc/app/images/add.png create mode 100644 doc/app/images/brick.png create mode 100644 doc/app/images/brick_link.png create mode 100644 doc/app/images/bug.png create mode 100644 doc/app/images/bullet_black.png create mode 100644 doc/app/images/bullet_toggle_minus.png create mode 100644 doc/app/images/bullet_toggle_plus.png create mode 100644 doc/app/images/date.png create mode 100644 doc/app/images/delete.png create mode 100644 doc/app/images/find.png create mode 100644 doc/app/images/loadingAnimation.gif create mode 100644 doc/app/images/macFFBgHack.png create mode 100644 doc/app/images/package.png create mode 100644 doc/app/images/page_green.png create mode 100644 doc/app/images/page_white_text.png create mode 100644 doc/app/images/page_white_width.png create mode 100644 doc/app/images/plugin.png create mode 100644 doc/app/images/ruby.png create mode 100644 doc/app/images/tag_blue.png create mode 100644 doc/app/images/tag_green.png create mode 100644 doc/app/images/transparent.png create mode 100644 doc/app/images/wrench.png create mode 100644 doc/app/images/wrench_orange.png create mode 100644 doc/app/images/zoom.png create mode 100644 doc/app/index.html create mode 100644 doc/app/index.html~ create mode 100644 doc/app/js/darkfish.js create mode 100644 doc/app/js/jquery.js create mode 100644 doc/app/js/navigation.js create mode 100644 doc/app/js/search.js create mode 100644 doc/app/js/search_index.js create mode 100644 doc/app/js/searcher.js create mode 100644 doc/app/rdoc.css create mode 100644 doc/app/table_of_contents.html create mode 100644 public/doc/README_FOR_APP create mode 100644 public/doc/app/ApplicationController.html create mode 100644 public/doc/app/ApplicationHelper.html create mode 100644 public/doc/app/Comment.html create mode 100644 public/doc/app/CommentsController.html create mode 100644 public/doc/app/CommentsHelper.html create mode 100644 public/doc/app/PlanetController.html create mode 100644 public/doc/app/PlanetHelper.html create mode 100644 public/doc/app/Site.html create mode 100644 public/doc/app/SitesController.html create mode 100644 public/doc/app/SitesHelper.html create mode 100644 public/doc/app/Trip.html create mode 100644 public/doc/app/TripsController.html create mode 100644 public/doc/app/TripsHelper.html create mode 100644 public/doc/app/Type.html create mode 100644 public/doc/app/TypesController.html create mode 100644 public/doc/app/TypesHelper.html create mode 100644 public/doc/app/User.html create mode 100644 public/doc/app/Visit.html create mode 100644 public/doc/app/VisitsController.html create mode 100644 public/doc/app/VisitsHelper.html create mode 100644 public/doc/app/created.rid create mode 100644 public/doc/app/doc/README_FOR_APP.html create mode 100644 public/doc/app/images/add.png create mode 100644 public/doc/app/images/brick.png create mode 100644 public/doc/app/images/brick_link.png create mode 100644 public/doc/app/images/bug.png create mode 100644 public/doc/app/images/bullet_black.png create mode 100644 public/doc/app/images/bullet_toggle_minus.png create mode 100644 public/doc/app/images/bullet_toggle_plus.png create mode 100644 public/doc/app/images/date.png create mode 100644 public/doc/app/images/delete.png create mode 100644 public/doc/app/images/find.png create mode 100644 public/doc/app/images/loadingAnimation.gif create mode 100644 public/doc/app/images/macFFBgHack.png create mode 100644 public/doc/app/images/package.png create mode 100644 public/doc/app/images/page_green.png create mode 100644 public/doc/app/images/page_white_text.png create mode 100644 public/doc/app/images/page_white_width.png create mode 100644 public/doc/app/images/plugin.png create mode 100644 public/doc/app/images/ruby.png create mode 100644 public/doc/app/images/tag_blue.png create mode 100644 public/doc/app/images/tag_green.png create mode 100644 public/doc/app/images/transparent.png create mode 100644 public/doc/app/images/wrench.png create mode 100644 public/doc/app/images/wrench_orange.png create mode 100644 public/doc/app/images/zoom.png create mode 100644 public/doc/app/index.html create mode 100644 public/doc/app/js/darkfish.js create mode 100644 public/doc/app/js/jquery.js create mode 100644 public/doc/app/js/navigation.js create mode 100644 public/doc/app/js/search.js create mode 100644 public/doc/app/js/search_index.js create mode 100644 public/doc/app/js/searcher.js create mode 100644 public/doc/app/rdoc.css create mode 100644 public/doc/app/table_of_contents.html create mode 100644 test/functional/planet_controller_test.rb~ diff --git a/.gitignore b/.gitignore index 28a4c21..1842f10 100644 --- 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/.gitignore~ b/.gitignore~ new file mode 100644 index 0000000..28a4c21 --- /dev/null +++ b/.gitignore~ @@ -0,0 +1,18 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +# Ignore bundler config +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 + +# Ignore all logfiles and tempfiles. +/log/*.log +/tmp + +# ignore al .DS_store files of MAC OSX +.DS_Store diff --git a/Gemfile b/Gemfile index 91af3d8..6d784e8 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,14 @@ gem 'rails', '3.2.2' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' -gem 'sqlite3' +group :development, :test do + gem 'sqlite3' +end + +group :production do + gem 'pg' +end + gem 'devise' @@ -23,6 +30,7 @@ end gem 'jquery-rails' gem 'cleditor_rails' +gem 'paperclip' # To use ActiveModel has_secure_password # gem 'bcrypt-ruby', '~> 3.0.0' @@ -38,3 +46,6 @@ gem 'cleditor_rails' # To use debugger # gem 'ruby-debug19', :require => 'ruby-debug' + +gem 'json', '1.6.5' + diff --git a/Gemfile.lock b/Gemfile.lock index c002e49..46ce106 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,6 +33,7 @@ GEM bcrypt-ruby (3.0.1-x86-mingw32) 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) @@ -62,6 +63,12 @@ GEM mime-types (1.17.2) multi_json (1.1.0) orm_adapter (0.0.7) + paperclip (2.4.5) + activerecord (>= 2.3.0) + activesupport (>= 2.3.2) + cocaine (>= 0.0.2) + mime-types + pg (0.13.2-x86-mingw32) polyglot (0.3.3) rack (1.4.1) rack-cache (1.2) @@ -120,6 +127,9 @@ DEPENDENCIES coffee-rails (~> 3.2.1) devise jquery-rails + json (= 1.6.5) + paperclip + pg rails (= 3.2.2) sass-rails (~> 3.2.3) sqlite3 diff --git a/app/assets/stylesheets/planet.css b/app/assets/stylesheets/planet.css index 1154389..0169dae 100644 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -14,12 +14,15 @@ font: 150% sans-serif; color: #226; border-bottom: 3px dotted #77d; + margin-top: 30px; } /* Styles for products/index */ #site_list table { border-collapse: collapse; + margin-bottom: 1em; + margin-top: 1em; } #site_list table tr td { @@ -83,12 +86,6 @@ padding-left: 10px; } -#planet .user { - float: right; - color: #bfb; - font-size: small; -} - #columns { background: #446; } @@ -100,11 +97,39 @@ background: white; } +#main .links_down{ + margin-top: 2em; +} + +#main .links_up{ + margin-bottom: 2em; +} + #map_canvas { width: 100%; height: 600px; } +#options { + margin-top: 30px; +} + +#planet .user { + float: right; + color: #bfb; + font-size: small; +} + +#search_form .long_min{ + margin-top: 2em; + margin-bottom: 1em; +} + +#search_form { + margin-top: 2em; + margin-bottom: 2em; +} + #side { float: left; padding-top: 1em; diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 57fb033..aedaf41 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,10 +1,17 @@ +# == Qué hace este controlador +# El controlador de comments gestiona todo lo relacionado con la creación, +# edición y eliminación de comentarios. Trabaja con Devise para identificar +# cada comentario con el usuario que lo creó. +# Tiene un filtro para ejecutar las acciones sólo si se ha iniciado sesión. +# Este filtro no afecta a las acciones index y show. class CommentsController < ApplicationController # authenticate_user! ejecuta acción solo si sesión existe before_filter :authenticate_user!, :except => [ :index, :show ] - # GET /comments - # GET /comments.json + # Método que muestra los comentarios asociados al sitio seleccionado. Rutas: + # * GET /sites/:site_id/comments + # * GET /sites/:site_id/comments.json def index @site = Site.find(params[:site_id]) @comments = @site.comments @@ -16,8 +23,9 @@ def index end end - # GET /comments/1 - # GET /comments/1.json + # Método que muestra el comentario seleccionado. Rutas: + # * GET /comments/:comment_id + # * GET /comments/:comment_id.json def show @comment = Comment.find(params[:id]) @@ -27,10 +35,12 @@ def show end end - # GET /comments/new - # GET /comments/new.json + # Método que permite modificar un nuevo comentario asociado a un sitio. Rutas: + # * GET /sites/:site_id/comments/new + # * GET /sites/:site_id/comments/new.json def new @comment = current_user.comments.build + @site = Site.find(params[:site_id]) respond_to do |format| format.html # new.html.erb @@ -38,14 +48,17 @@ def new end end - # GET /comments/1/edit + # Método que permite editar el comentario seleccionado. Ruta: + # * GET /comments/:id/edit def edit @comment = current_user.comments.find(params[:id]) @site = @comment.site end - # POST /comments - # POST /comments.json + # Método que crea el nuevo comentario. Rutas: + # * POST /comments + # * POST /comments.js + # * POST /comments.json def create @comment = current_user.comments.build(params[:comment]) @site = @comment.site @@ -53,6 +66,7 @@ def create respond_to do |format| if @comment.save format.html { redirect_to site_path(@site), notice: 'Comment was successfully created.' } + format.js format.json { render json: @comment, status: :created, location: @comment } else format.html { render action: "new" } @@ -61,8 +75,9 @@ def create end end - # PUT /comments/1 - # PUT /comments/1.json + # Método que actualiza el comentario editado. Rutas: + # * PUT /comments/:id + # * PUT /comments/:id.json def update @comment = current_user.comments.find(params[:id]) @site = @comment.site @@ -78,8 +93,9 @@ def update end end - # DELETE /comments/1 - # DELETE /comments/1.json + # Método que permite eliminar un comentario. Rutas: + # * DELETE /comments/:id + # * DELETE /comments/:id.json def destroy @comment = current_user.comments.find(params[:id]) site = @comment.site diff --git a/app/controllers/comments_controller.rb~ b/app/controllers/comments_controller.rb~ index 86a4240..83be975 100644 --- a/app/controllers/comments_controller.rb~ +++ b/app/controllers/comments_controller.rb~ @@ -1,3 +1,5 @@ +# == Qué hace este controlador +# El controlador de comments gestiona todo lo relacionado con la creación, edición y eliminación de comentarios. Trabaja con Devise para identificar cada comentario con el usuario que lo creó. class CommentsController < ApplicationController # authenticate_user! ejecuta acción solo si sesión existe @@ -8,7 +10,7 @@ class CommentsController < ApplicationController def index @site = Site.find(params[:site_id]) @comments = @site.comments - # @comment = current_user.comments.build + @comment = current_user.comments.build if current_user respond_to do |format| format.html # index.html.erb @@ -48,10 +50,12 @@ class CommentsController < ApplicationController # POST /comments.json def create @comment = current_user.comments.build(params[:comment]) + @site = @comment.site respond_to do |format| if @comment.save - format.html { redirect_to site_path(@comment.site), notice: 'Comment was successfully created.' } + format.html { redirect_to site_path(@site), notice: 'Comment was successfully created.' } + format.js format.json { render json: @comment, status: :created, location: @comment } else format.html { render action: "new" } @@ -64,10 +68,11 @@ class CommentsController < ApplicationController # PUT /comments/1.json def update @comment = current_user.comments.find(params[:id]) + @site = @comment.site respond_to do |format| if @comment.update_attributes(params[:comment]) - format.html { redirect_to site_path(@comment.site), notice: 'Comment was successfully updated.' } + format.html { redirect_to site_path(@site), notice: 'Comment was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } diff --git a/app/controllers/planet_controller.rb b/app/controllers/planet_controller.rb index 3a801ef..21ecd2a 100644 --- a/app/controllers/planet_controller.rb +++ b/app/controllers/planet_controller.rb @@ -1,14 +1,60 @@ +# PlanetController ilustra el uso de *RDoc*. La documentación de un proyecto en +# genera en el directorio *proy/doc* en formato Web con +# $proy> rake doc:app +# +# == Algunos comandos de formateo +# +# Tal y como muestra el subitulo anterior, este se define empezando la +# línea con ==. En los títulos debe empezar por =. +# +# Un [ ... ] seguido de texto define una lista titulada, como aquí +# [Clases, Módulos o Métodos] Se documentan con comentarios justo encima de sus definición, como aquí. +# +# Un * o - definen las entradas de una lista itemizada +# * Un URL se define así email[mailto:pepe@ejemplo.com] +# * o así {Pepe Rubio}[mailto:pepe@ejemplo.com] +# +# Un número o letra seguido de punto genera una lista númerada +# 1. + permite generar *negrita*, igual que con HTML +# 2. _ permite generar _cursiva_, igual que con HTML +# 3. * permite generar letra de +teletipo+, igual que con HTML +# +# == Qué hace este controlador +# El controlador de planet es en gran parte un controlador de prueba con acciones vacías. Sólo hay un método con una acción +# completa, search. Esta acción busca los sitios o viajes que tengan en su nombre o en su descripción la cadena de texto introducida. class PlanetController < ApplicationController + + # Método que define una acción vacía del controlador. Ruta: + # * GET /planet/index def index end + # Método que define una acción vacía del controlador. Ruta: + # * GET /planet/contact def contact end + # Método que define una acción vacía del controlador. Ruta: + # * GET /planet/ejemplo def ejemplo end + # Método que define una acción vacía del controlador. Ruta: + # * GET /planet/author def author end - + + # Método que permite buscar por nombre y descripción sitios y viajes. Ruta: + # * GET /planet/search + def search + search = "%#{params[:search]}%" + @sites = Site.find(:all, :conditions => ['name LIKE ? or description LIKE ?', search, search]) + @trips = Trip.find(:all, :conditions => ['name LIKE ? or description LIKE ?', search, search]) + + respond_to do |format| + format.html + format.json { render json: @sites } + format.json { render json: @trips } + end + end end diff --git a/app/controllers/planet_controller.rb~ b/app/controllers/planet_controller.rb~ index be7ac0a..ccdbb70 100644 --- a/app/controllers/planet_controller.rb~ +++ b/app/controllers/planet_controller.rb~ @@ -1,11 +1,46 @@ -class PlanetController < ApplicationController - def index - end - - def contact - end - - def ejemplo - end - -end +# PlanetController ilustra el uso de *RDoc*. La documentación de un proyecto en +# genera en el directorio *proy/doc* en formato Web con +# $proy> rake doc:app +# +# == Algunos comandos de formateo +# +# Tal y como muestra el subitulo anterior, este se define empezando la +# línea con ==. En los títulos debe empezar por =. +# +# Un [ ... ] seguido de texto define una lista titulada, como aquí +# [Clases, Módulos o Métodos] Se documentan con comentarios justo encima de sus definición, como aquí. +# +# Un * o - definen las entradas de una lista itemizada +# * Un URL se define así email[mailto:pepe@ejemplo.com] +# * o así {Pepe Rubio}[mailto:pepe@ejemplo.com] +# +# Un número o letra seguido de punto genera una lista númerada +# 1. + permite generar *negrita*, igual que con HTML +# 2. _ permite generar _cursiva_, igual que con HTML +# 3. * permite generar letra de +teletipo+, igual que con HTML +# +class PlanetController < ApplicationController + # Método que define una acción vacía del controlador + def index + end + # Método que define una acción vacía del controlador + def contact + end + # Método que define una acción vacía del controlador + def ejemplo + end + # Método que define una acción vacía del controlador + def author + end + # Método que permite buscar por nombre sitios y viajes + def search + @sites = Site.find(:all, :conditions => ['name LIKE ? or description LIKE ?', "%#{params[:search]}%", "%#{params[:search]}%"]) + @trips = Trip.find(:all, :conditions => ['name LIKE ? or description LIKE ?', "%#{params[:search]}%", "%#{params[:search]}%"]) + + respond_to do |format| + format.html + format.json { render json: @sites } + format.json { render json: @trips } + end + end +end diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index a0f1717..e1b0ea2 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -1,15 +1,23 @@ +# == Qué hace este controlador +# El controlador de sites gestiona todo lo relacionado con la creación, edición y eliminación de sitios. +# Trabaja con Devise para identificar cada sitio con el usuario que lo creó. +# Tiene dos filtros: +# * Uno para ejecutar las acciones sólo si antes se ha iniciado sesión. Este filtro no afecta a las acciones index y show. +# * Otro para ejecutar el método que define la acción count_visita después de la carga de la página. class SitesController < ApplicationController # authenticate_user! ejecuta acción solo si sesión existe before_filter :authenticate_user!, :except => [ :index, :show ] + after_filter :count_visita, :only => :show - # GET /sites - # GET /sites.json + # Este método muestra todos los sitios si no se ha especificado un tipo o los sitios de un tipo determinado. Rutas: + # * GET /sites + # * GET /sites.json def index if params[:type_id].nil? or params[:type_id].empty? @sites = Site.all # path: /sites else - @sites = Type.find(params[:type_id]).sites # path: /types/id/sites + @sites = Type.find(params[:type_id]).sites # path: /types/:type_id/sites end respond_to do |format| @@ -18,8 +26,9 @@ def index end end - # GET /sites/1 - # GET /sites/1.json + # Método que muestra el sitio seleccionado. Rutas: + # * GET /sites/:id + # * GET /sites/:id.json def show @site = Site.find(params[:id]) @comment = current_user.comments.build if current_user @@ -30,8 +39,9 @@ def show end end - # GET /sites/new - # GET /sites/new.json + # Método que permite modificar un nuevo sitio. Rutas: + # * GET /sites/new + # * GET /sites/new.json def new @site = current_user.sites.build # crea sitio vacio asociado a current_user @@ -41,13 +51,15 @@ def new end end - # GET /sites/1/edit + # Método que permite editar el sitio seleccionado. Ruta: + # * GET /sites/:id/edit def edit @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user end - # POST /sites - # POST /sites.json + # Método que crea el nuevo sitio. Rutas: + # * POST /sites + # * POST /sites.json def create @site = current_user.sites.build(params[:site]) # Asigna solo si sitio asociado a current_user @@ -62,8 +74,9 @@ def create end end - # PUT /sites/1 - # PUT /sites/1.json + # Método que actualiza el sitio editado. Rutas: + # * PUT /sites/:id + # * PUT /sites/:id.json def update @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user @@ -78,8 +91,9 @@ def update end end - # DELETE /sites/1 - # DELETE /sites/1.json + # Método que permite eliminar un sitio. Rutas: + # * DELETE /sites/:id + # * DELETE /sites/:id.json def destroy @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user @site.destroy @@ -89,4 +103,10 @@ def destroy format.json { head :no_content } end end + + # Este método define una acción que incrementa el parámetro visitas del sitio actual. + private + def count_visita + @site.increment!(:visitas) + end end diff --git a/app/controllers/sites_controller.rb~ b/app/controllers/sites_controller.rb~ index 90390bb..70bb48f 100644 --- a/app/controllers/sites_controller.rb~ +++ b/app/controllers/sites_controller.rb~ @@ -1,16 +1,24 @@ +# == Qué hace este controlador +# El controlador de sites gestiona todo lo relacionado con la creación, edición y eliminación de sitios. Trabaja con Devise para identificar cada sitio con el usuario que lo creó. +# Tiene dos filtros: +# * Uno para ejecutar las acciones sólo si antes se ha iniciado sesión. Este filtro no afecta a las acciones index y show. +# * Otro para ejecutar el método que define la acción count_visita después de la carga de la página. class SitesController < ApplicationController # authenticate_user! ejecuta acción solo si sesión existe before_filter :authenticate_user!, :except => [ :index, :show ] + after_filter :count_visita, :only => :show # GET /sites # GET /sites.json + # Esta método muestra todos los sitios si no se ha especificado un tipo ó los sitios de un tipo determinado def index if params[:type_id].nil? or params[:type_id].empty? - @sites = Site.all # path: /types - else + @sites = Site.all # path: /sites + 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 } @@ -21,6 +29,7 @@ class SitesController < ApplicationController # GET /sites/1.json def show @site = Site.find(params[:id]) + @comment = current_user.comments.build if current_user respond_to do |format| format.html # show.html.erb @@ -87,4 +96,9 @@ class SitesController < ApplicationController format.json { head :no_content } end end + # Este método define una acción que incrementa el parámetro visitas del sitio actual. + private + def count_visita + @site.increment!(:visitas) + end end diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 7232e00..b82c8b1 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -1,8 +1,16 @@ +# == Qué hace este controlador +# El controlador de trips gestiona todo lo relacionado con la creación, edición y eliminación de viajes. +# Trabaja con Devise para identificar cada viaje con el usuario que lo creó y con visits, que componen un viaje. +# Tiene un filtro para ejecutar las acciones sólo si antes se ha iniciado sesión. Este filtro no afecta a las acciones index y show. + class TripsController < ApplicationController -before_filter :authenticate_user!, :except => [ :index, :show ] - # GET /trips - # GET /trips.json + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] + + # Método que muestra todos los viajes. Rutas: + # * GET /trips + # * GET /trips.json def index @trips = Trip.all @@ -12,8 +20,9 @@ def index end end - # GET /trips/1 - # GET /trips/1.json + # Método que muestra el viaje seleccionado. Rutas: + # * GET /trips/:id + # * GET /trips/:id.json def show @trip = Trip.find(params[:id]) @visit = @trip.visits.build @@ -24,8 +33,9 @@ def show end end - # GET /trips/new - # GET /trips/new.json + # Método que permite modificar un nuevo viaje. Rutas: + # * GET /trips/new + # * GET /trips/new.json def new @trip = current_user.trips.build @@ -35,13 +45,15 @@ def new end end - # GET /trips/1/edit + # Método que permite editar el viaje seleccionado. Ruta: + # * GET /trips/:id/edit def edit @trip = current_user.trips.find(params[:id]) end - # POST /trips - # POST /trips.json + # Método que crea el nuevo viaje. Rutas: + # * POST /trips + # * POST /trips.json def create @trip = current_user.trips.build(params[:trip]) @@ -56,8 +68,9 @@ def create end end - # PUT /trips/1 - # PUT /trips/1.json + # Método que actualiza el viaje editado. Rutas: + # * PUT /trips/:id + # * PUT /trips/:id.json def update @trip = current_user.trips.find(params[:id]) @@ -72,8 +85,9 @@ def update end end - # DELETE /trips/1 - # DELETE /trips/1.json + # Método que permite eliminar un viaje. Rutas: + # * DELETE /trips/:id + # * DELETE /trips/:id.json def destroy @trip = current_user.trips.find(params[:id]) @trip.destroy diff --git a/app/controllers/trips_controller.rb~ b/app/controllers/trips_controller.rb~ index 7d256ff..57e3402 100644 --- a/app/controllers/trips_controller.rb~ +++ b/app/controllers/trips_controller.rb~ @@ -1,5 +1,11 @@ +# == Qué hace este controlador +# El controlador de trips gestiona todo lo relacionado con la creación, edición y eliminación de viajes. Trabaja con Devise para identificar cada viaje con el usuario que lo creó. +# Tiene un filtro para ejecutar las acciones sólo si antes se ha iniciado sesión. Este filtro no afecta a las acciones index y show. + class TripsController < ApplicationController -before_filter :authenticate_user!, :except => [ :index, :show ] + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] # GET /trips # GET /trips.json @@ -16,6 +22,7 @@ before_filter :authenticate_user!, :except => [ :index, :show ] # GET /trips/1.json def show @trip = Trip.find(params[:id]) + @visit = @trip.visits.build respond_to do |format| format.html # show.html.erb diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb index c11eb7f..48cd1b3 100644 --- a/app/controllers/types_controller.rb +++ b/app/controllers/types_controller.rb @@ -1,6 +1,11 @@ +# == Qué hace este controlador +# El controlador de tipos gestiona todo lo relacionado con la creación, edición y eliminación de tipos. +# Cualquier usuario puede realizar acciones sobre los tipos. class TypesController < ApplicationController - # GET /types - # GET /types.json + + # Método que muestra todos los tipos. Rutas: + # * GET /types + # * GET /types.json def index @types = Type.all @@ -10,8 +15,9 @@ def index end end - # GET /types/1 - # GET /types/1.json + # Método que muestra el tipo seleccionado. Rutas: + # * GET /types/:id + # * GET /types/:id.json def show @type = Type.find(params[:id]) @@ -21,8 +27,9 @@ def show end end - # GET /types/ordered_index - # GET /types/ordered_index.json + # Este método define una acción que muestra todos los tipos por orden alfabético. Rutas: + # * GET /types/ordered_index + # * GET /types/ordered_index.json def ordered_index @types = Type.find(:all, :order => :name) @@ -32,8 +39,9 @@ def ordered_index end end - # GET /types/new - # GET /types/new.json + # Método que permite modificar un nuevo tipo. Rutas: + # * GET /types/new + # * GET /types/new.json def new @type = Type.new @@ -43,13 +51,15 @@ def new end end - # GET /types/1/edit + # Método que permite editar el tipo seleccionado. Ruta: + # * GET /types/:id/edit def edit @type = Type.find(params[:id]) end - # POST /types - # POST /types.json + # Método que crea el nuevo tipo. Rutas: + # * POST /types + # * POST /types.json def create @type = Type.new(params[:type]) @@ -64,8 +74,9 @@ def create end end - # PUT /types/1 - # PUT /types/1.json + # Método que actualiza el tipo editado. Rutas: + # * PUT /types/:id + # * PUT /types/:id.json def update @type = Type.find(params[:id]) @@ -80,8 +91,9 @@ def update end end - # DELETE /types/1 - # DELETE /types/1.json + # Método que permite eliminar un tipo. Rutas: + # * DELETE /types/:id + # * DELETE /types/:id.json def destroy @type = Type.find(params[:id]) @type.destroy diff --git a/app/controllers/types_controller.rb~ b/app/controllers/types_controller.rb~ index baaf537..cb92b41 100644 --- a/app/controllers/types_controller.rb~ +++ b/app/controllers/types_controller.rb~ @@ -1,96 +1,96 @@ -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 index_ordenado - @types = Type.find(:all, :order => :name) - - 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 +# == Qué hace este controlador +# El controlador de tipos gestiona todo lo relacionado con la creación, edición y eliminación de tipos. Cualquier usuario puede realizar acciones sobre los tipos. +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/ordered_index + # GET /types/ordered_index.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/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/controllers/visits_controller.rb b/app/controllers/visits_controller.rb index 52d83b1..299a9d6 100644 --- a/app/controllers/visits_controller.rb +++ b/app/controllers/visits_controller.rb @@ -1,6 +1,11 @@ +# == Qué hace este controlador +# El controlador de tipos gestiona todo lo relacionado con la creación, edición y eliminación de tipos. +# Como las visitas se renderizan con los viajes, se controla indirectamente qué usuario realiza estas acciones. class VisitsController < ApplicationController - # GET /visits - # GET /visits.json + + # Método que muestra todos las visitas. Rutas: + # * GET /visits + # * GET /visits.json def index @visits = Visit.all @@ -10,8 +15,9 @@ def index end end - # GET /visits/1 - # GET /visits/1.json + # Método que muestra la visita seleccionada. Rutas: + # * GET /visits/1 + # * GET /visits/1.json def show @visit = Visit.find(params[:id]) @@ -21,8 +27,9 @@ def show end end - # GET /visits/new - # GET /visits/new.json + # Método que permite modificar una nueva visita. Rutas: + # * GET /visits/new + # * GET /visits/new.json def new @visit = Visit.new @@ -32,13 +39,16 @@ def new end end - # GET /visits/1/edit + # Método que permite editar la visita seleccionada. Ruta: + # * GET /visits/1/edit def edit @visit = Visit.find(params[:id]) end - # POST /visits - # POST /visits.json + # Método que crea la nueva visita. Rutas: + # * POST /visits + # * POST /visits.js + # * POST /visits.json def create @visit = Visit.new(params[:visit]) @@ -54,8 +64,9 @@ def create end end - # PUT /visits/1 - # PUT /visits/1.json + # Método que actualiza la visita editada. Rutas: + # * PUT /visits/1 + # * PUT /visits/1.json def update @visit = Visit.find(params[:id]) @@ -70,14 +81,15 @@ def update end end - # DELETE /visits/1 - # DELETE /visits/1.json + # Método que permite eliminar una visita. Rutas: + # * DELETE /visits/1 + # * DELETE /visits/1.json def destroy @visit = Visit.find(params[:id]) @visit.destroy respond_to do |format| - format.html { redirect_to @visits.trip } + format.html { redirect_to @visit.trip } format.json { head :no_content } end end diff --git a/app/controllers/visits_controller.rb~ b/app/controllers/visits_controller.rb~ index 4d9ff9d..f63b1ea 100644 --- a/app/controllers/visits_controller.rb~ +++ b/app/controllers/visits_controller.rb~ @@ -1,3 +1,5 @@ +# == Qué hace este controlador +# El controlador de tipos gestiona todo lo relacionado con la creación, edición y eliminación de tipos. Como las visitas se renderizan con los viajes, se controla quién realiza estas acciones. class VisitsController < ApplicationController # GET /visits # GET /visits.json @@ -45,6 +47,7 @@ class VisitsController < ApplicationController respond_to do |format| if @visit.save format.html { redirect_to @visit.trip, notice: 'Visit was successfully created.' } + format.js format.json { render json: @visit, status: :created, location: @visit } else format.html { render action: "new" } @@ -76,7 +79,7 @@ class VisitsController < ApplicationController @visit.destroy respond_to do |format| - format.html { redirect_to @visits.trip } + format.html { redirect_to @visit.trip } format.json { head :no_content } end end diff --git a/app/models/comment.rb b/app/models/comment.rb index 04b8b8b..084af3d 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,12 +1,14 @@ +# == Qué define este modelo +# El modelo de comments define los comentarios que los usuarios hagan sobre los sitios. Cada comentario pertenece +# a un usuario y a un sitio determinado. Por defecto se ha establecido un máximo de 240 caracteres para cada comentario. class Comment < ActiveRecord::Base belongs_to :site belongs_to :user - # Debe estar protegido para evitar accesos indeseados - attr_protected :user_id + # Debe estar protegido para evitar accesos indeseados + attr_protected :user_id # Se añaden estas definiciones - validates :comment, :user_id, :site_id, :presence => true # campo obligatorio - validates :comment, :length => { :maximum => 240 } - + validates :comment, :presence => true, :length => { :maximum => 240 } # campo obligatorio + end diff --git a/app/models/comment.rb~ b/app/models/comment.rb~ index c7ec0ca..a78f161 100644 --- a/app/models/comment.rb~ +++ b/app/models/comment.rb~ @@ -1,4 +1,14 @@ +# == Qué define este modelo +# El modelo de comments define los comentarios que los ususarios hagan sobre los sitios. Cada comentario pertenece +# a un usuario y a un sitio determinado. Por defecto se ha establecido un máximo de 240 caracteres para cada comentario. class Comment < ActiveRecord::Base -belongs_to :user -belongs_to :site + belongs_to :site + belongs_to :user + + # Debe estar protegido para evitar accesos indeseados + attr_protected :user_id + + # Se añaden estas definiciones + validates :comment, :presence => true, :length => { :maximum => 240 } # campo obligatorio + end diff --git a/app/models/site.rb b/app/models/site.rb index c1145b7..39c5dea 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -1,13 +1,28 @@ +# == Qué define este modelo +# El modelo de site define un sitio, un emplazamiento en alguna parte del mundo que se añade +# por su interés turístico, especificando su tipo. Un sitio pertenece al usuario que lo ha creado +# y al tipo en el que se enmarca. Sólo el usuario que lo ha creado podrá editarlo o borrarlo. +# Un sitio puede ser parte de muchos viajes definido como una visita. Además puede tener comentarios +# que añadan los usuarios y una imagen que lo identifique. +# Obligatoriamente un sitio tiene que tener un nombre y un tipo. + class Site < ActiveRecord::Base belongs_to :type belongs_to :user - has_many :visits + + has_many :visits has_many :trips, :through => :visits - has_many :comments + has_many :comments + + 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 + #validates_numericality_of :latitud, :less_than => 90, :greater_than => -90 + #validates_numericality_of :longitud, :less_than_or_equal_to => 180, :greater_than_or_equal_to => -180 + #validates_numericality_of :zoom, :less_than => 20, :greater_than_or_equal_to => 0 + end diff --git a/app/models/site.rb~ b/app/models/site.rb~ index c1145b7..ae22f06 100644 --- a/app/models/site.rb~ +++ b/app/models/site.rb~ @@ -1,13 +1,25 @@ +# == Qué define este modelo +# El modelo de site define un sitio, un emplazamiento en alguna parte del mundo que se añade +# por su interés turístico, especificando su tipo. Un sitio pertenece al usuario que lo ha creado +# y al tipo en el que se enmarca. Sólo el usuario que lo ha creado podrá editarlo o borrarlo. +# Un sitio puede ser parte de muchos viajes definido como una visita. Además puede tener comentarios +# que añadan los usuarios y una imagen que lo identifique. + +# Obligatoriamente un sitio tiene que tener un nombre y un tipo. + class Site < ActiveRecord::Base belongs_to :type belongs_to :user - has_many :visits + + has_many :visits has_many :trips, :through => :visits - has_many :comments + has_many :comments + + 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/trip.rb b/app/models/trip.rb index dfb6c60..c28583a 100644 --- a/app/models/trip.rb +++ b/app/models/trip.rb @@ -1,9 +1,12 @@ -# Modelo de Trip y User con relación uno-a-muchos: -# -> belongs_to :user referencia un objeto User +# == Qué define este modelo +# El modelo de trips define los viajes que se pueden hacer. Cada viaje pertenece a un usuario determinado +# e incluye una serie de visitas (una serie de sitios a los que se pretende ir a una hora determinada). + class Trip < ActiveRecord::Base -belongs_to :user -has_many :visits -has_many :sites, :through => :visits -# Se añade relacion -attr_protected :user_id # Por seguridad + belongs_to :user + has_many :visits + has_many :sites, :through => :visits + + # Se añade relacion + attr_protected :user_id # Por seguridad end diff --git a/app/models/trip.rb~ b/app/models/trip.rb~ index dfb6c60..8f58b97 100644 --- a/app/models/trip.rb~ +++ b/app/models/trip.rb~ @@ -1,9 +1,10 @@ # Modelo de Trip y User con relación uno-a-muchos: # -> belongs_to :user referencia un objeto User class Trip < ActiveRecord::Base -belongs_to :user -has_many :visits -has_many :sites, :through => :visits -# Se añade relacion -attr_protected :user_id # Por seguridad + belongs_to :user + has_many :visits + has_many :sites, :through => :visits + + # Se añade relacion + attr_protected :user_id # Por seguridad end diff --git a/app/models/type.rb b/app/models/type.rb index c2c5a49..d9e353d 100644 --- a/app/models/type.rb +++ b/app/models/type.rb @@ -1,8 +1,11 @@ +# == Qué define este modelo +# El modelo de types define los tipos o categorías en los que se puede clasificar cada sitio. Un tipo agrupa a varios sitios +# que comparten unas caracterícas determinadas (como por ejemplo estar en medio de la naturaleza o ser un edificio histórico). +# Un tipo tiene que tener obligatoriamente un nombre y una descripción, pero no pueden existir dos sitios con el mismo nombre. class Type < ActiveRecord::Base has_many :sites - - # Se añade esta definición de recurso + # Se añade esta definición de recurso validates :name, :description, :presence => true # campo obligatorio validates :name, :uniqueness => true # Campo único (no repetido) end diff --git a/app/models/type.rb~ b/app/models/type.rb~ new file mode 100644 index 0000000..f41fa00 --- /dev/null +++ b/app/models/type.rb~ @@ -0,0 +1,7 @@ +class Type < ActiveRecord::Base + has_many :sites + + # Se añade esta definición de recurso + validates :name, :description, :presence => true # campo obligatorio + validates :name, :uniqueness => true # Campo único (no repetido) +end diff --git a/app/models/user.rb b/app/models/user.rb index b3643df..27c22df 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,5 +1,8 @@ +# == Qué define este modelo +# El modelo de users define los usuarios de esta página web. Cada persona debe crearse un usario que le identifique dentro +# de la página web, especificando un nombre, una contraseña para evitar accesos indeseados y la suplantación de su identidad y un correo para recibir avisos y recuperar la contraseña. +# Un usuario es dueño de todos los sitios, comentarios y viajes que haya creado, y como tal sólo él podrá editarlos o borrarlos. class User < ActiveRecord::Base - has_many :sites has_many :comments has_many :trips diff --git a/app/models/user.rb~ b/app/models/user.rb~ index 0925503..671f708 100644 --- a/app/models/user.rb~ +++ b/app/models/user.rb~ @@ -1,7 +1,7 @@ class User < ActiveRecord::Base - has_many :sites has_many :comments + has_many :trips # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable diff --git a/app/models/visit.rb b/app/models/visit.rb index 6ae1de6..e4853ba 100644 --- a/app/models/visit.rb +++ b/app/models/visit.rb @@ -1,4 +1,6 @@ +# == Qué define este modelo +# El modelo de visits define las visitas que componen cada viaje, es decir, los sitios que se desean visitar en dicho viaje. class Visit < ActiveRecord::Base -belongs_to :trip -belongs_to :site + belongs_to :trip + belongs_to :site end diff --git a/app/models/visit.rb~ b/app/models/visit.rb~ index a950b2a..ca23b73 100644 --- a/app/models/visit.rb~ +++ b/app/models/visit.rb~ @@ -1,2 +1,4 @@ class Visit < ActiveRecord::Base + belongs_to :trip + belongs_to :site end diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index 2716990..d440de7 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for(@comment) do |f| %> +<%= form_for(@comment, :remote => true) do |f| %> <% if @comment.errors.any? %>

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

    @@ -11,12 +11,11 @@
    <% end %> -

    Añada su comentario

    <%= f.text_area :comment, :maxlength => 240, :rows => 6 %>
    <%= f.number_field :site_id, :value => @site.id, :hidden => true %>
    - <%= f.submit %> + <%= f.submit 'Nuevo comentario' %>
    <% end %> diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb new file mode 100644 index 0000000..8e8985e --- /dev/null +++ b/app/views/comments/create.js.erb @@ -0,0 +1,4 @@ +// Programa jQuery/Javascript +// -> sustituye la lista de comentarios de un sitio en DOM +// -> HTML se genera en servidor con ERb +$('#comment').html("<%= j render @comment.site %>"); diff --git a/app/views/comments/create.js.erb~ b/app/views/comments/create.js.erb~ new file mode 100644 index 0000000..ce68903 --- /dev/null +++ b/app/views/comments/create.js.erb~ @@ -0,0 +1,4 @@ +// Programa jQuery/Javascript +// -> sustituye la lista de visitas de un viaje en DOM +// -> HTML se genera en servidor con ERb +$('#comment').html("<%= j render @comment.site %>"); diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb index 63612d9..154e914 100644 --- a/app/views/comments/edit.html.erb +++ b/app/views/comments/edit.html.erb @@ -1,8 +1,27 @@

    Editing comment

    -<%= render 'form' %> +<%= form_for(@comment) do |f| %> + <% if @comment.errors.any? %> +
    +

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

    -

    - -<%= link_to 'Back', site_path(@site) %> +

      + <% @comment.errors.full_messages.each do |msg| %> +
    • <%= msg %>
    • + <% end %> +
    +
    + <% end %> + +
    + <%= f.text_area :comment, :maxlength => 240, :rows => 6 %> +
    + <%= f.number_field :site_id, :value => @site.id, :hidden => true %> +
    + <%= f.submit %> +
    +<% end %> +
    + <%= link_to 'Back', site_path(@site) %> +
    diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb index 62a085a..62cebaa 100644 --- a/app/views/comments/index.html.erb +++ b/app/views/comments/index.html.erb @@ -1,9 +1,14 @@

    Comentarios de <%= @site.name %>

    -<%= render 'comment' %> - -

    - -<%= render 'form' if current_user %> - -<%= link_to 'Back', sites_path %> +

    + <%= render(@site) %> +
    + +<% if current_user %> +

    Añada su comentario

    + <%= render 'form' %> +<% end %> + +
    + <%= link_to 'Back', sites_path %> +
    \ No newline at end of file diff --git a/app/views/comments/new.html.erb b/app/views/comments/new.html.erb index 61c92f4..88b9d58 100644 --- a/app/views/comments/new.html.erb +++ b/app/views/comments/new.html.erb @@ -1,7 +1,28 @@

    New comment

    -<%= render 'form' %> +<%= form_for(@comment) do |f| %> + <% if @comment.errors.any? %> +
    +

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

    -

    +

      + <% @comment.errors.full_messages.each do |msg| %> +
    • <%= msg %>
    • + <% end %> +
    +
    + <% end %> + +

    Añada su comentario

    +
    + <%= f.text_area :comment, :maxlength => 240, :rows => 6 %> +
    + <%= f.number_field :site_id, :value => @site.id, :hidden => true %> +
    + <%= f.submit 'Nuevo comentario' %> +
    +<% end %> -<%= link_to 'Back', comments_path %> +
    + <%= link_to 'Back', site_path(@site) %> +
    diff --git a/app/views/comments/show.html.erb b/app/views/comments/show.html.erb index 21b60e6..b6fc999 100644 --- a/app/views/comments/show.html.erb +++ b/app/views/comments/show.html.erb @@ -13,7 +13,9 @@ <%= @comment.site.name %>

    -<% if @comment.user == current_user %> - <%= link_to 'Edit', edit_comment_path(@comment) %> | -<% end %> -<%= link_to 'Back', site_path(@comment.site) %> +
    + <% if @comment.user == current_user %> + <%= link_to 'Edit', edit_comment_path(@comment) %> | + <% end %> + <%= link_to 'Back', site_path(@comment.site) %> +
    diff --git a/app/views/devise/_links.erb b/app/views/devise/_links.erb index 712ea44..da22c88 100644 --- a/app/views/devise/_links.erb +++ b/app/views/devise/_links.erb @@ -1,25 +1,27 @@ -<%- if controller_name != 'sessions' %> - <%= link_to "Sign in", new_session_path(resource_name) %>
    -<% end -%> +
    + <%- if controller_name != 'sessions' %> + <%= link_to "Sign in", new_session_path(resource_name) %>
    + <% end -%> -<%- if devise_mapping.registerable? && controller_name != 'registrations' %> - <%= link_to "Sign up", new_registration_path(resource_name) %>
    -<% end -%> + <%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to "Sign up", new_registration_path(resource_name) %>
    + <% end -%> -<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> - <%= link_to "Forgot your password?", new_password_path(resource_name) %>
    -<% end -%> + <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> + <%= link_to "Forgot your password?", new_password_path(resource_name) %>
    + <% end -%> -<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> - <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
    -<% end -%> + <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
    + <% end -%> -<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> - <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
    -<% end -%> + <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
    + <% end -%> -<%- if devise_mapping.omniauthable? %> - <%- resource_class.omniauth_providers.each do |provider| %> - <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
    + <%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
    + <% end -%> <% end -%> -<% end -%> \ No newline at end of file +
    \ No newline at end of file diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 3d2a882..7e9f8e0 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -3,7 +3,10 @@ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %> <%= devise_error_messages! %> -

    <%= f.label :name %>
    <%= f.text_field :name %>

    <%= f.label :email %>
    +

    <%= f.label :name %>
    + <%= f.text_field :name %>

    + +
    <%= f.label :email %>
    <%= f.email_field :email %>
    <%= f.label :password %> (leave blank if you don't want to change it)
    @@ -22,4 +25,6 @@

    Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.

    -<%= link_to "Back", :back %> +
    + <%= link_to "Back", :back %> +
    \ No newline at end of file diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 79a8c31..8c9c8e7 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -3,7 +3,9 @@ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> <%= devise_error_messages! %> -

    <%= f.label :name %>
    <%= f.text_field :name %>

    +

    <%= f.label :name %>
    + <%= f.text_field :name %>

    +
    <%= f.label :email %>
    <%= f.email_field :email %>
    diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 879f9bb..9044507 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,56 +1,77 @@ - - Planet - <%= stylesheet_link_tag "application" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> + + Planet + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> - + + - - - + + +
    + <% if current_user %> + <%= link_to current_user.name, edit_user_registration_path %> | + <%= link_to "Sign out", destroy_user_session_path, :method => :delete %> + <% else %> + <%= link_to "Sign in", new_user_session_path %> + <% end %> +
    -
    - <% if current_user %> - <%= link_to current_user.name, - edit_user_registration_path %> | - <%= link_to "Sign out", destroy_user_session_path, :method => :delete %> - <% else %> - <%= link_to "Sign in", new_user_session_path %> - <% end %> -
    - -
    -
    - <%= link_to "Home", planet_index_path %>
    - <%= link_to "Tipos", types_path %>
    - <%= link_to "Sitios", sites_path %>
    -
      - <% Type.all.each do |type| %> -
    • <%= link_to type.name, type_sites_path(type) %>
    • - <% end %> -
    - <%= link_to "Viajes", trips_path %>
    - <%= link_to "Contact", planet_contact_path %>
    - <%= link_to "Sign up", new_user_registration_path if !current_user %> -
    -
    -

    <%= notice %>

    <%= alert %>

    - <%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', ordered_index_types_path) %> - <%= yield %> -

    - <%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', ordered_index_types_path) %> -

    +
    +
    + <%= link_to "Home", planet_index_path %>
    + <%= link_to "Tipos", types_path %>
    + <%= link_to "Sitios", sites_path %>
    +
      + <% Type.all.each do |type| %> +
    • <%= link_to type.name, type_sites_path(type) %>
    • + <% end %> +
    + <%= link_to "Viajes", trips_path %>
    + <%= link_to "Contact", planet_contact_path %>
    + <%= link_to "Documentación", "/doc/app/index.html" %>
    + <%= link_to "Sign up", new_user_registration_path unless current_user %> +
    + +
    +

    <%= notice %>

    <%= alert %>

    +
    +

    + <%= form_tag planet_search_path, :method => 'get' do %> + <%= text_field_tag :search, params[:search], id:'search' %> + <%= submit_tag "Search", :name => nil, id:'search_button' %> + <% end %> +
    + + + + <%= yield %> + + +
    -
    - + diff --git a/app/views/layouts/application.html.erb~ b/app/views/layouts/application.html.erb~ index e674df2..d7f82b3 100644 --- a/app/views/layouts/application.html.erb~ +++ b/app/views/layouts/application.html.erb~ @@ -9,6 +9,16 @@ @@ -18,17 +28,16 @@ <%= image_tag("logo3.png") %> <%= @page_title || "Planet Travel Site" %>
    -
    <% if current_user %> <%= link_to current_user.name, - edit_user_registration_path %> | + edit_user_registration_path %> | <%= link_to "Sign out", destroy_user_session_path, :method => :delete %> <% else %> <%= link_to "Sign in", new_user_session_path %> <% end %> -
    - +
    +
    <%= link_to "Home", planet_index_path %>
    @@ -39,17 +48,32 @@
  • <%= link_to type.name, type_sites_path(type) %>
  • <% end %> + <%= link_to "Viajes", trips_path %>
    <%= link_to "Contact", planet_contact_path %>
    - <%= link_to "Sign up", new_user_registration_path if !current_user %> + <%= link_to "Documentación", root_path/doc/appindex.html %>
    + <%= link_to "Sign up", new_user_registration_path unless current_user %> +
    + +

    <%= notice %>

    <%= alert %>

    <%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', ordered_index_types_path) %> <%= yield %> +

    <%= link_to('Index', planet_index_path) + "|" + link_to('Contact', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path)+ "|" + link_to('Autores', planet_author_path)+ "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', ordered_index_types_path) %>

    - \ No newline at end of file + diff --git a/app/views/layouts/application_mozilla.html.erb b/app/views/layouts/application_mozilla.html.erb new file mode 100644 index 0000000..8b0fa46 --- /dev/null +++ b/app/views/layouts/application_mozilla.html.erb @@ -0,0 +1,77 @@ + + + + Planet + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + + + + +
    + <% if current_user %> + <%= link_to current_user.name, edit_user_registration_path %> | + <%= link_to "Sign out", destroy_user_session_path, :method => :delete %> + <% else %> + <%= link_to "Sign in", new_user_session_path %> + <% end %> +
    + +
    +
    + <%= link_to "Home", planet_index_path %>
    + <%= link_to "Tipos", types_path %>
    + <%= link_to "Sitios", sites_path %>
    +
      + <% Type.all.each do |type| %> +
    • <%= link_to type.name, type_sites_path(type) %>
    • + <% end %> +
    + <%= link_to "Viajes", trips_path %>
    + <%= link_to "Contact", planet_contact_path %>
    + <%= link_to "Documentación", "/doc/app/index.html" %>
    + <%= link_to "Sign up", new_user_registration_path unless current_user %> +
    + +
    +

    <%= notice %>

    <%= alert %>

    +
    +

    + <%= form_tag planet_search_path, :method => 'get' do %> + <%= text_field_tag :search, params[:search], id:'search' %> + <%= submit_tag "Search", :name => nil, :disabled => true, id:'search_button' %> + <% end %> +
    + + + + <%= yield %> + + +
    +
    + + \ No newline at end of file diff --git a/app/views/planet/index.html.erb b/app/views/planet/index.html.erb index bbee722..743d57a 100644 --- a/app/views/planet/index.html.erb +++ b/app/views/planet/index.html.erb @@ -1 +1 @@ -

    Wecome to the Planet Travel Site

    This site gathers information of touristic sites from all over the world and should help you to organize your trips and your holidays.

    <%= image_tag('pedriza2-m.png') %>

    Feel free to use it for your convenience and pleasure.

    \ No newline at end of file +

    Welcome to the Planet Travel Site

    This site gathers information of touristic sites from all over the world and should help you to organize your trips and your holidays.

    <%= image_tag('pedriza2-m.png') %>

    Feel free to use it for your convenience and pleasure.

    \ No newline at end of file diff --git a/app/views/planet/search.html.erb b/app/views/planet/search.html.erb new file mode 100644 index 0000000..22b9622 --- /dev/null +++ b/app/views/planet/search.html.erb @@ -0,0 +1,11 @@ +
    +

    Resultados en sitios

    + + <%= render 'sites/sites' %> +
    + +
    +

    Resultados en viajes

    + + <%= render 'trips/trips' %> +
    diff --git a/app/views/planet/search.html.erb~ b/app/views/planet/search.html.erb~ new file mode 100644 index 0000000..677e130 --- /dev/null +++ b/app/views/planet/search.html.erb~ @@ -0,0 +1,32 @@ + + + Autores + + + +

    + Información sobre los creadores +

    + +

    En esta página podrá encontrar varios datos sobre los creadores +

    + +

    Alberto Moreno Díaz

    + <%= image_tag('alberto.jpg') %> +
      +
    • Dirección de correo: alberto.moreno.diaz@alumnos.upm.es
    • +
    • Dirección física: C/Sin nombre 7, 9ºB, Madrid
    • +
    • Breve currículum: estudiante de 4º curso de Ingeniería de Telecomunicación en la ETSIT.
    • +
    + +

    Francisco José Gil García

    + <%= image_tag('francisco.jpg') %> +
      +
    • Dirección de correo: fj.gil@alumnos.upm.es
    • +
    • Dirección física: C/Con nombre 2, Bajo Derecha, Villatempujo de arriba
    • +
    • Breve currículum: a rellenar
    • +
    + +

    Para cualquier duda o problema no dude en contactarnos.

    + + diff --git a/app/views/sites/_form.html.erb b/app/views/sites/_form.html.erb index 68b318d..9f27a0e 100644 --- a/app/views/sites/_form.html.erb +++ b/app/views/sites/_form.html.erb @@ -24,8 +24,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 %>
    @@ -37,7 +37,7 @@
    <%= f.label :zoom %>
    - <%= f.number_field :zoom %> + <%= f.select(:zoom, Array.new(21, 0).fill{|i| [(i.to_s), i]}) %>
    <%= f.submit %> diff --git a/app/views/sites/_newform.html.erb b/app/views/sites/_newform.html.erb index f8875aa..4e3f9a9 100644 --- a/app/views/sites/_newform.html.erb +++ b/app/views/sites/_newform.html.erb @@ -8,10 +8,10 @@ } else { alert('Geolocation is not supported in this browser.'); } function displayPosition(position){ - lat = position.coords.latitude; - lon = position.coords.longitude; - $("#latitud").val(lat); - $("#longitud").val(lon); + latitud = position.coords.latitude; + longitud = position.coords.longitude; + $("#latitud").val(latitud); + $("#longitud").val(longitud); } function errorFunction(position) { alert('Error!'); } @@ -19,51 +19,6 @@ - <%= 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, id:'latitud' %> -
    -
    - <%= f.label :longitud %>
    - <%= f.text_field :longitud, id:'longitud' %> -
    -
    - <%= f.label :zoom %>
    - <%= f.number_field :zoom, :value => 15 %> -
    - -
    - <%= f.submit %> -
    - - <% end %> + <%= render 'form' %> diff --git a/app/views/sites/_site.html.erb b/app/views/sites/_site.html.erb new file mode 100644 index 0000000..d63cc53 --- /dev/null +++ b/app/views/sites/_site.html.erb @@ -0,0 +1,28 @@ +
    + + <% site.comments.each do |comment| %> + + + + + + + <% end %> +
    +
    + <% if comment.user == current_user %> +
    <%= link_to comment.user.name + ":", edit_user_registration_path %>
    + <% else %> +
    <%= comment.user.name + ":" %>
    + <% end %> +
    <%= strip_tags(comment.comment) %>
    +
    +
    + <% if comment.user == current_user %> + <%= link_to 'Edit', edit_comment_path(comment) %>
    + <%= link_to 'Destroy', comment, + :confirm => 'Are you sure?', + :method => :delete if comment.user == current_user %> + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/sites/_sites.html.erb b/app/views/sites/_sites.html.erb new file mode 100644 index 0000000..cc31b61 --- /dev/null +++ b/app/views/sites/_sites.html.erb @@ -0,0 +1,33 @@ +
    + + <% @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) %>
    +
    + Viajes: <%= site.trips.size %>
    + <% unless site.comments.empty? %> + <%= link_to 'Comentarios', site_comments_path(site) %> + <% end %> +
    +
    + <%= 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 %> +
    +
    \ No newline at end of file diff --git a/app/views/sites/edit.html.erb b/app/views/sites/edit.html.erb index af18cc3..ef68a5c 100644 --- a/app/views/sites/edit.html.erb +++ b/app/views/sites/edit.html.erb @@ -2,5 +2,7 @@ <%= render 'form' %> -<%= link_to 'Show', @site %> | -<%= link_to 'Back', sites_path %> +
    + <%= link_to 'Show', @site %> | + <%= link_to 'Back', sites_path %> +
    \ No newline at end of file diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index 12aa4d1..0fba005 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -1,41 +1,9 @@

    <%= @sites == Site.all ? "Todos los sitios" : Type.find(params[:type_id]).name %>

    - - <% @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) %>
    -
    - Viajes: <%= site.trips.size %>
    - <% unless site.comments.empty? %> - <%= link_to 'Comentarios', site_comments_path(site) %> - <% end %> -
    -
    - <%= 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 %> -
    + <%= render 'sites' %>
    - -
    - -<%= link_to 'New site', new_site_path %> \ No newline at end of file + +
    + <%= link_to 'New site', new_site_path %> +
    \ No newline at end of file diff --git a/app/views/sites/new.html.erb b/app/views/sites/new.html.erb index c85a1cc..8524f27 100644 --- a/app/views/sites/new.html.erb +++ b/app/views/sites/new.html.erb @@ -2,5 +2,6 @@ <%= render 'newform' %> -<%= link_to 'Back', sites_path %> - \ No newline at end of file +
    + <%= link_to 'Back', sites_path %> +
    \ No newline at end of file diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 970cabf..3a0ba19 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -27,7 +27,7 @@

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

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

    <%= @site.name %>

    <%=sanitize @site.description %>

    @@ -41,31 +41,41 @@ <%= @site.zoom %>

    -

    Viajes: - <%= @site.trips.size %>

    +

    Viajes: <%= @site.trips.size %>

    - <% unless @site.comments.empty? %> -

    Comentarios:

    - <% @comments = @site.comments %> - <%= render 'comments/comment' %> - <% end %> - -

    - - <%= render 'comments/form' if current_user%> +

    +

    Visitas: <%= @site.visitas %>

    +
    -
    +
    +

    Comentarios

    + <%= render(@site) %> +
    + + <% if current_user %> +

    Añada su comentario

    + <%= render 'comments/form' %> + <% end %> +

    Posición geográfica

    <% if (@site.latitud && @site.longitud && @site.zoom) %> -

    + <% if (@site.latitud > -90 && @site.latitud < 90) %> +

    + <% else %> +

    <%= @site.name %>: Latitud no válida (debe ser mayor que -90 y menor que 90) + <% end %> + <% else %> +

    No se disponen de datos suficientes para mostrar la ubicación de <%= @site.name %>

    <% end %> - <% 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/trips/_trip.html.erb b/app/views/trips/_trip.html.erb index 779594c..f37f644 100644 --- a/app/views/trips/_trip.html.erb +++ b/app/views/trips/_trip.html.erb @@ -1,29 +1,29 @@
    - <% trip.visits.order(:hour).each do |visit| %> - - + <% trip.visits.order(:hour).each do |visit| %> + + - + + - - - <% end %> + + + <% end %>
    - <%= 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 %> + -
    -
    <%= visit.hour.to_s + 'h: ' %> - <%=link_to(visit.site.name, visit.site) %>
    -
    <%= truncate(strip_tags(visit.site.description), +
    +
    +
    <%= 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, +
    + <%= 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/trips/_trips.html.erb b/app/views/trips/_trips.html.erb new file mode 100644 index 0000000..08bc858 --- /dev/null +++ b/app/views/trips/_trips.html.erb @@ -0,0 +1,27 @@ +
    + + <% @trips.each do |trip| %> + + + + + + + <% end %> +
    +
    +
    <%= link_to trip.name, trip_path(trip) %>
    +
    <%= truncate(strip_tags(trip.description), + :length => 80) + ', ' + trip.date.to_s %>
    +
    +
    + <%= link_to 'Show', trip %>
    + <% if trip.user == current_user %> + <%= link_to 'Edit', edit_trip_path(trip) %>
    + <%= link_to 'Destroy', trip, + :confirm => 'Are you sure?', + :method => :delete, + :remote => true %> + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/trips/edit.html.erb b/app/views/trips/edit.html.erb index 71287a4..90ad682 100644 --- a/app/views/trips/edit.html.erb +++ b/app/views/trips/edit.html.erb @@ -2,5 +2,7 @@ <%= render 'form' %> -<%= link_to 'Show', @trip %> | -<%= link_to 'Back', trips_path %> +
    + <%= link_to 'Show', @trip %> | + <%= link_to 'Back', trips_path %> +
    \ No newline at end of file diff --git a/app/views/trips/index.html.erb b/app/views/trips/index.html.erb index dbab91f..aa0df41 100644 --- a/app/views/trips/index.html.erb +++ b/app/views/trips/index.html.erb @@ -1,28 +1 @@ -
    -

    Viajes

    - - <% @trips.each do |trip| %> - - - - -<% end %> -
    -
    -
    <%= link_to trip.name, trip_path(trip) %>
    -
    <%= truncate(strip_tags(trip.description), - :length => 80) + ', ' + trip.date.to_s %>
    -
    -
    - <%= link_to 'Show', trip %>
    - <% if trip.user == current_user %> - <%= link_to 'Edit', edit_trip_path(trip) %>
    - <%= link_to 'Destroy', trip, - :confirm => 'Are you sure?', - :method => :delete %> - <% end %> -
    -

    - -<%= link_to 'New Trip', new_trip_path %> - +

    Viajes

    <%= render 'trips' %>
    <%= link_to 'New Trip', new_trip_path %>
    \ No newline at end of file diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb index dd3e49d..68b88f9 100644 --- a/app/views/trips/new.html.erb +++ b/app/views/trips/new.html.erb @@ -2,4 +2,6 @@ <%= render 'form' %> -<%= link_to 'Back', trips_path %> +
    + <%= 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 index c0575d1..2049b58 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -3,29 +3,41 @@ - +

    Name: <%= @trip.name %>

    Date: <%= @trip.date %>

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

    @@ -35,7 +47,7 @@

    Sitios a visitar

    <%= render(@trip) %> <% if @trip.user == current_user %> - <%= form_for(@visit) do |f| %> + <%= form_for(@visit, :remote => true) 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]}) %> @@ -44,12 +56,29 @@ <% end %>
    -

    +

    Posición geográfica

    + <% mapa = false %> + <% @trip.sites.each do |site| %> + <% if site.latitud && site.longitud %> + <% if site.latitud > -90 && site.latitud < 90 %> + <% mapa = true if !mapa %> + <% else %> +

    <%= site.name %>: Latitud no válida (debe ser mayor que -90 y menor que 90) + <% end %> + <% else %> +

    No se disponen de datos suficientes para mostrar la ubicación de <%= site.name %> + <% end %> + <% end %> + <% if mapa %> +

    + <% end %> - <% if @trip.user == current_user %> - <%= link_to 'Edit', edit_trip_path(@trip) %> | - <% end %> - <%= link_to 'Back', trips_path %> +

    + <% if @trip.user == current_user %> + <%= link_to 'Edit', edit_trip_path(@trip) %> | + <% end %> + <%= link_to 'Back', trips_path %> +
    diff --git a/app/views/types/edit.html.erb b/app/views/types/edit.html.erb index cdc4b34..3965ab7 100644 --- a/app/views/types/edit.html.erb +++ b/app/views/types/edit.html.erb @@ -2,5 +2,7 @@ <%= render 'form' %> -<%= link_to 'Show', @type %> | -<%= link_to 'Back', types_path %> +
    + <%= link_to 'Show', @type %> | + <%= link_to 'Back', types_path %> +
    \ No newline at end of file diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb index 6b26830..d187b57 100644 --- a/app/views/types/index.html.erb +++ b/app/views/types/index.html.erb @@ -25,6 +25,6 @@
    -
    - -<%= link_to 'New Type', new_type_path %> +
    + <%= link_to 'New Type', new_type_path %> +
    \ No newline at end of file diff --git a/app/views/types/new.html.erb b/app/views/types/new.html.erb index c7179ac..4e138be 100644 --- a/app/views/types/new.html.erb +++ b/app/views/types/new.html.erb @@ -2,4 +2,6 @@ <%= render 'form' %> -<%= link_to 'Back', types_path %> +
    + <%= link_to 'Back', types_path %> +
    \ No newline at end of file diff --git a/app/views/types/ordered_index.html.erb b/app/views/types/ordered_index.html.erb index 6b26830..d187b57 100644 --- a/app/views/types/ordered_index.html.erb +++ b/app/views/types/ordered_index.html.erb @@ -25,6 +25,6 @@ -
    - -<%= link_to 'New Type', new_type_path %> +
    + <%= link_to 'New Type', new_type_path %> +
    \ No newline at end of file diff --git a/app/views/types/show.html.erb b/app/views/types/show.html.erb index 0a8083a..7202c4f 100644 --- a/app/views/types/show.html.erb +++ b/app/views/types/show.html.erb @@ -10,6 +10,7 @@ <%= @type.description %>

    - -<%= link_to 'Edit', edit_type_path(@type) %> | -<%= link_to 'Back', types_path %> +
    + <%= link_to 'Edit', edit_type_path(@type) %> | + <%= link_to 'Back', types_path %> +
    \ No newline at end of file diff --git a/app/views/visits/edit.html.erb b/app/views/visits/edit.html.erb index 66d34d9..f000918 100644 --- a/app/views/visits/edit.html.erb +++ b/app/views/visits/edit.html.erb @@ -2,5 +2,7 @@ <%= render 'form' %> -<%= link_to 'Show', @visit %> | -<%= link_to 'Back', visits_path %> +
    + <%= link_to 'Show', @visit %> | + <%= link_to 'Back', visits_path %> +
    \ No newline at end of file diff --git a/app/views/visits/index.html.erb b/app/views/visits/index.html.erb index c7bea46..6527e5c 100644 --- a/app/views/visits/index.html.erb +++ b/app/views/visits/index.html.erb @@ -22,6 +22,6 @@ <% end %> -
    - -<%= link_to 'New Visit', new_visit_path %> +
    + <%= link_to 'New Visit', new_visit_path %> +
    \ No newline at end of file diff --git a/app/views/visits/new.html.erb b/app/views/visits/new.html.erb index 1be1930..0490ab9 100644 --- a/app/views/visits/new.html.erb +++ b/app/views/visits/new.html.erb @@ -2,4 +2,6 @@ <%= render 'form' %> -<%= link_to 'Back', visits_path %> +
    + <%= link_to 'Back', visits_path %> +
    \ No newline at end of file diff --git a/app/views/visits/show.html.erb b/app/views/visits/show.html.erb index 2bf41f5..281cd84 100644 --- a/app/views/visits/show.html.erb +++ b/app/views/visits/show.html.erb @@ -15,6 +15,7 @@ <%= @visit.hour %>

    - -<%= link_to 'Edit', edit_visit_path(@visit) %> | -<%= link_to 'Back', visits_path %> +
    + <%= link_to 'Edit', edit_visit_path(@visit) %> | + <%= link_to 'Back', visits_path %> +
    \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index 6357c19..5853707 100644 --- a/config/application.rb +++ b/config/application.rb @@ -55,5 +55,9 @@ class Application < Rails::Application # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' + + # Avoid problem when deploying to Heroku + # https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar#troubleshooting + config.assets.initialize_on_precompile = false end end diff --git a/config/routes.rb b/config/routes.rb index f587c30..b841de4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,19 +4,19 @@ resources :trips - resources :comments, :except => [ :new, :index, :show ] + resources :comments, :except => [ :index, :new ] devise_for :users resources :sites do - resources :comments, :only => [ :index ] + resources :comments, :only => [ :index, :new ] end resources :types do get 'ordered_index', :on => :collection resources :sites, :only => [ :index ] # Rutas anidadas /types/id/sites. Restringe a acción “index” end - + get "planet/index" get "planet/contact" @@ -25,6 +25,8 @@ get "planet/author" + get "planet/search" + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/config/routes.rb~ b/config/routes.rb~ index 833f19c..f587c30 100644 --- a/config/routes.rb~ +++ b/config/routes.rb~ @@ -1,7 +1,12 @@ Planet::Application.routes.draw do - resources :comments, :except => [ :new, :index ] - devise_for :users + resources :visits + + resources :trips + + resources :comments, :except => [ :new, :index, :show ] + + devise_for :users resources :sites do resources :comments, :only => [ :index ] diff --git a/db/migrate/20120411095828_add_paperclip_to_sites.rb b/db/migrate/20120411095828_add_paperclip_to_sites.rb new file mode 100644 index 0000000..3139184 --- /dev/null +++ b/db/migrate/20120411095828_add_paperclip_to_sites.rb @@ -0,0 +1,19 @@ +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/20120411160519_site_visitas.rb b/db/migrate/20120411160519_site_visitas.rb new file mode 100644 index 0000000..9adc908 --- /dev/null +++ b/db/migrate/20120411160519_site_visitas.rb @@ -0,0 +1,13 @@ +class SiteVisitas < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :visitas, :integer, :default => 0 + end + end + + def down + change_table :sites do |t| + t.remove :visitas + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 883f0c7..67fd723 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,80 +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 => 20120417205239) do - - create_table "comments", :force => true do |t| - t.string "comment" - t.integer "user_id" - t.integer "site_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "sites", :force => true do |t| - t.string "name" - 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 "longitud" - t.float "latitud" - t.float "zoom" - 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 +# 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 => 20120417205239) do + + create_table "comments", :force => true do |t| + t.string "comment" + t.integer "user_id" + t.integer "site_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "sites", :force => true do |t| + t.string "name" + 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.string "image_file_name" + t.string "image_content_type" + t.string "image_file_size" + t.datetime "image_updated_at" + t.integer "visitas", :default => 0 + t.float "longitud" + t.float "latitud" + t.integer "zoom" + 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 diff --git a/db/seeds.rb b/db/seeds.rb index de2aded..7cecf8e 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,56 +9,109 @@ Type.delete_all -tm = Type.create( +type1 = Type.create!( name: 'Monumento', description: 'Edificio de interes turistico o artistico') -tn = Type.create( +type2 = Type.create!( name: 'Naturaleza', description: 'Lugar al aire libre de interes natural o de recreo') -tr = Type.create( +type3 = Type.create!( name: 'Ruina', description: 'Lugar o resto de interes arquelogico') -Site.delete_all +User.delete_all + +user1 = User.create!( + name: 'Jose Perez', + email: 'jose.perez@gmail.com', + password: 'perez22', + password_confirmation: 'perez22') +user2 = User.create!( + name: 'Javier Sedano', + email: 'javier.sedano@me.com', + password: 'sedano22', + password_confirmation: 'sedano22') -Site.create( + +Site.delete_all + +site1= Site.create!( name: 'Pedriza', description: 'Magnifico valle al norte de Madrid en el Macizo Central', - type_id: tn.id, - image_url: 'pedriza.png') + type_id: type2.id, + image_url: 'pedriza.png', + image: File.open(File.join(Rails.root, 'app', 'assets','images', 'pedriza.png'), "r")) +site1.user_id = user1.id ; site1.save -Site.create( +site2 = Site.create!( name: 'Catedral de Florencia', description: 'Catedral de la ciudad de Florencia con la que se inicia el Renacimiento', - type_id: tm.id, - image_url: 'florencia.png') + type_id: type1.id, + image_url: 'florencia.png', + image: File.open(File.join(Rails.root, 'app', 'assets','images', 'florencia.png'), "r")) +site2.user_id = user1.id ; site2.save -Site.create( +site3 = Site.create!( name: 'Jardin de Lineo', - description: 'Jardin de la ciudad sueca de Uppsala donde el famoso naturalista enia su coleccion de plantas', - type_id: tn.id, - image_url: 'arbol1.png') + description: 'Jardin de la ciudad sueca de Uppsala donde el famoso naturalista tenia su coleccion de plantas', + type_id: type1.id, + image_url: 'arbol1.png', + image: File.open(File.join(Rails.root, 'app', 'assets','images', 'arbol1.png'), "r")) +site3.user_id = user2.id ; site3.save -Site.create( +site4 = Site.create!( name: 'Reichstag', description: 'Parlamento aleman en la ciudad de Berlin', - type_id: tm.id, - image_url: 'reichstag.png') + type_id: type2.id, + image_url: 'reichstag.png', + image: File.open(File.join(Rails.root, 'app', 'assets','images', 'reichstag.png'), "r")) +site4.user_id = user2.id ; site4.save -Site.create( +site5 = Site.create!( name: 'Pergamo', description: 'Puerta del mercado de la antigua ciudad griega de Pergamo del museo arquelogico de Berlin', - type_id: tr.id, - image_url: 'pergamo.png') + type_id: type3.id, + image_url: 'pergamo.png', + image: File.open(File.join(Rails.root, 'app', 'assets','images', 'pergamo.png'), "r")) +site5.user_id = user1.id ; site5.save + + + +Trip.delete_all + +trip1 = Trip.create!( + name: 'Viaje por Europa', + description: 'Viaje por capitales europeas', + date: '2012-04-12') +trip1.user_id = user1.id ; trip1.save + +trip2 = Trip.create!( + name: 'Sierra de Madrid', + description: 'Sua al Yelmo en la Pedriza', + date: '2012-05-18') +trip2.user_id = user2.id ; trip2.save + + +Visit.delete_all + +visit1 = Visit.create!( + hour: '10') +visit1.trip_id = trip2.id +visit1.site_id = site1.id ; visit1.save -# user_id esta protegido con "attr_protected" y debe inicializarse asi, -# Site.create(....) levantaria una excepcipón al intentar inicializarlo -Site.all.each { |obj| obj.user_id = 1 ; obj.save } +visit2 = Visit.create!( + hour: '9') +visit2.trip_id = trip1.id +visit2.site_id = site5.id ; visit2.save +visit3 = Visit.create!( + hour: '16') +visit3.trip_id = trip1.id +visit3.site_id = site4.id ; visit3.save diff --git a/doc/app/ApplicationController.html b/doc/app/ApplicationController.html new file mode 100644 index 0000000..fd3724e --- /dev/null +++ b/doc/app/ApplicationController.html @@ -0,0 +1,163 @@ + + + + + + +class ApplicationController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class ApplicationController

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/ApplicationHelper.html b/doc/app/ApplicationHelper.html new file mode 100644 index 0000000..2592c04 --- /dev/null +++ b/doc/app/ApplicationHelper.html @@ -0,0 +1,157 @@ + + + + + + +module ApplicationHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module ApplicationHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/Comment.html b/doc/app/Comment.html new file mode 100644 index 0000000..ebe03b1 --- /dev/null +++ b/doc/app/Comment.html @@ -0,0 +1,170 @@ + + + + + + +class Comment - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Comment

    + +
    + +

    Qué define este modelo

    + +

    El modelo de comments define los comentarios que los usuarios hagan sobre +los sitios. Cada comentario pertenece a un usuario y a un sitio +determinado. Por defecto se ha establecido un máximo de 240 caracteres para +cada comentario.

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/CommentsController.html b/doc/app/CommentsController.html new file mode 100644 index 0000000..d35dc81 --- /dev/null +++ b/doc/app/CommentsController.html @@ -0,0 +1,494 @@ + + + + + + +class CommentsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class CommentsController

    + +
    + +

    Qué hace este controlador

    + +

    El controlador de comments gestiona todo lo relacionado con la creación, +edición y eliminación de comentarios. Trabaja con Devise para identificar +cada comentario con el usuario que lo creó. Tiene un filtro para ejecutar +las acciones sólo si se ha iniciado sesión. Este filtro no afecta a las +acciones index y show.

    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + create() + click to toggle source +
    + + +
    + +

    Método que crea el nuevo comentario. Rutas:

    +
    • +

      POST /comments

      +
    • +

      POST /comments.js

      +
    • +

      POST /comments.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 62
    +def create
    +  @comment = current_user.comments.build(params[:comment])
    +  @site = @comment.site
    +
    +  respond_to do |format|
    +    if @comment.save
    +      format.html { redirect_to site_path(@site), notice: 'Comment was successfully created.' }
    +      format.js
    +      format.json { render json: @comment, status: :created, location: @comment }
    +    else
    +      format.html { render action: "new" }
    +      format.json { render json: @comment.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    Método que permite eliminar un comentario. Rutas:

    +
    • +

      DELETE /comments/:id

      +
    • +

      DELETE /comments/:id.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 99
    +def destroy
    +  @comment = current_user.comments.find(params[:id])
    +  site = @comment.site
    +  @comment.destroy
    +
    +  respond_to do |format|
    +    format.html { redirect_to site_path(site) }
    +    format.json { head :no_content }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    Método que permite editar el comentario seleccionado. Ruta:

    +
    • +

      GET /comments/:id/edit

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 53
    +def edit
    +  @comment = current_user.comments.find(params[:id])
    +  @site = @comment.site
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que muestra los comentarios asociados al sitio seleccionado. Rutas:

    +
    • +

      GET /sites/:site_id/comments

      +
    • +

      GET /sites/:site_id/comments.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 15
    +def index
    +  @site = Site.find(params[:site_id])
    +  @comments = @site.comments
    +  @comment = current_user.comments.build if current_user
    +
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @comments }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    Método que permite modificar un nuevo comentario asociado a un sitio. +Rutas:

    +
    • +

      GET /sites/:site_id/comments/new

      +
    • +

      GET /sites/:site_id/comments/new.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 41
    +def new
    +  @comment = current_user.comments.build
    +  @site = Site.find(params[:site_id])
    +
    +  respond_to do |format|
    +    format.html # new.html.erb
    +    format.json { render json: @comment }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + show() + click to toggle source +
    + + +
    + +

    Método que muestra el comentario seleccionado. Rutas:

    +
    • +

      GET /comments/:comment_id

      +
    • +

      GET /comments/:comment_id.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 29
    +def show
    +  @comment = Comment.find(params[:id])
    +
    +  respond_to do |format|
    +    format.html # show.html.erb
    +    format.json { render json: @comment }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + update() + click to toggle source +
    + + +
    + +

    Método que actualiza el comentario editado. Rutas:

    +
    • +

      PUT /comments/:id

      +
    • +

      PUT /comments/:id.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 81
    +def update
    +  @comment = current_user.comments.find(params[:id])
    +  @site = @comment.site
    +
    +  respond_to do |format|
    +    if @comment.update_attributes(params[:comment])
    +      format.html { redirect_to site_path(@site), notice: 'Comment was successfully updated.' }
    +      format.json { head :no_content }
    +    else
    +      format.html { render action: "edit" }
    +      format.json { render json: @comment.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + +
    + + + + diff --git a/doc/app/CommentsHelper.html b/doc/app/CommentsHelper.html new file mode 100644 index 0000000..bfebd8f --- /dev/null +++ b/doc/app/CommentsHelper.html @@ -0,0 +1,157 @@ + + + + + + +module CommentsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module CommentsHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/PlanetController.html b/doc/app/PlanetController.html new file mode 100644 index 0000000..c3d8e96 --- /dev/null +++ b/doc/app/PlanetController.html @@ -0,0 +1,399 @@ + + + + + + +class PlanetController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class PlanetController

    + +
    + +

    PlanetController ilustra el uso de +RDoc. La documentación de un proyecto en genera en el +directorio proy/doc en formato Web con

    + +
    $proy> rake doc:app
    + +

    Algunos comandos de formateo

    + +

    Tal y como muestra el subitulo anterior, este se define empezando la línea +con ==. En los títulos debe empezar por =.

    + +

    Un [ … ] seguido de texto define una lista titulada, como aquí

    +
    Clases, Módulos o Métodos +
    +

    Se documentan con comentarios justo encima de sus definición, como aquí.

    +
    + +

    Un * o - definen las entradas de una lista itemizada

    + + +

    Un número o letra seguido de punto genera una lista númerada

    +
    1. +

      + permite generar negrita, igual que con +HTML

      +
    2. +

      _ permite generar cursiva, igual que con HTML

      +
      • +

        permite generar letra de teletipo, igual que con +HTML

        +
      +
    + +

    Qué hace este controlador

    + +

    El controlador de planet es en gran parte un controlador de prueba con +acciones vacías. Sólo hay un método con una acción completa, search. Esta +acción busca los sitios o viajes que tengan en su nombre o en su +descripción la cadena de texto introducida.

    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + author() + click to toggle source +
    + + +
    + +

    Método que define una acción vacía del controlador. Ruta:

    +
    • +

      GET /planet/author

      +
    + + + +
    +
    # File app/controllers/planet_controller.rb, line 44
    +def author
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + contact() + click to toggle source +
    + + +
    + +

    Método que define una acción vacía del controlador. Ruta:

    +
    • +

      GET /planet/contact

      +
    + + + +
    +
    # File app/controllers/planet_controller.rb, line 34
    +def contact
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + ejemplo() + click to toggle source +
    + + +
    + +

    Método que define una acción vacía del controlador. Ruta:

    +
    • +

      GET /planet/ejemplo

      +
    + + + +
    +
    # File app/controllers/planet_controller.rb, line 39
    +def ejemplo
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que define una acción vacía del controlador. Ruta:

    +
    • +

      GET /planet/index

      +
    + + + +
    +
    # File app/controllers/planet_controller.rb, line 29
    +def index
    +end
    +
    + +
    + + + + +
    + + + + + +
    + +
    + +
    + + + + diff --git a/doc/app/PlanetHelper.html b/doc/app/PlanetHelper.html new file mode 100644 index 0000000..4f02ec7 --- /dev/null +++ b/doc/app/PlanetHelper.html @@ -0,0 +1,157 @@ + + + + + + +module PlanetHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module PlanetHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/Site.html b/doc/app/Site.html new file mode 100644 index 0000000..b55d708 --- /dev/null +++ b/doc/app/Site.html @@ -0,0 +1,173 @@ + + + + + + +class Site - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Site

    + +
    + +

    Qué define este modelo

    + +

    El modelo de site define un sitio, un emplazamiento en alguna parte del +mundo que se añade por su interés turístico, especificando su tipo. Un +sitio pertenece al usuario que lo ha creado y al tipo en el que se enmarca. +Sólo el usuario que lo ha creado podrá editarlo o borrarlo. Un sitio puede +ser parte de muchos viajes definido como una visita. Además puede tener +comentarios que añadan los usuarios y una imagen que lo identifique. +Obligatoriamente un sitio tiene que tener un nombre y un tipo.

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/SitesController.html b/doc/app/SitesController.html new file mode 100644 index 0000000..b17f3a8 --- /dev/null +++ b/doc/app/SitesController.html @@ -0,0 +1,494 @@ + + + + + + +class SitesController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class SitesController

    + +
    + +

    Qué hace este controlador

    + +

    El controlador de sites gestiona todo lo relacionado con la creación, +edición y eliminación de sitios. Trabaja con Devise para identificar cada +sitio con el usuario que lo creó. Tiene dos filtros:

    +
    • +

      Uno para ejecutar las acciones sólo si antes se ha iniciado sesión. Este +filtro no afecta a las acciones index y show.

      +
    • +

      Otro para ejecutar el método que define la acción count_visita después de +la carga de la página.

      +
    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + create() + click to toggle source +
    + + +
    + +

    Método que crea el nuevo sitio. Rutas:

    +
    • +

      POST /sites

      +
    • +

      POST /sites.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 63
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    Método que permite eliminar un sitio. Rutas:

    +
    • +

      DELETE /sites/:id

      +
    • +

      DELETE /sites/:id.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 97
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    Método que permite editar el sitio seleccionado. Ruta:

    +
    • +

      GET /sites/:id/edit

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 56
    +def edit
    +  @site = current_user.sites.find(params[:id])  # busca solo en sitios asociados a current_user
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Este método muestra todos los sitios si no se ha especificado un tipo o los +sitios de un tipo determinado. Rutas:

    +
    • +

      GET /sites

      +
    • +

      GET /sites.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 16
    +def index
    +  if params[:type_id].nil? or params[:type_id].empty?
    +    @sites = Site.all            # path: /sites
    +  else
    +    @sites = Type.find(params[:type_id]).sites  # path: /types/:type_id/sites
    +  end
    +  
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @sites }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    Método que permite modificar un nuevo sitio. Rutas:

    +
    • +

      GET /sites/new

      +
    • +

      GET /sites/new.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 45
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + show() + click to toggle source +
    + + +
    + +

    Método que muestra el sitio seleccionado. Rutas:

    +
    • +

      GET /sites/:id

      +
    • +

      GET /sites/:id.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 32
    +def show
    +  @site = Site.find(params[:id])
    +  @comment = current_user.comments.build if current_user
    +
    +  respond_to do |format|
    +    format.html # show.html.erb
    +    format.json { render json: @site }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + update() + click to toggle source +
    + + +
    + +

    Método que actualiza el sitio editado. Rutas:

    +
    • +

      PUT /sites/:id

      +
    • +

      PUT /sites/:id.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 80
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + +
    + + + + diff --git a/doc/app/SitesHelper.html b/doc/app/SitesHelper.html new file mode 100644 index 0000000..4e08fe9 --- /dev/null +++ b/doc/app/SitesHelper.html @@ -0,0 +1,157 @@ + + + + + + +module SitesHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module SitesHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/Trip.html b/doc/app/Trip.html new file mode 100644 index 0000000..f73b43d --- /dev/null +++ b/doc/app/Trip.html @@ -0,0 +1,169 @@ + + + + + + +class Trip - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Trip

    + +
    + +

    Qué define este modelo

    + +

    El modelo de trips define los viajes que se pueden hacer. Cada viaje +pertenece a un usuario determinado e incluye una serie de visitas (una +serie de sitios a los que se pretende ir a una hora determinada).

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/TripsController.html b/doc/app/TripsController.html new file mode 100644 index 0000000..07a83a7 --- /dev/null +++ b/doc/app/TripsController.html @@ -0,0 +1,484 @@ + + + + + + +class TripsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class TripsController

    + +
    + +

    Qué hace este controlador

    + +

    El controlador de trips gestiona todo lo relacionado con la creación, +edición y eliminación de viajes. Trabaja con Devise para identificar cada +viaje con el usuario que lo creó y con visits, que componen un viaje. Tiene +un filtro para ejecutar las acciones sólo si antes se ha iniciado sesión. +Este filtro no afecta a las acciones index y show.

    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + create() + click to toggle source +
    + + +
    + +

    Método que crea el nuevo viaje. Rutas:

    +
    • +

      POST /trips

      +
    • +

      POST /trips.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 57
    +def create
    +  @trip = current_user.trips.build(params[:trip])
    +
    +  respond_to do |format|
    +    if @trip.save
    +      format.html { redirect_to @trip, notice: 'Trip was successfully created.' }
    +      format.json { render json: @trip, status: :created, location: @trip }
    +    else
    +      format.html { render action: "new" }
    +      format.json { render json: @trip.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    Método que permite eliminar un viaje. Rutas:

    +
    • +

      DELETE /trips/:id

      +
    • +

      DELETE /trips/:id.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 91
    +def destroy
    +  @trip = current_user.trips.find(params[:id])
    +  @trip.destroy
    +
    +  respond_to do |format|
    +    format.html { redirect_to trips_url }
    +    format.json { head :no_content }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    Método que permite editar el viaje seleccionado. Ruta:

    +
    • +

      GET /trips/:id/edit

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 50
    +def edit
    +  @trip = current_user.trips.find(params[:id])
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que muestra todos los viajes. Rutas:

    +
    • +

      GET /trips

      +
    • +

      GET /trips.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 14
    +def index
    +  @trips = Trip.all
    +
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @trips }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    Método que permite modificar un nuevo viaje. Rutas:

    +
    • +

      GET /trips/new

      +
    • +

      GET /trips/new.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 39
    +def new
    +  @trip = current_user.trips.build
    +
    +  respond_to do |format|
    +    format.html # new.html.erb
    +    format.json { render json: @trip }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + show() + click to toggle source +
    + + +
    + +

    Método que muestra el viaje seleccionado. Rutas:

    +
    • +

      GET /trips/:id

      +
    • +

      GET /trips/:id.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 26
    +def show
    +  @trip = Trip.find(params[:id])
    +  @visit = @trip.visits.build
    +
    +  respond_to do |format|
    +    format.html # show.html.erb
    +    format.json { render json: @trip }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + update() + click to toggle source +
    + + +
    + +

    Método que actualiza el viaje editado. Rutas:

    +
    • +

      PUT /trips/:id

      +
    • +

      PUT /trips/:id.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 74
    +def update
    +  @trip = current_user.trips.find(params[:id])
    +
    +  respond_to do |format|
    +    if @trip.update_attributes(params[:trip])
    +      format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }
    +      format.json { head :no_content }
    +    else
    +      format.html { render action: "edit" }
    +      format.json { render json: @trip.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + +
    + + + + diff --git a/doc/app/TripsHelper.html b/doc/app/TripsHelper.html new file mode 100644 index 0000000..12597fd --- /dev/null +++ b/doc/app/TripsHelper.html @@ -0,0 +1,157 @@ + + + + + + +module TripsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module TripsHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/Type.html b/doc/app/Type.html new file mode 100644 index 0000000..cefcd8c --- /dev/null +++ b/doc/app/Type.html @@ -0,0 +1,172 @@ + + + + + + +class Type - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Type

    + +
    + +

    Qué define este modelo

    + +

    El modelo de types define los tipos o categorías en los que se puede +clasificar cada sitio. Un tipo agrupa a varios sitios que comparten unas +caracterícas determinadas (como por ejemplo estar en medio de la naturaleza +o ser un edificio histórico). Un tipo tiene que tener obligatoriamente un +nombre y una descripción, pero no pueden existir dos sitios con el mismo +nombre.

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/TypesController.html b/doc/app/TypesController.html new file mode 100644 index 0000000..70b9971 --- /dev/null +++ b/doc/app/TypesController.html @@ -0,0 +1,524 @@ + + + + + + +class TypesController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class TypesController

    + +
    + +

    Qué hace este controlador

    + +

    El controlador de tipos gestiona todo lo relacionado con la creación, +edición y eliminación de tipos. Cualquier usuario puede realizar acciones +sobre los tipos.

    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + create() + click to toggle source +
    + + +
    + +

    Método que crea el nuevo tipo. Rutas:

    +
    • +

      POST /types

      +
    • +

      POST /types.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 63
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    Método que permite eliminar un tipo. Rutas:

    +
    • +

      DELETE /types/:id

      +
    • +

      DELETE /types/:id.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 97
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    Método que permite editar el tipo seleccionado. Ruta:

    +
    • +

      GET /types/:id/edit

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 56
    +def edit
    +  @type = Type.find(params[:id])
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que muestra todos los tipos. Rutas:

    +
    • +

      GET /types

      +
    • +

      GET /types.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 9
    +def index
    +  @types = Type.all
    +
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @types }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    Método que permite modificar un nuevo tipo. Rutas:

    +
    • +

      GET /types/new

      +
    • +

      GET /types/new.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 45
    +def new
    +  @type = Type.new
    +
    +  respond_to do |format|
    +    format.html # new.html.erb
    +    format.json { render json: @type }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + ordered_index() + click to toggle source +
    + + +
    + +

    Este método define una acción que muestra todos los tipos por orden +alfabético. Rutas:

    +
    • +

      GET /types/ordered_index

      +
    • +

      GET /types/ordered_index.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 33
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + show() + click to toggle source +
    + + +
    + +

    Método que muestra el tipo seleccionado. Rutas:

    +
    • +

      GET /types/:id

      +
    • +

      GET /types/:id.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 21
    +def show
    +  @type = Type.find(params[:id])
    +
    +  respond_to do |format|
    +    format.html # show.html.erb
    +    format.json { render json: @type }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + update() + click to toggle source +
    + + +
    + +

    Método que actualiza el tipo editado. Rutas:

    +
    • +

      PUT /types/:id

      +
    • +

      PUT /types/:id.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 80
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + +
    + + + + diff --git a/doc/app/TypesHelper.html b/doc/app/TypesHelper.html new file mode 100644 index 0000000..3ea694b --- /dev/null +++ b/doc/app/TypesHelper.html @@ -0,0 +1,157 @@ + + + + + + +module TypesHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module TypesHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/User.html b/doc/app/User.html new file mode 100644 index 0000000..5ed07e6 --- /dev/null +++ b/doc/app/User.html @@ -0,0 +1,172 @@ + + + + + + +class User - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class User

    + +
    + +

    Qué define este modelo

    + +

    El modelo de users define los usuarios de esta página web. Cada persona +debe crearse un usario que le identifique dentro de la página web, +especificando un nombre, una contraseña para evitar accesos indeseados y la +suplantación de su identidad y un correo para recibir avisos y recuperar la +contraseña. Un usuario es dueño de todos los sitios, comentarios y viajes +que haya creado, y como tal sólo él podrá editarlos o borrarlos.

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/Visit.html b/doc/app/Visit.html new file mode 100644 index 0000000..faac23b --- /dev/null +++ b/doc/app/Visit.html @@ -0,0 +1,168 @@ + + + + + + +class Visit - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Visit

    + +
    + +

    Qué define este modelo

    + +

    El modelo de visits define las visitas que componen cada viaje, es decir, +los sitios que se desean visitar en dicho viaje.

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/VisitsController.html b/doc/app/VisitsController.html new file mode 100644 index 0000000..978bd52 --- /dev/null +++ b/doc/app/VisitsController.html @@ -0,0 +1,484 @@ + + + + + + +class VisitsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class VisitsController

    + +
    + +

    Qué hace este controlador

    + +

    El controlador de tipos gestiona todo lo relacionado con la creación, +edición y eliminación de tipos. Como las visitas se renderizan con los +viajes, se controla indirectamente qué usuario realiza estas acciones.

    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + create() + click to toggle source +
    + + +
    + +

    Método que crea la nueva visita. Rutas:

    +
    • +

      POST /visits

      +
    • +

      POST /visits.js

      +
    • +

      POST /visits.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 52
    +def create
    +  @visit = Visit.new(params[:visit])
    +
    +  respond_to do |format|
    +    if @visit.save
    +      format.html { redirect_to @visit.trip, notice: 'Visit was successfully created.' }
    +      format.js
    +      format.json { render json: @visit, status: :created, location: @visit }
    +    else
    +      format.html { render action: "new" }
    +      format.json { render json: @visit.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    Método que permite eliminar una visita. Rutas:

    +
    • +

      DELETE /visits/1

      +
    • +

      DELETE /visits/1.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 87
    +def destroy
    +  @visit = Visit.find(params[:id])
    +  @visit.destroy
    +
    +  respond_to do |format|
    +    format.html { redirect_to @visit.trip }
    +    format.json { head :no_content }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    Método que permite editar la visita seleccionada. Ruta:

    +
    • +

      GET /visits/1/edit

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 44
    +def edit
    +  @visit = Visit.find(params[:id])
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que muestra todos las visitas. Rutas:

    +
    • +

      GET /visits

      +
    • +

      GET /visits.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 9
    +def index
    +  @visits = Visit.all
    +
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @visits }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    Método que permite modificar una nueva visita. Rutas:

    +
    • +

      GET /visits/new

      +
    • +

      GET /visits/new.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 33
    +def new
    +  @visit = Visit.new
    +
    +  respond_to do |format|
    +    format.html # new.html.erb
    +    format.json { render json: @visit }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + show() + click to toggle source +
    + + +
    + +

    Método que muestra la visita seleccionada. Rutas:

    +
    • +

      GET /visits/1

      +
    • +

      GET /visits/1.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 21
    +def show
    +  @visit = Visit.find(params[:id])
    +
    +  respond_to do |format|
    +    format.html # show.html.erb
    +    format.json { render json: @visit }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + update() + click to toggle source +
    + + +
    + +

    Método que actualiza la visita editada. Rutas:

    +
    • +

      PUT /visits/1

      +
    • +

      PUT /visits/1.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 70
    +def update
    +  @visit = Visit.find(params[:id])
    +
    +  respond_to do |format|
    +    if @visit.update_attributes(params[:visit])
    +      format.html { redirect_to @visit.trip, notice: 'Visit was successfully updated.' }
    +      format.json { head :no_content }
    +    else
    +      format.html { render action: "edit" }
    +      format.json { render json: @visit.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + +
    + + + + diff --git a/doc/app/VisitsHelper.html b/doc/app/VisitsHelper.html new file mode 100644 index 0000000..83b4cf3 --- /dev/null +++ b/doc/app/VisitsHelper.html @@ -0,0 +1,157 @@ + + + + + + +module VisitsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module VisitsHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/created.rid b/doc/app/created.rid new file mode 100644 index 0000000..399944d --- /dev/null +++ b/doc/app/created.rid @@ -0,0 +1,22 @@ +Wed, 25 Apr 2012 15:19:33 +0200 +doc/README_FOR_APP Sat, 31 Mar 2012 14:34:22 +0200 +app/controllers/application_controller.rb Sat, 31 Mar 2012 14:34:22 +0200 +app/controllers/comments_controller.rb Wed, 25 Apr 2012 13:03:23 +0200 +app/controllers/planet_controller.rb Tue, 24 Apr 2012 18:27:26 +0200 +app/controllers/sites_controller.rb Tue, 24 Apr 2012 18:29:50 +0200 +app/controllers/trips_controller.rb Wed, 25 Apr 2012 13:49:49 +0200 +app/controllers/types_controller.rb Tue, 24 Apr 2012 18:32:24 +0200 +app/controllers/visits_controller.rb Tue, 24 Apr 2012 18:34:10 +0200 +app/helpers/application_helper.rb Sat, 31 Mar 2012 14:34:22 +0200 +app/helpers/comments_helper.rb Tue, 10 Apr 2012 19:11:02 +0200 +app/helpers/planet_helper.rb Sat, 31 Mar 2012 14:34:22 +0200 +app/helpers/sites_helper.rb Sat, 31 Mar 2012 14:34:22 +0200 +app/helpers/trips_helper.rb Tue, 17 Apr 2012 19:06:38 +0200 +app/helpers/types_helper.rb Sat, 31 Mar 2012 14:34:22 +0200 +app/helpers/visits_helper.rb Tue, 17 Apr 2012 19:29:36 +0200 +app/models/comment.rb Tue, 24 Apr 2012 18:14:16 +0200 +app/models/site.rb Wed, 25 Apr 2012 14:31:32 +0200 +app/models/trip.rb Sat, 21 Apr 2012 14:53:58 +0200 +app/models/type.rb Sat, 21 Apr 2012 14:56:32 +0200 +app/models/user.rb Sat, 21 Apr 2012 14:59:36 +0200 +app/models/visit.rb Sat, 21 Apr 2012 15:01:30 +0200 diff --git a/doc/app/doc/README_FOR_APP.html b/doc/app/doc/README_FOR_APP.html new file mode 100644 index 0000000..a6bb752 --- /dev/null +++ b/doc/app/doc/README_FOR_APP.html @@ -0,0 +1,123 @@ + + + + + + +README_FOR_APP - Rails Application Documentation + + + + + + + + + + + + + + + + +
    + +

    Use this README file to introduce your application and point to useful +places in the API for learning more. Run “rake doc:app” to generate API +documentation for your models, controllers, helpers, and libraries.

    + +
    + + + + + diff --git a/doc/app/images/add.png b/doc/app/images/add.png new file mode 100644 index 0000000000000000000000000000000000000000..6332fefea4be19eeadf211b0b202b272e8564898 GIT binary patch literal 733 zcmV<30wVp1P)9VHk(~TedF+gQSL8D5xnVSSWAVY>J9b+m>@{iq7_KE}go~11+5s4;8hc+i0Xa zI1j@EX5!S+Me6HNqKzU5YQwL;-W5$p%ZMKMeR<%zp69-~?<4?8|C8S?bklXr4v&Ov zb&06v2|-x?qB`90yn>Qi%Sh2^G4n)$ZdyvTPf9}1)_buUT7>`e2G&2VU@~Bb(o+Mz zi4)>IxlSY${Dj4k={-9RzU^W5g9|2V5RZ2ZulL9s2xQbZ@r6eP9Ra5u(s|C0Nj#&4>wTSkb?%#=9?@ z^oxDy-O@tyN{L@by(WWvQ3%CyEu8x{+#Jb4-h&K9Owi)2pgg+heWDyked|3R$$kL@A z#sp1v-r+=G4B8D6DqsDH0@7OztA7aT9qc1Py{()w`m``?Y0&gi2=ROcc-9+nU^I6< zT=e_Y=vSnG@?3Ue{BW5ONFttcE!R-R_W4O01|0-|K-YNXLo2`4Qv z`r1LxR6#yf3FB%T95gJnaKKivA~Z}S9A(ZxEDK}O3T04USJ P00000NkvXXu0mjf^IS-S literal 0 HcmV?d00001 diff --git a/doc/app/images/brick.png b/doc/app/images/brick.png new file mode 100644 index 0000000000000000000000000000000000000000..7851cf34c946e5667221e3478668503eb1cd733f GIT binary patch literal 452 zcmV;#0XzPQP)Pdwe5?6tW?r-ok|b$oDQj8FV%kZPq;(MWOV8?8;<)(iP}>hNMU> z7fbz%jjlr7h8uuoQ~J6}n}@Y@PdTk=)PxO{%7zmL?dchpZX*~n;I{!C>*(8cU;q(~ zAS%Po_@naEU!xidrBXD?;hN|x^%W|Ij)0y*r5vi|?W&Fub(NqJ@z0o=O&SR3v>A``^efOSo-hEdApp;^Jd;9y!%1UfzX6Bh- z%-mbG|0Na{7Ruai_Y+DEb1s+b!*9k%Q!whMxjtZKA*?o;i1g&jy0@( zaU=-@d-h+o%gal6JRXEXA&L3`d2 z%jIxzZ~*p9O-;EJp_Ds0If38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#tber5 z%S_ceqB`b3ko6r~BbvDwdohTvP(3a(pq{x#T$yQsu#OKwEe}KuH^Mh@nxg_(Nw136 zq#a^3xNBke)In+!?qk3%4wB69{pF`Tzg`07*qoM6N<$ Eg55P&8UO$Q literal 0 HcmV?d00001 diff --git a/doc/app/images/bullet_black.png b/doc/app/images/bullet_black.png new file mode 100644 index 0000000000000000000000000000000000000000..57619706d10d9736b1849a83f2c5694fbe09c53b GIT binary patch literal 211 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$h^>lFz(Kw&{<9vg>5sw~gS5O!4 zr|{HuUFIBKiQyL}eBJ-L{`UVT|6_O~L{G%N{Wbre{kQtZ_0LvEhC#5QQ<|d}62BjvZR2H60wE-$h^mK6y(Kw&{<9vg>(S^W+6Zii9 z|Nhthr~iNb*Z!}6uiN$Dz5neG3a-`baBX8yz1H+_;eX)`ni0%X8XBDc-`=Ph(Uan2 zYsR{H!kvIN--9isvHznRsC#5QQ<|d}62BjvZR2H60wE-$h_H=O!(Kw&{<9vg>(S^W+6Zii9 z|Nhthr~iNb*Z!}6uiN$Dz5neG3a-`baBX8yz4q@v|B?28{s)#N@CGn3@%_y|zAV9T z66e<&B4?b6oF&azg|C(V&1ZbI_D}pL`}(^FT2yXwG1Ph~$Q@h8mJYOz!PC{xWt~$( F699+YQR)By literal 0 HcmV?d00001 diff --git a/doc/app/images/date.png b/doc/app/images/date.png new file mode 100644 index 0000000000000000000000000000000000000000..783c83357fdf90a1c7c024358e1d768b5c09c135 GIT binary patch literal 626 zcmV-&0*(ENP)5OC%H;f`~O(q$Q#t2<^v$A>fbmv%e#dKTwK=Ku{5lS|}<-`a#7b zzTCOnnT>at)D}AMFuOZ5&%EqFN(lyumd$2ASF6=;nM~%2?gqc@U=#|4PqkX@EBo-9 z7pD#bO_RUa>*faM`8;MYfVi$JnB-zcBFc6gjl$d!bF98Q!!!(Z1_R~P?e!pt#6CHJ9S&n_n&@=9 z%GP;!@Co4c*at+6vNz7o(6en^Q1%qHrc;1)9IRaz-$@S$Z-qdC^ds3X0NvQH;KS)D z-dh&rW&@X;1cS(45z)J&BVt+tv&GMVJ%!EiW) zLBGZW)#Z+gl-Lih&?>X3SS-S#ujQ;9JRXmIB7X)8`d6ETj)D#Q2+$s|<_b7-B9Xvq zwNfqlEp%y3$uY`h{Y$(Gn5@}sqEsq95lpAkFO5dyBmP6^H-51G4J|rN2Ujt<`2YX_ M07*qoM6N<$fC4}Mrzlg<+1Y8PEBfUp0jJpx4B>@E+cy3`^(Gw`Mf+2&yxZm<$to~Vpgvg&QKNR z_f#1(r6svZt%iF?s+n<8X?B&!h3g9Dbb8_=MX}!;HiQSAh`bp^WMl~Z-44teO7W_Y zV4thSL{h;rJY7!l3%5J4H1!tIzB`Dv+YxO(haWeausGZYkI8^hWj6mzo=L0{%;yxzh{5!Htr?51 zvG|W62MzC8BZ76hRpCyO2zOn<%e)K>NHge!-~)Ap33OdWw6hsLYbCxGNt0%wk_2z7 zfyYvXheSG)5HRK1VB~%mq7Dmurw#bi@hEcOr3&G1ZiF*$M=&9nB#VNf&Q^r$4G5kp zTURh&s)E0%5&hyVD}sp<72~zmAY`Y(9aqO6CXF%=zFHGzO-A&I(pE}v70YQxCPJ{Y z4L+?5-crdLn3ZRPEs!A4ehEY3ZRpL~w9>@aMN+{F4dI@v&>(QDHQum!mG~E^$OS8l z!7?%Uwib*ROP67Hw`ika)gX-(8Ia`-u_IEhxG7U<13kSsMW+$lbb2dUMm5p6pa}cjgA+U$^mJ^AjD?&bdi)8~y+Q002ovPDHLkV1g8IMc@Dc literal 0 HcmV?d00001 diff --git a/doc/app/images/find.png b/doc/app/images/find.png new file mode 100644 index 0000000000000000000000000000000000000000..1547479646722bda4647df52cf3e8bc9b77428c6 GIT binary patch literal 659 zcmV;E0&M+>P)IO9T&v~?D!=C@G6X*U1@h2}>2WE%HrrsjT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c{b*k>-L!PvY`#5^i1^XCnxh zky})0T&rp6 zJFwUVv-;Dzt2_z1)}rtpHBQH#<-`N0%%UP1TF^VNx2@~Zh_4nbMMxj7zeHTrB&q)a Dl)1NK literal 0 HcmV?d00001 diff --git a/doc/app/images/macFFBgHack.png b/doc/app/images/macFFBgHack.png new file mode 100644 index 0000000000000000000000000000000000000000..c6473b324ee1dae1faaacc0826639833f551116c GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1|*NXY)uAIEX7WqAsj$Z!;#Vf4nJ za0`Jjl>Qs8<JF;+Fd5q0wCR k?u=~bH}2*0f`J3~k>FVdQ&MBb@0BAfpf&c&j literal 0 HcmV?d00001 diff --git a/doc/app/images/package.png b/doc/app/images/package.png new file mode 100644 index 0000000000000000000000000000000000000000..da3c2a2d74bab159ba0f65d7db601768258afcb2 GIT binary patch literal 853 zcmV-b1FHOqP)5TQ^(M5v$(QKVE?W+9X! z*o}&~6c?_FreF)9NJB7b5Nbn{G0n4+%uJhR9(V5R|NFTpb|HgjefT!tIhLx@DR+N) zV+fHiR5Yt19}k|KnCsND{tH-`IMJ)3AE?OtyZ4>Un|6(d%h#JK`i&a7^xW9>`yBy` zS4SOHeOpC7$?hH5-#7Rswiue_8Ju*2N@$58=a#2OTA3png`w3v->gWif7t%e$ z$NLVS!tFT#8WL|Wa&K~+{%4P2cRfwesYV1_!F=3OaRVHl(>=`%&{x*s30c}#CNE@&;ItrAv!f!)Oy$Q9t$uS=(sD$-J{T*^(8Eez1E-l3}} zPrfHZ1`qsIFe&gipuL8-IZbo2Yg{lFGKs?ZZWcOaOdk*3`5T;$?AjbG1#`B510Er^h2)2r3Y{!8_2Gj=$KzuN5 zaErtW8W_Y2iJJjY)5pmTVJoPJYpanPOEuYHclM^C1F>${hFRpdi8a<2H|Xudf78bm(zwJ9`K%6I?q*Ua~ fW9JvIbn5*B+_J)rUMBs>00000NkvXXu0mjfH&TkY literal 0 HcmV?d00001 diff --git a/doc/app/images/page_green.png b/doc/app/images/page_green.png new file mode 100644 index 0000000000000000000000000000000000000000..de8e003f9fb8752c09e7f3655d5d8664b5c62fc3 GIT binary patch literal 621 zcmV-z0+RiSP)QqUjAtB;_Vvt6}AS_5YgM`Uqu`yva+H8^=4U$e4gHb}u zAQ2N{V3A%pO|?Pv?tb6z=jC}SiRa$G^v3q?*6XcYz$p|cq{uLj@#~Fi`J(>5{@&&N zy%T^+;>8cXx%|o77anP?&W1?1A(>-T49z9pyeCl@7YI+Si zKti7=B~``}TImz(G{0PnlQA3P#MAd}sorMjkP!50B7$nAkU^%#nl{Q9lW0@}9fE-> zN(q7tRuiC_T1r|BBtVBTlQ2+70$Rf;eF`Z;lx46Cpu-rEgb)EBKq(b^W8l<^We(`D z43?0=01z<3G6+UUv6`CsWCk6^93!#+<;ws7007{zS3k2k9-zZKFO~(k`>s0y006+1 zgF_jyIhsL-`FMf~JL~C=cV75(CrJ|q;MVO961G=O zm9d)YpJg5g(4i_HKL75eSE}mq$Y}r}hyVdcV~p>6a}oXr80q`oj%+s700000NkvXX Hu0mjfPs|!l literal 0 HcmV?d00001 diff --git a/doc/app/images/page_white_text.png b/doc/app/images/page_white_text.png new file mode 100644 index 0000000000000000000000000000000000000000..813f712f726c935f9adf8d2f2dd0d7683791ef11 GIT binary patch literal 342 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-%6;pyTSA|c6o&@eC9QG)Hj&ExYL zO&oVL^)+cM^qd@ApywS>pwx0H@RDN}hq;7mU-SKczYQ-hnrr=;iDAQMZQ+*g=YOM= z!QlMQEn7FbaD->uKAYgo_j9)W&$$zS*W9}m(ey0q$&7l-XEWO0Y(9M=SnhLbwy;d>@~SY$Ku*0xPvIOQeV1x7u_z-2-X>_74(yfh7C znXL|3GZ+d2`3re2hs?MKC#5QQ<|d}62BjvZR2H60wE-$R?&;zfqH(@;q9b3Efq-lM(nr^( z=EYR73-9e)UYMWsXy%?aZsD68Yyv^2$~6QgEcljw%kx>O(f-gQ?@fOOx3A-0+Qw?O zRx~W)kn~Qe2d6f9nMG#g9Q04Mk==M~N!Dglvxk!fgVh#w@ZV$IY1+Xc`d{d2UcaP~ zfWp)_Ivqj}l2SPy^9ZWy6rG9Yx4v67_uA&&9|XA~5-#3)W3%em1peD8RWH^#O%XoM zxMPud%}GTj#~*+7JMxTd!`{^Q+>(D3*|@KV`*G2;{QnANOxu1$r2xIe;OXk;vd$@? F2>@zac~<}c literal 0 HcmV?d00001 diff --git a/doc/app/images/plugin.png b/doc/app/images/plugin.png new file mode 100644 index 0000000000000000000000000000000000000000..6187b15aec001b7080b51a5f944f07591f26cc15 GIT binary patch literal 591 zcmV-V0eEcNHZMNv|IbJ-M`( zKwWL~opzjJe^WpCmV9E;(0&ut2;4va_(#>M8)>9$R5viQnf(Nkh~VM$y>J(jqb$cj z+nL1Nm|mV)Gm|9MnHf*7Ja4OEAQz__^LRKOLEwqpiGV^^A*T=#&inGm-62Xs;dnSp zKj&H9T*boh2i)W+(n27l!C)>fq|L%VB1i ziC4p;NwV_}ZjW7$LRW#(_bKF#hp=!IqNO26Z*w2+LEwx{PVnZ&Sn}T;mtzb$;qA*nT@@+ zV5uQ@iXDTPoTbV#FRr~z04|PPh`wXTNoCm9*tG&?e3+fYl>K6+&3|Cc$KOpL`ER+_ dcRl5U#9zn6ZO}GFk7R5;7c zlif>`Q5?tj7Yw@ZCMtTF^Q|ZedeJhM%QPCR*bs8V79p$QTo7e94yQNXRs-{0?hOn_-8n0AMO@u1Ts zNl8QzJs1#rz%RBt?ux>l+amAvh+J!{$lkaqv}+Erb-6j2xp>K4GLQnNB*W`hFg*?P z^AL@~(h~Z+wfcWEXHqV^Tq-#z$7Y#o0;yFxA!00F}F2dX# zjE$iOgT#G4*1TR6kB1Gnn@>$meCh2a>c5YuIvFn-R2W@>4@M*m@-|jiDV?b)bccgA zyPfsMM!rjy>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1q7g&LUSuLE3XS}K#P^nHVUmL`L)dbP| z0bt(+Cp#M-bH!LM*DzJ0Lfn;eTBV@|JvGSgpdoc1RhhV>(G-2(vE|>MrVgA9+?+0m4OzUqbT>-U-jg|v zLZMntq`r?fy1UCMh>z2Koi1SL-~N2ZrIf+dZW|;SWszsde}Dl!HOMc1Fa>K9)e&RI z)A?aK zcviCdKDUg_%#u7YAE`A`Y3$(P4&m^@fEWAvjAwVmRWeUnmkrxA;E!fKoc{9Vi=lvFL}KmoS;g* zdjL?Y!VHUFq63aLj6VZE+tHts?Z1pFkiO9^k*5pGpFpU&5#5G4ATd{t>a&9zKBVB9=Ns^HFU|DTGH8C+Xr2UqOU`Zxe)!|%j4=-QojGePq)pRGe;!f)Czk!u3vP_Jxu8(e6 zf4Q`F$Qio2Jw@N*E@k?c`+Sw}AYQjkT+x)OAe6eq(AT!iRuksKQn%Ao_Ac1T-p#Js I_CnHs0qX}mlmGw# literal 0 HcmV?d00001 diff --git a/doc/app/images/tag_green.png b/doc/app/images/tag_green.png new file mode 100644 index 0000000000000000000000000000000000000000..83ec984bd73364134da0f98d27a800c5d3264180 GIT binary patch literal 613 zcmV-r0-F7aP)^5T)AZ%#@G{_P{NCN^P z(J0zvSn~SSm(Ur);-M~8^*;61*VRI`T1BN&LAhK;sZ>I-SVW;vfUfJv=ko^ugnc0x zhJodBxe>iyk3%w<%wC8holUJ4(iv>tL{`DQt zPOsyUbO_Cmc&*iHkqbm3ku`|GcC^OhF>jj9W*GkH;^g!iUVpib_h*=@udp4h(P+e*zL_~ZmJjh(y^BxULwq>9zXoYE8sq{#pN~U0C6!8vY)5N2 z9P*}mw}7X$O^qTtJef1ACWvJT9^wt-)Zh0r~j#0bT`f;-zv6 z^Tmw22!%rMcs!TaUX<-8s;X-B`+Xbo+_uWuFa z1yIPc?DTrQ7KvRhmt*TG|L=EYQ=LqFX;=Lp`4}jx6BE-@00000NkvXXu0mjf=s_29 literal 0 HcmV?d00001 diff --git a/doc/app/images/transparent.png b/doc/app/images/transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..d665e179efd797451084235f105425247fea0a14 GIT binary patch literal 97 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;bAV5X>;M1%mmiTn0pv241o;Is pI6S+N2ITN~x;Tb#$R;N!@B(=T42&&nK2`x)44$rjF6*2UngG277DE64 literal 0 HcmV?d00001 diff --git a/doc/app/images/wrench.png b/doc/app/images/wrench.png new file mode 100644 index 0000000000000000000000000000000000000000..5c8213fef5ab969f03189d4367e32e597e38bd7f GIT binary patch literal 610 zcmV-o0-gPdP)^jb z4`0v}DG1te)wmeb(>p90leRz?_mO+^JKy=v&2<29Od6?F%9%(c8los#f*@G`-%W&* z$)uBj2i@u-@SgX}gtyWPe6d*|w6h%R? zScK2#Yn%$sum0cy>90DmY*i{1XqpClEtktsRTZ)lCUe z<FogV^*tm>8*AlX za4oiR!&85LrobG57qUHUX#{>Vz(RHpB5|@>9O6N$jqB8>%($0wxE5R3)b>Y~xtCo$ zCgEk&A?_#IxHdN)9tqre^o{ho4{?hmPuf@^@I3-wncaRd%|~O3xbrKY=&TiwPYkJroM{;WUQTuMY8vpg}f4o)2%U3C;eEDoiEh?94d(rV57VIF#8VqzW$HrDC|#U`x@QDbgi zVl)t9GGz&YY#D?gc%>hISA+_EBpnXt#pnC`p6@xw0$8TCbULjhlgVx(kuc)%xbgqq zR5+DNDFRN0!y)7Gm}oT0i39}h4h928qY?Rho^UvPGJ#kuW|-Amtrn`Pmd&+bFo@sp z$LI4IQw7BG?|#2ewOS<<3VjL$0=lMY^m;wqZujv5kx1l%Sl;V&Iy4#$ip3&@LV2!7vhhN=PCz%^9v24`qb(+m4W?!q-&~=?ssf5GfnAmJKV;3bvpDm0(NhahZ=&^sqo6Odj6>)Dq_3p~4~ zvb`d3Mydwjt&Df^hVmLtI2x=U&h9(JVYX-!y~z3zi;1>=LY;o(bL$(Yf$lf)dMf0-u^0HrpTG Wk@)HE*94aU0000m+BBgry{~j2fHLegbHP( zrgXNbr0}2;^nywdjLjZe?uxtrd3D(pZH@fFFc0{BW_~jxoO1w7-VX;6vK@ROA$$R6 zEmo;Ht-Mj|>5jUy{bQ^V5@53LRI8AgLpUm|m+15sqcz@QtVSo|oz7ArM8?pIn+>gN z0b=4_b5O|4A*;Q+vc9Vqr~%3V155*NV~@gTz}KSUiKB-uJzjMZ>5%Q#n24H!V{ zTY(LLAE*NAHZ}C#wnj%Bw5OFIkRhkkAW#kDC3j9Wm0YXRaXlyyp>#mVfYG)eC;@ab zDb=T-BCAY4LI(Z@GOTr2V_A{pRwSmz+8Be>CjAw(=gnbVWAeguvZa93JmL(EDxv1m z0OP4q=fpAK1Mq!C2`OkEn37o;m#wF#(t(8Pu#S?2f#x<~4EO{@fmm`p9veD6RZ_jp z@Au4};q&`XuKEYgIiB4((kgxOs#YdqJw0fY>9^K_agEu5+$#k;w#%I2N>n_?)YIqu z`tq&#_^p?-%K*U0^}|7+9U(&k0?s;=r=uCZ%)H9_edH8wK}gB(nUB1FFk+2Ol%BXV zHoFY`D~2x|2 + + + + + +Documentacion de Planet + + + + + + + + + + + + + + + + +

    Esta es la documentación generada para Planet. + + +

    + diff --git a/doc/app/index.html~ b/doc/app/index.html~ new file mode 100644 index 0000000..d1b7d1a --- /dev/null +++ b/doc/app/index.html~ @@ -0,0 +1,116 @@ + + + + + + +Documentacion de Planet + + + + + + + + + + + + + + + + +

    This is the API documentation for Rails Application Documentation. + + +

    + diff --git a/doc/app/js/darkfish.js b/doc/app/js/darkfish.js new file mode 100644 index 0000000..4be722f --- /dev/null +++ b/doc/app/js/darkfish.js @@ -0,0 +1,153 @@ +/** + * + * Darkfish Page Functions + * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $ + * + * Author: Michael Granger + * + */ + +/* Provide console simulation for firebug-less environments */ +if (!("console" in window) || !("firebug" in console)) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", + "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; + + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +}; + + +/** + * Unwrap the first element that matches the given @expr@ from the targets and return them. + */ +$.fn.unwrap = function( expr ) { + return this.each( function() { + $(this).parents( expr ).eq( 0 ).after( this ).remove(); + }); +}; + + +function showSource( e ) { + var target = e.target; + var codeSections = $(target). + parents('.method-detail'). + find('.method-source-code'); + + $(target). + parents('.method-detail'). + find('.method-source-code'). + slideToggle(); +}; + +function hookSourceViews() { + $('.method-heading').click( showSource ); +}; + +function toggleDebuggingSection() { + $('.debugging-section').slideToggle(); +}; + +function hookDebuggingToggle() { + $('#debugging-toggle img').click( toggleDebuggingSection ); +}; + +function hookTableOfContentsToggle() { + $('.indexpage li .toc-toggle').each( function() { + $(this).click( function() { + $(this).toggleClass('open'); + }); + + var section = $(this).next(); + + $(this).click( function() { + section.slideToggle(); + }); + }); +} + +function hookSearch() { + var input = $('#search-field').eq(0); + var result = $('#search-results').eq(0); + $(result).show(); + + var search_section = $('#search-section').get(0); + $(search_section).show(); + + var search = new Search(search_data, input, result); + + search.renderItem = function(result) { + var li = document.createElement('li'); + var html = ''; + + // TODO add relative path to + + + + + + + + + + +

    Table of Contents - Rails Application Documentation

    + +

    Pages

    + + +

    Classes/Modules

    + + +

    Methods

    + + + + + diff --git a/public/doc/README_FOR_APP b/public/doc/README_FOR_APP new file mode 100644 index 0000000..ab562a4 --- /dev/null +++ b/public/doc/README_FOR_APP @@ -0,0 +1,2 @@ +Use this README file to introduce your application and point to useful places in the API for learning more. +Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/public/doc/app/ApplicationController.html b/public/doc/app/ApplicationController.html new file mode 100644 index 0000000..fd3724e --- /dev/null +++ b/public/doc/app/ApplicationController.html @@ -0,0 +1,163 @@ + + + + + + +class ApplicationController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class ApplicationController

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/ApplicationHelper.html b/public/doc/app/ApplicationHelper.html new file mode 100644 index 0000000..2592c04 --- /dev/null +++ b/public/doc/app/ApplicationHelper.html @@ -0,0 +1,157 @@ + + + + + + +module ApplicationHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module ApplicationHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/Comment.html b/public/doc/app/Comment.html new file mode 100644 index 0000000..ebe03b1 --- /dev/null +++ b/public/doc/app/Comment.html @@ -0,0 +1,170 @@ + + + + + + +class Comment - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Comment

    + +
    + +

    Qué define este modelo

    + +

    El modelo de comments define los comentarios que los usuarios hagan sobre +los sitios. Cada comentario pertenece a un usuario y a un sitio +determinado. Por defecto se ha establecido un máximo de 240 caracteres para +cada comentario.

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/CommentsController.html b/public/doc/app/CommentsController.html new file mode 100644 index 0000000..d35dc81 --- /dev/null +++ b/public/doc/app/CommentsController.html @@ -0,0 +1,494 @@ + + + + + + +class CommentsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class CommentsController

    + +
    + +

    Qué hace este controlador

    + +

    El controlador de comments gestiona todo lo relacionado con la creación, +edición y eliminación de comentarios. Trabaja con Devise para identificar +cada comentario con el usuario que lo creó. Tiene un filtro para ejecutar +las acciones sólo si se ha iniciado sesión. Este filtro no afecta a las +acciones index y show.

    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + create() + click to toggle source +
    + + +
    + +

    Método que crea el nuevo comentario. Rutas:

    +
    • +

      POST /comments

      +
    • +

      POST /comments.js

      +
    • +

      POST /comments.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 62
    +def create
    +  @comment = current_user.comments.build(params[:comment])
    +  @site = @comment.site
    +
    +  respond_to do |format|
    +    if @comment.save
    +      format.html { redirect_to site_path(@site), notice: 'Comment was successfully created.' }
    +      format.js
    +      format.json { render json: @comment, status: :created, location: @comment }
    +    else
    +      format.html { render action: "new" }
    +      format.json { render json: @comment.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    Método que permite eliminar un comentario. Rutas:

    +
    • +

      DELETE /comments/:id

      +
    • +

      DELETE /comments/:id.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 99
    +def destroy
    +  @comment = current_user.comments.find(params[:id])
    +  site = @comment.site
    +  @comment.destroy
    +
    +  respond_to do |format|
    +    format.html { redirect_to site_path(site) }
    +    format.json { head :no_content }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    Método que permite editar el comentario seleccionado. Ruta:

    +
    • +

      GET /comments/:id/edit

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 53
    +def edit
    +  @comment = current_user.comments.find(params[:id])
    +  @site = @comment.site
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que muestra los comentarios asociados al sitio seleccionado. Rutas:

    +
    • +

      GET /sites/:site_id/comments

      +
    • +

      GET /sites/:site_id/comments.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 15
    +def index
    +  @site = Site.find(params[:site_id])
    +  @comments = @site.comments
    +  @comment = current_user.comments.build if current_user
    +
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @comments }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    Método que permite modificar un nuevo comentario asociado a un sitio. +Rutas:

    +
    • +

      GET /sites/:site_id/comments/new

      +
    • +

      GET /sites/:site_id/comments/new.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 41
    +def new
    +  @comment = current_user.comments.build
    +  @site = Site.find(params[:site_id])
    +
    +  respond_to do |format|
    +    format.html # new.html.erb
    +    format.json { render json: @comment }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + show() + click to toggle source +
    + + +
    + +

    Método que muestra el comentario seleccionado. Rutas:

    +
    • +

      GET /comments/:comment_id

      +
    • +

      GET /comments/:comment_id.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 29
    +def show
    +  @comment = Comment.find(params[:id])
    +
    +  respond_to do |format|
    +    format.html # show.html.erb
    +    format.json { render json: @comment }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + update() + click to toggle source +
    + + +
    + +

    Método que actualiza el comentario editado. Rutas:

    +
    • +

      PUT /comments/:id

      +
    • +

      PUT /comments/:id.json

      +
    + + + +
    +
    # File app/controllers/comments_controller.rb, line 81
    +def update
    +  @comment = current_user.comments.find(params[:id])
    +  @site = @comment.site
    +
    +  respond_to do |format|
    +    if @comment.update_attributes(params[:comment])
    +      format.html { redirect_to site_path(@site), notice: 'Comment was successfully updated.' }
    +      format.json { head :no_content }
    +    else
    +      format.html { render action: "edit" }
    +      format.json { render json: @comment.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + +
    + + + + diff --git a/public/doc/app/CommentsHelper.html b/public/doc/app/CommentsHelper.html new file mode 100644 index 0000000..bfebd8f --- /dev/null +++ b/public/doc/app/CommentsHelper.html @@ -0,0 +1,157 @@ + + + + + + +module CommentsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module CommentsHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/PlanetController.html b/public/doc/app/PlanetController.html new file mode 100644 index 0000000..c3d8e96 --- /dev/null +++ b/public/doc/app/PlanetController.html @@ -0,0 +1,399 @@ + + + + + + +class PlanetController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class PlanetController

    + +
    + +

    PlanetController ilustra el uso de +RDoc. La documentación de un proyecto en genera en el +directorio proy/doc en formato Web con

    + +
    $proy> rake doc:app
    + +

    Algunos comandos de formateo

    + +

    Tal y como muestra el subitulo anterior, este se define empezando la línea +con ==. En los títulos debe empezar por =.

    + +

    Un [ … ] seguido de texto define una lista titulada, como aquí

    +
    Clases, Módulos o Métodos +
    +

    Se documentan con comentarios justo encima de sus definición, como aquí.

    +
    + +

    Un * o - definen las entradas de una lista itemizada

    + + +

    Un número o letra seguido de punto genera una lista númerada

    +
    1. +

      + permite generar negrita, igual que con +HTML

      +
    2. +

      _ permite generar cursiva, igual que con HTML

      +
      • +

        permite generar letra de teletipo, igual que con +HTML

        +
      +
    + +

    Qué hace este controlador

    + +

    El controlador de planet es en gran parte un controlador de prueba con +acciones vacías. Sólo hay un método con una acción completa, search. Esta +acción busca los sitios o viajes que tengan en su nombre o en su +descripción la cadena de texto introducida.

    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + author() + click to toggle source +
    + + +
    + +

    Método que define una acción vacía del controlador. Ruta:

    +
    • +

      GET /planet/author

      +
    + + + +
    +
    # File app/controllers/planet_controller.rb, line 44
    +def author
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + contact() + click to toggle source +
    + + +
    + +

    Método que define una acción vacía del controlador. Ruta:

    +
    • +

      GET /planet/contact

      +
    + + + +
    +
    # File app/controllers/planet_controller.rb, line 34
    +def contact
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + ejemplo() + click to toggle source +
    + + +
    + +

    Método que define una acción vacía del controlador. Ruta:

    +
    • +

      GET /planet/ejemplo

      +
    + + + +
    +
    # File app/controllers/planet_controller.rb, line 39
    +def ejemplo
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que define una acción vacía del controlador. Ruta:

    +
    • +

      GET /planet/index

      +
    + + + +
    +
    # File app/controllers/planet_controller.rb, line 29
    +def index
    +end
    +
    + +
    + + + + +
    + + + + + +
    + +
    + +
    + + + + diff --git a/public/doc/app/PlanetHelper.html b/public/doc/app/PlanetHelper.html new file mode 100644 index 0000000..4f02ec7 --- /dev/null +++ b/public/doc/app/PlanetHelper.html @@ -0,0 +1,157 @@ + + + + + + +module PlanetHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module PlanetHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/Site.html b/public/doc/app/Site.html new file mode 100644 index 0000000..b55d708 --- /dev/null +++ b/public/doc/app/Site.html @@ -0,0 +1,173 @@ + + + + + + +class Site - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Site

    + +
    + +

    Qué define este modelo

    + +

    El modelo de site define un sitio, un emplazamiento en alguna parte del +mundo que se añade por su interés turístico, especificando su tipo. Un +sitio pertenece al usuario que lo ha creado y al tipo en el que se enmarca. +Sólo el usuario que lo ha creado podrá editarlo o borrarlo. Un sitio puede +ser parte de muchos viajes definido como una visita. Además puede tener +comentarios que añadan los usuarios y una imagen que lo identifique. +Obligatoriamente un sitio tiene que tener un nombre y un tipo.

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/SitesController.html b/public/doc/app/SitesController.html new file mode 100644 index 0000000..b17f3a8 --- /dev/null +++ b/public/doc/app/SitesController.html @@ -0,0 +1,494 @@ + + + + + + +class SitesController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class SitesController

    + +
    + +

    Qué hace este controlador

    + +

    El controlador de sites gestiona todo lo relacionado con la creación, +edición y eliminación de sitios. Trabaja con Devise para identificar cada +sitio con el usuario que lo creó. Tiene dos filtros:

    +
    • +

      Uno para ejecutar las acciones sólo si antes se ha iniciado sesión. Este +filtro no afecta a las acciones index y show.

      +
    • +

      Otro para ejecutar el método que define la acción count_visita después de +la carga de la página.

      +
    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + create() + click to toggle source +
    + + +
    + +

    Método que crea el nuevo sitio. Rutas:

    +
    • +

      POST /sites

      +
    • +

      POST /sites.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 63
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    Método que permite eliminar un sitio. Rutas:

    +
    • +

      DELETE /sites/:id

      +
    • +

      DELETE /sites/:id.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 97
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    Método que permite editar el sitio seleccionado. Ruta:

    +
    • +

      GET /sites/:id/edit

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 56
    +def edit
    +  @site = current_user.sites.find(params[:id])  # busca solo en sitios asociados a current_user
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Este método muestra todos los sitios si no se ha especificado un tipo o los +sitios de un tipo determinado. Rutas:

    +
    • +

      GET /sites

      +
    • +

      GET /sites.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 16
    +def index
    +  if params[:type_id].nil? or params[:type_id].empty?
    +    @sites = Site.all            # path: /sites
    +  else
    +    @sites = Type.find(params[:type_id]).sites  # path: /types/:type_id/sites
    +  end
    +  
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @sites }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    Método que permite modificar un nuevo sitio. Rutas:

    +
    • +

      GET /sites/new

      +
    • +

      GET /sites/new.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 45
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + show() + click to toggle source +
    + + +
    + +

    Método que muestra el sitio seleccionado. Rutas:

    +
    • +

      GET /sites/:id

      +
    • +

      GET /sites/:id.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 32
    +def show
    +  @site = Site.find(params[:id])
    +  @comment = current_user.comments.build if current_user
    +
    +  respond_to do |format|
    +    format.html # show.html.erb
    +    format.json { render json: @site }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + update() + click to toggle source +
    + + +
    + +

    Método que actualiza el sitio editado. Rutas:

    +
    • +

      PUT /sites/:id

      +
    • +

      PUT /sites/:id.json

      +
    + + + +
    +
    # File app/controllers/sites_controller.rb, line 80
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + +
    + + + + diff --git a/public/doc/app/SitesHelper.html b/public/doc/app/SitesHelper.html new file mode 100644 index 0000000..4e08fe9 --- /dev/null +++ b/public/doc/app/SitesHelper.html @@ -0,0 +1,157 @@ + + + + + + +module SitesHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module SitesHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/Trip.html b/public/doc/app/Trip.html new file mode 100644 index 0000000..f73b43d --- /dev/null +++ b/public/doc/app/Trip.html @@ -0,0 +1,169 @@ + + + + + + +class Trip - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Trip

    + +
    + +

    Qué define este modelo

    + +

    El modelo de trips define los viajes que se pueden hacer. Cada viaje +pertenece a un usuario determinado e incluye una serie de visitas (una +serie de sitios a los que se pretende ir a una hora determinada).

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/TripsController.html b/public/doc/app/TripsController.html new file mode 100644 index 0000000..07a83a7 --- /dev/null +++ b/public/doc/app/TripsController.html @@ -0,0 +1,484 @@ + + + + + + +class TripsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class TripsController

    + +
    + +

    Qué hace este controlador

    + +

    El controlador de trips gestiona todo lo relacionado con la creación, +edición y eliminación de viajes. Trabaja con Devise para identificar cada +viaje con el usuario que lo creó y con visits, que componen un viaje. Tiene +un filtro para ejecutar las acciones sólo si antes se ha iniciado sesión. +Este filtro no afecta a las acciones index y show.

    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + create() + click to toggle source +
    + + +
    + +

    Método que crea el nuevo viaje. Rutas:

    +
    • +

      POST /trips

      +
    • +

      POST /trips.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 57
    +def create
    +  @trip = current_user.trips.build(params[:trip])
    +
    +  respond_to do |format|
    +    if @trip.save
    +      format.html { redirect_to @trip, notice: 'Trip was successfully created.' }
    +      format.json { render json: @trip, status: :created, location: @trip }
    +    else
    +      format.html { render action: "new" }
    +      format.json { render json: @trip.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    Método que permite eliminar un viaje. Rutas:

    +
    • +

      DELETE /trips/:id

      +
    • +

      DELETE /trips/:id.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 91
    +def destroy
    +  @trip = current_user.trips.find(params[:id])
    +  @trip.destroy
    +
    +  respond_to do |format|
    +    format.html { redirect_to trips_url }
    +    format.json { head :no_content }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    Método que permite editar el viaje seleccionado. Ruta:

    +
    • +

      GET /trips/:id/edit

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 50
    +def edit
    +  @trip = current_user.trips.find(params[:id])
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que muestra todos los viajes. Rutas:

    +
    • +

      GET /trips

      +
    • +

      GET /trips.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 14
    +def index
    +  @trips = Trip.all
    +
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @trips }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    Método que permite modificar un nuevo viaje. Rutas:

    +
    • +

      GET /trips/new

      +
    • +

      GET /trips/new.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 39
    +def new
    +  @trip = current_user.trips.build
    +
    +  respond_to do |format|
    +    format.html # new.html.erb
    +    format.json { render json: @trip }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + show() + click to toggle source +
    + + +
    + +

    Método que muestra el viaje seleccionado. Rutas:

    +
    • +

      GET /trips/:id

      +
    • +

      GET /trips/:id.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 26
    +def show
    +  @trip = Trip.find(params[:id])
    +  @visit = @trip.visits.build
    +
    +  respond_to do |format|
    +    format.html # show.html.erb
    +    format.json { render json: @trip }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + update() + click to toggle source +
    + + +
    + +

    Método que actualiza el viaje editado. Rutas:

    +
    • +

      PUT /trips/:id

      +
    • +

      PUT /trips/:id.json

      +
    + + + +
    +
    # File app/controllers/trips_controller.rb, line 74
    +def update
    +  @trip = current_user.trips.find(params[:id])
    +
    +  respond_to do |format|
    +    if @trip.update_attributes(params[:trip])
    +      format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }
    +      format.json { head :no_content }
    +    else
    +      format.html { render action: "edit" }
    +      format.json { render json: @trip.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + +
    + + + + diff --git a/public/doc/app/TripsHelper.html b/public/doc/app/TripsHelper.html new file mode 100644 index 0000000..12597fd --- /dev/null +++ b/public/doc/app/TripsHelper.html @@ -0,0 +1,157 @@ + + + + + + +module TripsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module TripsHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/Type.html b/public/doc/app/Type.html new file mode 100644 index 0000000..cefcd8c --- /dev/null +++ b/public/doc/app/Type.html @@ -0,0 +1,172 @@ + + + + + + +class Type - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Type

    + +
    + +

    Qué define este modelo

    + +

    El modelo de types define los tipos o categorías en los que se puede +clasificar cada sitio. Un tipo agrupa a varios sitios que comparten unas +caracterícas determinadas (como por ejemplo estar en medio de la naturaleza +o ser un edificio histórico). Un tipo tiene que tener obligatoriamente un +nombre y una descripción, pero no pueden existir dos sitios con el mismo +nombre.

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/TypesController.html b/public/doc/app/TypesController.html new file mode 100644 index 0000000..70b9971 --- /dev/null +++ b/public/doc/app/TypesController.html @@ -0,0 +1,524 @@ + + + + + + +class TypesController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class TypesController

    + +
    + +

    Qué hace este controlador

    + +

    El controlador de tipos gestiona todo lo relacionado con la creación, +edición y eliminación de tipos. Cualquier usuario puede realizar acciones +sobre los tipos.

    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + create() + click to toggle source +
    + + +
    + +

    Método que crea el nuevo tipo. Rutas:

    +
    • +

      POST /types

      +
    • +

      POST /types.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 63
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    Método que permite eliminar un tipo. Rutas:

    +
    • +

      DELETE /types/:id

      +
    • +

      DELETE /types/:id.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 97
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    Método que permite editar el tipo seleccionado. Ruta:

    +
    • +

      GET /types/:id/edit

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 56
    +def edit
    +  @type = Type.find(params[:id])
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que muestra todos los tipos. Rutas:

    +
    • +

      GET /types

      +
    • +

      GET /types.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 9
    +def index
    +  @types = Type.all
    +
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @types }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    Método que permite modificar un nuevo tipo. Rutas:

    +
    • +

      GET /types/new

      +
    • +

      GET /types/new.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 45
    +def new
    +  @type = Type.new
    +
    +  respond_to do |format|
    +    format.html # new.html.erb
    +    format.json { render json: @type }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + ordered_index() + click to toggle source +
    + + +
    + +

    Este método define una acción que muestra todos los tipos por orden +alfabético. Rutas:

    +
    • +

      GET /types/ordered_index

      +
    • +

      GET /types/ordered_index.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 33
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + show() + click to toggle source +
    + + +
    + +

    Método que muestra el tipo seleccionado. Rutas:

    +
    • +

      GET /types/:id

      +
    • +

      GET /types/:id.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 21
    +def show
    +  @type = Type.find(params[:id])
    +
    +  respond_to do |format|
    +    format.html # show.html.erb
    +    format.json { render json: @type }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + update() + click to toggle source +
    + + +
    + +

    Método que actualiza el tipo editado. Rutas:

    +
    • +

      PUT /types/:id

      +
    • +

      PUT /types/:id.json

      +
    + + + +
    +
    # File app/controllers/types_controller.rb, line 80
    +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
    +
    + +
    + + + + +
    + + +
    + +
    + +
    + + + + diff --git a/public/doc/app/TypesHelper.html b/public/doc/app/TypesHelper.html new file mode 100644 index 0000000..3ea694b --- /dev/null +++ b/public/doc/app/TypesHelper.html @@ -0,0 +1,157 @@ + + + + + + +module TypesHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module TypesHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/User.html b/public/doc/app/User.html new file mode 100644 index 0000000..5ed07e6 --- /dev/null +++ b/public/doc/app/User.html @@ -0,0 +1,172 @@ + + + + + + +class User - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class User

    + +
    + +

    Qué define este modelo

    + +

    El modelo de users define los usuarios de esta página web. Cada persona +debe crearse un usario que le identifique dentro de la página web, +especificando un nombre, una contraseña para evitar accesos indeseados y la +suplantación de su identidad y un correo para recibir avisos y recuperar la +contraseña. Un usuario es dueño de todos los sitios, comentarios y viajes +que haya creado, y como tal sólo él podrá editarlos o borrarlos.

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/Visit.html b/public/doc/app/Visit.html new file mode 100644 index 0000000..faac23b --- /dev/null +++ b/public/doc/app/Visit.html @@ -0,0 +1,168 @@ + + + + + + +class Visit - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Visit

    + +
    + +

    Qué define este modelo

    + +

    El modelo de visits define las visitas que componen cada viaje, es decir, +los sitios que se desean visitar en dicho viaje.

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/VisitsController.html b/public/doc/app/VisitsController.html new file mode 100644 index 0000000..978bd52 --- /dev/null +++ b/public/doc/app/VisitsController.html @@ -0,0 +1,484 @@ + + + + + + +class VisitsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class VisitsController

    + +
    + +

    Qué hace este controlador

    + +

    El controlador de tipos gestiona todo lo relacionado con la creación, +edición y eliminación de tipos. Como las visitas se renderizan con los +viajes, se controla indirectamente qué usuario realiza estas acciones.

    + +
    + + + + +
    + + + + + + + + + + +
    +

    Public Instance Methods

    + + +
    + +
    + create() + click to toggle source +
    + + +
    + +

    Método que crea la nueva visita. Rutas:

    +
    • +

      POST /visits

      +
    • +

      POST /visits.js

      +
    • +

      POST /visits.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 52
    +def create
    +  @visit = Visit.new(params[:visit])
    +
    +  respond_to do |format|
    +    if @visit.save
    +      format.html { redirect_to @visit.trip, notice: 'Visit was successfully created.' }
    +      format.js
    +      format.json { render json: @visit, status: :created, location: @visit }
    +    else
    +      format.html { render action: "new" }
    +      format.json { render json: @visit.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    Método que permite eliminar una visita. Rutas:

    +
    • +

      DELETE /visits/1

      +
    • +

      DELETE /visits/1.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 87
    +def destroy
    +  @visit = Visit.find(params[:id])
    +  @visit.destroy
    +
    +  respond_to do |format|
    +    format.html { redirect_to @visit.trip }
    +    format.json { head :no_content }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    Método que permite editar la visita seleccionada. Ruta:

    +
    • +

      GET /visits/1/edit

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 44
    +def edit
    +  @visit = Visit.find(params[:id])
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que muestra todos las visitas. Rutas:

    +
    • +

      GET /visits

      +
    • +

      GET /visits.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 9
    +def index
    +  @visits = Visit.all
    +
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @visits }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    Método que permite modificar una nueva visita. Rutas:

    +
    • +

      GET /visits/new

      +
    • +

      GET /visits/new.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 33
    +def new
    +  @visit = Visit.new
    +
    +  respond_to do |format|
    +    format.html # new.html.erb
    +    format.json { render json: @visit }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + show() + click to toggle source +
    + + +
    + +

    Método que muestra la visita seleccionada. Rutas:

    +
    • +

      GET /visits/1

      +
    • +

      GET /visits/1.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 21
    +def show
    +  @visit = Visit.find(params[:id])
    +
    +  respond_to do |format|
    +    format.html # show.html.erb
    +    format.json { render json: @visit }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + update() + click to toggle source +
    + + +
    + +

    Método que actualiza la visita editada. Rutas:

    +
    • +

      PUT /visits/1

      +
    • +

      PUT /visits/1.json

      +
    + + + +
    +
    # File app/controllers/visits_controller.rb, line 70
    +def update
    +  @visit = Visit.find(params[:id])
    +
    +  respond_to do |format|
    +    if @visit.update_attributes(params[:visit])
    +      format.html { redirect_to @visit.trip, notice: 'Visit was successfully updated.' }
    +      format.json { head :no_content }
    +    else
    +      format.html { render action: "edit" }
    +      format.json { render json: @visit.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + +
    + + + + diff --git a/public/doc/app/VisitsHelper.html b/public/doc/app/VisitsHelper.html new file mode 100644 index 0000000..83b4cf3 --- /dev/null +++ b/public/doc/app/VisitsHelper.html @@ -0,0 +1,157 @@ + + + + + + +module VisitsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    module VisitsHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/public/doc/app/created.rid b/public/doc/app/created.rid new file mode 100644 index 0000000..399944d --- /dev/null +++ b/public/doc/app/created.rid @@ -0,0 +1,22 @@ +Wed, 25 Apr 2012 15:19:33 +0200 +doc/README_FOR_APP Sat, 31 Mar 2012 14:34:22 +0200 +app/controllers/application_controller.rb Sat, 31 Mar 2012 14:34:22 +0200 +app/controllers/comments_controller.rb Wed, 25 Apr 2012 13:03:23 +0200 +app/controllers/planet_controller.rb Tue, 24 Apr 2012 18:27:26 +0200 +app/controllers/sites_controller.rb Tue, 24 Apr 2012 18:29:50 +0200 +app/controllers/trips_controller.rb Wed, 25 Apr 2012 13:49:49 +0200 +app/controllers/types_controller.rb Tue, 24 Apr 2012 18:32:24 +0200 +app/controllers/visits_controller.rb Tue, 24 Apr 2012 18:34:10 +0200 +app/helpers/application_helper.rb Sat, 31 Mar 2012 14:34:22 +0200 +app/helpers/comments_helper.rb Tue, 10 Apr 2012 19:11:02 +0200 +app/helpers/planet_helper.rb Sat, 31 Mar 2012 14:34:22 +0200 +app/helpers/sites_helper.rb Sat, 31 Mar 2012 14:34:22 +0200 +app/helpers/trips_helper.rb Tue, 17 Apr 2012 19:06:38 +0200 +app/helpers/types_helper.rb Sat, 31 Mar 2012 14:34:22 +0200 +app/helpers/visits_helper.rb Tue, 17 Apr 2012 19:29:36 +0200 +app/models/comment.rb Tue, 24 Apr 2012 18:14:16 +0200 +app/models/site.rb Wed, 25 Apr 2012 14:31:32 +0200 +app/models/trip.rb Sat, 21 Apr 2012 14:53:58 +0200 +app/models/type.rb Sat, 21 Apr 2012 14:56:32 +0200 +app/models/user.rb Sat, 21 Apr 2012 14:59:36 +0200 +app/models/visit.rb Sat, 21 Apr 2012 15:01:30 +0200 diff --git a/public/doc/app/doc/README_FOR_APP.html b/public/doc/app/doc/README_FOR_APP.html new file mode 100644 index 0000000..a6bb752 --- /dev/null +++ b/public/doc/app/doc/README_FOR_APP.html @@ -0,0 +1,123 @@ + + + + + + +README_FOR_APP - Rails Application Documentation + + + + + + + + + + + + + + + + +
    + +

    Use this README file to introduce your application and point to useful +places in the API for learning more. Run “rake doc:app” to generate API +documentation for your models, controllers, helpers, and libraries.

    + +
    + + + + + diff --git a/public/doc/app/images/add.png b/public/doc/app/images/add.png new file mode 100644 index 0000000000000000000000000000000000000000..6332fefea4be19eeadf211b0b202b272e8564898 GIT binary patch literal 733 zcmV<30wVp1P)9VHk(~TedF+gQSL8D5xnVSSWAVY>J9b+m>@{iq7_KE}go~11+5s4;8hc+i0Xa zI1j@EX5!S+Me6HNqKzU5YQwL;-W5$p%ZMKMeR<%zp69-~?<4?8|C8S?bklXr4v&Ov zb&06v2|-x?qB`90yn>Qi%Sh2^G4n)$ZdyvTPf9}1)_buUT7>`e2G&2VU@~Bb(o+Mz zi4)>IxlSY${Dj4k={-9RzU^W5g9|2V5RZ2ZulL9s2xQbZ@r6eP9Ra5u(s|C0Nj#&4>wTSkb?%#=9?@ z^oxDy-O@tyN{L@by(WWvQ3%CyEu8x{+#Jb4-h&K9Owi)2pgg+heWDyked|3R$$kL@A z#sp1v-r+=G4B8D6DqsDH0@7OztA7aT9qc1Py{()w`m``?Y0&gi2=ROcc-9+nU^I6< zT=e_Y=vSnG@?3Ue{BW5ONFttcE!R-R_W4O01|0-|K-YNXLo2`4Qv z`r1LxR6#yf3FB%T95gJnaKKivA~Z}S9A(ZxEDK}O3T04USJ P00000NkvXXu0mjf^IS-S literal 0 HcmV?d00001 diff --git a/public/doc/app/images/brick.png b/public/doc/app/images/brick.png new file mode 100644 index 0000000000000000000000000000000000000000..7851cf34c946e5667221e3478668503eb1cd733f GIT binary patch literal 452 zcmV;#0XzPQP)Pdwe5?6tW?r-ok|b$oDQj8FV%kZPq;(MWOV8?8;<)(iP}>hNMU> z7fbz%jjlr7h8uuoQ~J6}n}@Y@PdTk=)PxO{%7zmL?dchpZX*~n;I{!C>*(8cU;q(~ zAS%Po_@naEU!xidrBXD?;hN|x^%W|Ij)0y*r5vi|?W&Fub(NqJ@z0o=O&SR3v>A``^efOSo-hEdApp;^Jd;9y!%1UfzX6Bh- z%-mbG|0Na{7Ruai_Y+DEb1s+b!*9k%Q!whMxjtZKA*?o;i1g&jy0@( zaU=-@d-h+o%gal6JRXEXA&L3`d2 z%jIxzZ~*p9O-;EJp_Ds0If38rM<5W8ic~K>FOK&2_p!CLg^i63OioVb6k$)zWHLx3 z5;!|M!}<9+#QSi1dRlbEcxPt^;cysUuU8@%3}RwpLRIGG<|IKnoyP6$Eh3SKw7a*r zSDXP=IYc&YZf;7@?fCe($^l9ORaJ3wbAx0uiC8QqRr$2t-Cfy8%XCI3B%pxJW>XdM zw~zPt_s}#A@pxQ5Ly)4szaMtH9lgE1SXx@b+S(fW`ub$fYPE8J7#bSNDzme*Ub07{ zQKV8SjEs!%0@v5ql8ggm!@$6Rbi^E8vBqpRM-}l+@5OSMrl+TWj*gC^qoV@>u{fQb zov5v?g~?>X@bEC&+uLPaQ&Ypn-y~^mZA}+f(&2EFH8eE%dU|@ENpN*_1-)L6_4Rc* zFuq@`IjX9vp1QiaK9ZojyZhnQURP99d=u;%37VRkpwsD4U0sd3x;hEQB&e^i|3QN0 z=H|Os1fRqaw!?#igLmS4HE!G3*ce(`TF} zlgUq0Q544c8(ae&UR$8ps&snq6^bPY3v3xAmMW74Di$h~GCH6E3TaYs2#6A<7K*gC z777H71_Wa;(dfp+g-drPCSWu)#PInZi72LJ;o?i~$-U=y&UbQ89Dul3%3P+Axkzc* zbH-y;QF=hR{qLItf%ci2_&e5wNo0gnVatG?ul6Zw=o$I9Ljfn*ic3`U?>IfEim3g{ zujU&$-hy6wn;w(xme|zJm;lWJxtTFfM)q0`kX!Vu0+d${$}LCddK1<^htTe-fUYL3 zB`SdNsZD>RgvLj1<^@h6_+cDRK2Brcr2~>%$*5S)hyV33PV^teac3%|4lz@8p4?)5 z?t5o^?q+%^%)Yygo~I^U4VR!bTnWuE35hcWrfCDR3q+sxJ79e7Fg`&)RCqLA^2^y^ z0laVfadW90_Fz8Brm|r47sB^u1VgI>kanj)Z4`zMSfHlm8>CwXa$JVM`$2RrmZB-3 zN10m-!;BvH*Br3V8t`DH7m`jf#2upVDXl{5ff18_pzCPK1Zu$$CKKvd8FGeFf)+K<|x33pc7P&S#3GZT4mEw;nr(Ze*F z3&*?-4U-lm*#tber5 z%S_ceqB`b3ko6r~BbvDwdohTvP(3a(pq{x#T$yQsu#OKwEe}KuH^Mh@nxg_(Nw136 zq#a^3xNBke)In+!?qk3%4wB69{pF`Tzg`07*qoM6N<$ Eg55P&8UO$Q literal 0 HcmV?d00001 diff --git a/public/doc/app/images/bullet_black.png b/public/doc/app/images/bullet_black.png new file mode 100644 index 0000000000000000000000000000000000000000..57619706d10d9736b1849a83f2c5694fbe09c53b GIT binary patch literal 211 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$h^>lFz(Kw&{<9vg>5sw~gS5O!4 zr|{HuUFIBKiQyL}eBJ-L{`UVT|6_O~L{G%N{Wbre{kQtZ_0LvEhC#5QQ<|d}62BjvZR2H60wE-$h^mK6y(Kw&{<9vg>(S^W+6Zii9 z|Nhthr~iNb*Z!}6uiN$Dz5neG3a-`baBX8yz1H+_;eX)`ni0%X8XBDc-`=Ph(Uan2 zYsR{H!kvIN--9isvHznRsC#5QQ<|d}62BjvZR2H60wE-$h_H=O!(Kw&{<9vg>(S^W+6Zii9 z|Nhthr~iNb*Z!}6uiN$Dz5neG3a-`baBX8yz4q@v|B?28{s)#N@CGn3@%_y|zAV9T z66e<&B4?b6oF&azg|C(V&1ZbI_D}pL`}(^FT2yXwG1Ph~$Q@h8mJYOz!PC{xWt~$( F699+YQR)By literal 0 HcmV?d00001 diff --git a/public/doc/app/images/date.png b/public/doc/app/images/date.png new file mode 100644 index 0000000000000000000000000000000000000000..783c83357fdf90a1c7c024358e1d768b5c09c135 GIT binary patch literal 626 zcmV-&0*(ENP)5OC%H;f`~O(q$Q#t2<^v$A>fbmv%e#dKTwK=Ku{5lS|}<-`a#7b zzTCOnnT>at)D}AMFuOZ5&%EqFN(lyumd$2ASF6=;nM~%2?gqc@U=#|4PqkX@EBo-9 z7pD#bO_RUa>*faM`8;MYfVi$JnB-zcBFc6gjl$d!bF98Q!!!(Z1_R~P?e!pt#6CHJ9S&n_n&@=9 z%GP;!@Co4c*at+6vNz7o(6en^Q1%qHrc;1)9IRaz-$@S$Z-qdC^ds3X0NvQH;KS)D z-dh&rW&@X;1cS(45z)J&BVt+tv&GMVJ%!EiW) zLBGZW)#Z+gl-Lih&?>X3SS-S#ujQ;9JRXmIB7X)8`d6ETj)D#Q2+$s|<_b7-B9Xvq zwNfqlEp%y3$uY`h{Y$(Gn5@}sqEsq95lpAkFO5dyBmP6^H-51G4J|rN2Ujt<`2YX_ M07*qoM6N<$fC4}Mrzlg<+1Y8PEBfUp0jJpx4B>@E+cy3`^(Gw`Mf+2&yxZm<$to~Vpgvg&QKNR z_f#1(r6svZt%iF?s+n<8X?B&!h3g9Dbb8_=MX}!;HiQSAh`bp^WMl~Z-44teO7W_Y zV4thSL{h;rJY7!l3%5J4H1!tIzB`Dv+YxO(haWeausGZYkI8^hWj6mzo=L0{%;yxzh{5!Htr?51 zvG|W62MzC8BZ76hRpCyO2zOn<%e)K>NHge!-~)Ap33OdWw6hsLYbCxGNt0%wk_2z7 zfyYvXheSG)5HRK1VB~%mq7Dmurw#bi@hEcOr3&G1ZiF*$M=&9nB#VNf&Q^r$4G5kp zTURh&s)E0%5&hyVD}sp<72~zmAY`Y(9aqO6CXF%=zFHGzO-A&I(pE}v70YQxCPJ{Y z4L+?5-crdLn3ZRPEs!A4ehEY3ZRpL~w9>@aMN+{F4dI@v&>(QDHQum!mG~E^$OS8l z!7?%Uwib*ROP67Hw`ika)gX-(8Ia`-u_IEhxG7U<13kSsMW+$lbb2dUMm5p6pa}cjgA+U$^mJ^AjD?&bdi)8~y+Q002ovPDHLkV1g8IMc@Dc literal 0 HcmV?d00001 diff --git a/public/doc/app/images/find.png b/public/doc/app/images/find.png new file mode 100644 index 0000000000000000000000000000000000000000..1547479646722bda4647df52cf3e8bc9b77428c6 GIT binary patch literal 659 zcmV;E0&M+>P)IO9T&v~?D!=C@G6X*U1@h2}>2WE%HrrsjTfQsh6N9%SR25A5rkWp0g zzi;-6|3HJE;58sAyX1e@^d7EwiKQLb00%dp|5+t<{|l;G!D3eSuFDma zRCxr2MVY_`ELgLXqo}ssqp5E;*r|opZT~&|!~VN?1^mw`Yxp0VmiIp*r|Ey~#AW|W zTBd;IxVd?%*x1<_!3Ip2yP9Rn!u1aqt=siKx4a3At0%7dKV|u@|9wlg|7x7R;eT!K z{QuFp&Huxb3&AdAW?^~2z`(!^HUQ{cR*=op7H|BYU0VMi3A-|5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A^qrdn6*;Qh%^sB8>DcX5d2bXh zu<5X$-n2+RVUy$k%$jmfMxgu4ZWTs$Oy{Q?tryu(5>W>)zs2)w zHL}wWPpTzwL2MM8=lkwHp3#jyMe3%J0Av0)*ixKl2lMvu@{j$n91n^pNe|jd``l0N z0RU<BSv#yWY}G&Kb9IUxK2(l z!4Sz=T3g)J1mqFu!`seMX@O}Bp}gyZ@I7GK*7vWYuax&DJ=8$){{tXS> z7+}lu)M-J126vy;?q&^}iM1!NCf1I@E@@H~O-PIlsM7kknVdsATr@pmBo(C~$G6gS z02;)2O@0&~`#fHDeC1eCZZs;s2N)@A;Z!v}6IRW@+w4GRSlrsuorBjfJ?y*o(0gj> zt+;DN~K1pX*UvM(B(Di$9F6+&eT z#bhNzlMA>q^N?j+@1IqnYvK};_)_77Ts{!elaGqJg{uwb(1mX6u=pkfLJYkfX+`v! zOm>eolNV>Nz$A&W8YqkN#cU|#i6j>Ox+Eu4*8Myq{Eq?u*kn+nT zQ@k8?r`Isov^UI2=T{#K~skC)fRP-aj zcrJyQmQ!u>p5&{_zp7xOM(Q%smb6M%g6o4s^>A8#L41?8Ox^e7CM$W~*3!e8F7P`S zK9!26tqJVBt`?fLxM^Gf`xAacdcbz&)u<6pKM?qA_ms76BOQWg0Le^W#?SMIT$jE7 zyw1!lG*$#k#iqZyl9~L_CjIwBb}$%9+e2Vw!1@$nfpvj1y2o4hJabo7^;(V}>++Tz z{|NtdydBeFpKnv*Vg9BTu3P)+)3J?9`*6t|c{b*k>-L!PvY`#5^i1^XCnxh zky})0T&rp6 zJFwUVv-;Dzt2_z1)}rtpHBQH#<-`N0%%UP1TF^VNx2@~Zh_4nbMMxj7zeHTrB&q)a Dl)1NK literal 0 HcmV?d00001 diff --git a/public/doc/app/images/macFFBgHack.png b/public/doc/app/images/macFFBgHack.png new file mode 100644 index 0000000000000000000000000000000000000000..c6473b324ee1dae1faaacc0826639833f551116c GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1|*NXY)uAIEX7WqAsj$Z!;#Vf4nJ za0`Jjl>Qs8<JF;+Fd5q0wCR k?u=~bH}2*0f`J3~k>FVdQ&MBb@0BAfpf&c&j literal 0 HcmV?d00001 diff --git a/public/doc/app/images/package.png b/public/doc/app/images/package.png new file mode 100644 index 0000000000000000000000000000000000000000..da3c2a2d74bab159ba0f65d7db601768258afcb2 GIT binary patch literal 853 zcmV-b1FHOqP)5TQ^(M5v$(QKVE?W+9X! z*o}&~6c?_FreF)9NJB7b5Nbn{G0n4+%uJhR9(V5R|NFTpb|HgjefT!tIhLx@DR+N) zV+fHiR5Yt19}k|KnCsND{tH-`IMJ)3AE?OtyZ4>Un|6(d%h#JK`i&a7^xW9>`yBy` zS4SOHeOpC7$?hH5-#7Rswiue_8Ju*2N@$58=a#2OTA3png`w3v->gWif7t%e$ z$NLVS!tFT#8WL|Wa&K~+{%4P2cRfwesYV1_!F=3OaRVHl(>=`%&{x*s30c}#CNE@&;ItrAv!f!)Oy$Q9t$uS=(sD$-J{T*^(8Eez1E-l3}} zPrfHZ1`qsIFe&gipuL8-IZbo2Yg{lFGKs?ZZWcOaOdk*3`5T;$?AjbG1#`B510Er^h2)2r3Y{!8_2Gj=$KzuN5 zaErtW8W_Y2iJJjY)5pmTVJoPJYpanPOEuYHclM^C1F>${hFRpdi8a<2H|Xudf78bm(zwJ9`K%6I?q*Ua~ fW9JvIbn5*B+_J)rUMBs>00000NkvXXu0mjfH&TkY literal 0 HcmV?d00001 diff --git a/public/doc/app/images/page_green.png b/public/doc/app/images/page_green.png new file mode 100644 index 0000000000000000000000000000000000000000..de8e003f9fb8752c09e7f3655d5d8664b5c62fc3 GIT binary patch literal 621 zcmV-z0+RiSP)QqUjAtB;_Vvt6}AS_5YgM`Uqu`yva+H8^=4U$e4gHb}u zAQ2N{V3A%pO|?Pv?tb6z=jC}SiRa$G^v3q?*6XcYz$p|cq{uLj@#~Fi`J(>5{@&&N zy%T^+;>8cXx%|o77anP?&W1?1A(>-T49z9pyeCl@7YI+Si zKti7=B~``}TImz(G{0PnlQA3P#MAd}sorMjkP!50B7$nAkU^%#nl{Q9lW0@}9fE-> zN(q7tRuiC_T1r|BBtVBTlQ2+70$Rf;eF`Z;lx46Cpu-rEgb)EBKq(b^W8l<^We(`D z43?0=01z<3G6+UUv6`CsWCk6^93!#+<;ws7007{zS3k2k9-zZKFO~(k`>s0y006+1 zgF_jyIhsL-`FMf~JL~C=cV75(CrJ|q;MVO961G=O zm9d)YpJg5g(4i_HKL75eSE}mq$Y}r}hyVdcV~p>6a}oXr80q`oj%+s700000NkvXX Hu0mjfPs|!l literal 0 HcmV?d00001 diff --git a/public/doc/app/images/page_white_text.png b/public/doc/app/images/page_white_text.png new file mode 100644 index 0000000000000000000000000000000000000000..813f712f726c935f9adf8d2f2dd0d7683791ef11 GIT binary patch literal 342 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-%6;pyTSA|c6o&@eC9QG)Hj&ExYL zO&oVL^)+cM^qd@ApywS>pwx0H@RDN}hq;7mU-SKczYQ-hnrr=;iDAQMZQ+*g=YOM= z!QlMQEn7FbaD->uKAYgo_j9)W&$$zS*W9}m(ey0q$&7l-XEWO0Y(9M=SnhLbwy;d>@~SY$Ku*0xPvIOQeV1x7u_z-2-X>_74(yfh7C znXL|3GZ+d2`3re2hs?MKC#5QQ<|d}62BjvZR2H60wE-$R?&;zfqH(@;q9b3Efq-lM(nr^( z=EYR73-9e)UYMWsXy%?aZsD68Yyv^2$~6QgEcljw%kx>O(f-gQ?@fOOx3A-0+Qw?O zRx~W)kn~Qe2d6f9nMG#g9Q04Mk==M~N!Dglvxk!fgVh#w@ZV$IY1+Xc`d{d2UcaP~ zfWp)_Ivqj}l2SPy^9ZWy6rG9Yx4v67_uA&&9|XA~5-#3)W3%em1peD8RWH^#O%XoM zxMPud%}GTj#~*+7JMxTd!`{^Q+>(D3*|@KV`*G2;{QnANOxu1$r2xIe;OXk;vd$@? F2>@zac~<}c literal 0 HcmV?d00001 diff --git a/public/doc/app/images/plugin.png b/public/doc/app/images/plugin.png new file mode 100644 index 0000000000000000000000000000000000000000..6187b15aec001b7080b51a5f944f07591f26cc15 GIT binary patch literal 591 zcmV-V0eEcNHZMNv|IbJ-M`( zKwWL~opzjJe^WpCmV9E;(0&ut2;4va_(#>M8)>9$R5viQnf(Nkh~VM$y>J(jqb$cj z+nL1Nm|mV)Gm|9MnHf*7Ja4OEAQz__^LRKOLEwqpiGV^^A*T=#&inGm-62Xs;dnSp zKj&H9T*boh2i)W+(n27l!C)>fq|L%VB1i ziC4p;NwV_}ZjW7$LRW#(_bKF#hp=!IqNO26Z*w2+LEwx{PVnZ&Sn}T;mtzb$;qA*nT@@+ zV5uQ@iXDTPoTbV#FRr~z04|PPh`wXTNoCm9*tG&?e3+fYl>K6+&3|Cc$KOpL`ER+_ dcRl5U#9zn6ZO}GFk7R5;7c zlif>`Q5?tj7Yw@ZCMtTF^Q|ZedeJhM%QPCR*bs8V79p$QTo7e94yQNXRs-{0?hOn_-8n0AMO@u1Ts zNl8QzJs1#rz%RBt?ux>l+amAvh+J!{$lkaqv}+Erb-6j2xp>K4GLQnNB*W`hFg*?P z^AL@~(h~Z+wfcWEXHqV^Tq-#z$7Y#o0;yFxA!00F}F2dX# zjE$iOgT#G4*1TR6kB1Gnn@>$meCh2a>c5YuIvFn-R2W@>4@M*m@-|jiDV?b)bccgA zyPfsMM!rjy>+1O2)5Eg29Z_*2p&qGnmS!OH?vZ(4>QB01d>j%9n4QINxkyT(Dos?I zjaWF$*IQmh`SF-?xU%xMEfjq1=6qY*g&lgG_cXv$BGoIWyfO5 zp>pdV*O+y=&6@N2WWFo(%RtT`Q(H^6zn^a%epE~Kx^mEJ{c8`luC$nc*z9j|4Ms8aJK-ladKLpnAK z!yd|CC&>l1b7`m$MH$ScEIP@XgT41O>|DzL{-38CH68OyX#u=G?d7;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rxA;E!fKoc{9Vi=lvFL}KmoS;g* zdjL?Y!VHUFq63aLj6VZE+tHts?Z1pFkiO9^k*5pGpFpU&5#5G4ATd{t>a&9zKBVB9=Ns^HFU|DTGH8C+Xr2UqOU`Zxe)!|%j4=-QojGePq)pRGe;!f)Czk!u3vP_Jxu8(e6 zf4Q`F$Qio2Jw@N*E@k?c`+Sw}AYQjkT+x)OAe6eq(AT!iRuksKQn%Ao_Ac1T-p#Js I_CnHs0qX}mlmGw# literal 0 HcmV?d00001 diff --git a/public/doc/app/images/tag_green.png b/public/doc/app/images/tag_green.png new file mode 100644 index 0000000000000000000000000000000000000000..83ec984bd73364134da0f98d27a800c5d3264180 GIT binary patch literal 613 zcmV-r0-F7aP)^5T)AZ%#@G{_P{NCN^P z(J0zvSn~SSm(Ur);-M~8^*;61*VRI`T1BN&LAhK;sZ>I-SVW;vfUfJv=ko^ugnc0x zhJodBxe>iyk3%w<%wC8holUJ4(iv>tL{`DQt zPOsyUbO_Cmc&*iHkqbm3ku`|GcC^OhF>jj9W*GkH;^g!iUVpib_h*=@udp4h(P+e*zL_~ZmJjh(y^BxULwq>9zXoYE8sq{#pN~U0C6!8vY)5N2 z9P*}mw}7X$O^qTtJef1ACWvJT9^wt-)Zh0r~j#0bT`f;-zv6 z^Tmw22!%rMcs!TaUX<-8s;X-B`+Xbo+_uWuFa z1yIPc?DTrQ7KvRhmt*TG|L=EYQ=LqFX;=Lp`4}jx6BE-@00000NkvXXu0mjf=s_29 literal 0 HcmV?d00001 diff --git a/public/doc/app/images/transparent.png b/public/doc/app/images/transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..d665e179efd797451084235f105425247fea0a14 GIT binary patch literal 97 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;bAV5X>;M1%mmiTn0pv241o;Is pI6S+N2ITN~x;Tb#$R;N!@B(=T42&&nK2`x)44$rjF6*2UngG277DE64 literal 0 HcmV?d00001 diff --git a/public/doc/app/images/wrench.png b/public/doc/app/images/wrench.png new file mode 100644 index 0000000000000000000000000000000000000000..5c8213fef5ab969f03189d4367e32e597e38bd7f GIT binary patch literal 610 zcmV-o0-gPdP)^jb z4`0v}DG1te)wmeb(>p90leRz?_mO+^JKy=v&2<29Od6?F%9%(c8los#f*@G`-%W&* z$)uBj2i@u-@SgX}gtyWPe6d*|w6h%R? zScK2#Yn%$sum0cy>90DmY*i{1XqpClEtktsRTZ)lCUe z<FogV^*tm>8*AlX za4oiR!&85LrobG57qUHUX#{>Vz(RHpB5|@>9O6N$jqB8>%($0wxE5R3)b>Y~xtCo$ zCgEk&A?_#IxHdN)9tqre^o{ho4{?hmPuf@^@I3-wncaRd%|~O3xbrKY=&TiwPYkJroM{;WUQTuMY8vpg}f4o)2%U3C;eEDoiEh?94d(rV57VIF#8VqzW$HrDC|#U`x@QDbgi zVl)t9GGz&YY#D?gc%>hISA+_EBpnXt#pnC`p6@xw0$8TCbULjhlgVx(kuc)%xbgqq zR5+DNDFRN0!y)7Gm}oT0i39}h4h928qY?Rho^UvPGJ#kuW|-Amtrn`Pmd&+bFo@sp z$LI4IQw7BG?|#2ewOS<<3VjL$0=lMY^m;wqZujv5kx1l%Sl;V&Iy4#$ip3&@LV2!7vhhN=PCz%^9v24`qb(+m4W?!q-&~=?ssf5GfnAmJKV;3bvpDm0(NhahZ=&^sqo6Odj6>)Dq_3p~4~ zvb`d3Mydwjt&Df^hVmLtI2x=U&h9(JVYX-!y~z3zi;1>=LY;o(bL$(Yf$lf)dMf0-u^0HrpTG Wk@)HE*94aU0000m+BBgry{~j2fHLegbHP( zrgXNbr0}2;^nywdjLjZe?uxtrd3D(pZH@fFFc0{BW_~jxoO1w7-VX;6vK@ROA$$R6 zEmo;Ht-Mj|>5jUy{bQ^V5@53LRI8AgLpUm|m+15sqcz@QtVSo|oz7ArM8?pIn+>gN z0b=4_b5O|4A*;Q+vc9Vqr~%3V155*NV~@gTz}KSUiKB-uJzjMZ>5%Q#n24H!V{ zTY(LLAE*NAHZ}C#wnj%Bw5OFIkRhkkAW#kDC3j9Wm0YXRaXlyyp>#mVfYG)eC;@ab zDb=T-BCAY4LI(Z@GOTr2V_A{pRwSmz+8Be>CjAw(=gnbVWAeguvZa93JmL(EDxv1m z0OP4q=fpAK1Mq!C2`OkEn37o;m#wF#(t(8Pu#S?2f#x<~4EO{@fmm`p9veD6RZ_jp z@Au4};q&`XuKEYgIiB4((kgxOs#YdqJw0fY>9^K_agEu5+$#k;w#%I2N>n_?)YIqu z`tq&#_^p?-%K*U0^}|7+9U(&k0?s;=r=uCZ%)H9_edH8wK}gB(nUB1FFk+2Ol%BXV zHoFY`D~2x|2 + + + + + +Rails Application Documentation + + + + + + + + + + + + + + + + +

    This is the API documentation for Rails Application Documentation. + + +

    + diff --git a/public/doc/app/js/darkfish.js b/public/doc/app/js/darkfish.js new file mode 100644 index 0000000..4be722f --- /dev/null +++ b/public/doc/app/js/darkfish.js @@ -0,0 +1,153 @@ +/** + * + * Darkfish Page Functions + * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $ + * + * Author: Michael Granger + * + */ + +/* Provide console simulation for firebug-less environments */ +if (!("console" in window) || !("firebug" in console)) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", + "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; + + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +}; + + +/** + * Unwrap the first element that matches the given @expr@ from the targets and return them. + */ +$.fn.unwrap = function( expr ) { + return this.each( function() { + $(this).parents( expr ).eq( 0 ).after( this ).remove(); + }); +}; + + +function showSource( e ) { + var target = e.target; + var codeSections = $(target). + parents('.method-detail'). + find('.method-source-code'); + + $(target). + parents('.method-detail'). + find('.method-source-code'). + slideToggle(); +}; + +function hookSourceViews() { + $('.method-heading').click( showSource ); +}; + +function toggleDebuggingSection() { + $('.debugging-section').slideToggle(); +}; + +function hookDebuggingToggle() { + $('#debugging-toggle img').click( toggleDebuggingSection ); +}; + +function hookTableOfContentsToggle() { + $('.indexpage li .toc-toggle').each( function() { + $(this).click( function() { + $(this).toggleClass('open'); + }); + + var section = $(this).next(); + + $(this).click( function() { + section.slideToggle(); + }); + }); +} + +function hookSearch() { + var input = $('#search-field').eq(0); + var result = $('#search-results').eq(0); + $(result).show(); + + var search_section = $('#search-section').get(0); + $(search_section).show(); + + var search = new Search(search_data, input, result); + + search.renderItem = function(result) { + var li = document.createElement('li'); + var html = ''; + + // TODO add relative path to + + + + + + + + + + +

    Table of Contents - Rails Application Documentation

    + +

    Pages

    + + +

    Classes/Modules

    + + +

    Methods

    + + + + + diff --git a/test/fixtures/comments.yml b/test/fixtures/comments.yml index 29c9999..72e0400 100644 --- a/test/fixtures/comments.yml +++ b/test/fixtures/comments.yml @@ -2,10 +2,12 @@ one: comment: MyString - user_id: 1 - site_id: 1 + user: one + site: one + two: - comment: MyString - user_id: 1 - site_id: 1 + comment: MyString2 + user: two + site: one + diff --git a/test/fixtures/sites.yml b/test/fixtures/sites.yml index 946ec2e..4ee3df4 100644 --- a/test/fixtures/sites.yml +++ b/test/fixtures/sites.yml @@ -3,11 +3,14 @@ one: name: MyString description: MyText - type_id: 1 + type: one image_url: MyString + user: one two: - name: MyString - description: MyText - type_id: 1 - image_url: MyString + name: YourString + description: YourText + type: two + image_url: YourString + user: two + diff --git a/test/fixtures/trips.yml b/test/fixtures/trips.yml index 4afcf18..bbe6c7a 100644 --- a/test/fixtures/trips.yml +++ b/test/fixtures/trips.yml @@ -1,13 +1,13 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html - -one: - name: MyString - description: MyText - date: 2012-04-17 - user_id: 1 - -two: - name: MyString - description: MyText - date: 2012-04-17 - user_id: 1 +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + name: MyString + description: MyText + date: 2012-04-09 + user: one + +two: + name: YourString + description: YourText + date: 2012-04-09 + user: two diff --git a/test/fixtures/types.yml b/test/fixtures/types.yml index 8683ea9..49a7b4e 100644 --- a/test/fixtures/types.yml +++ b/test/fixtures/types.yml @@ -5,8 +5,8 @@ one: description: MyText two: - name: MyString - description: MyText + name: YourString + description: YourText # Podriamos añadir nuevos datos de inicialización, que se referencian como # -> types(:monumento) types(:naturaleza) monumento: name: Monumento description: “Edificio o construcción de valor historico” naturaleza: name: Naturaleza description: “Lugar al aire libre de interés natural” \ No newline at end of file diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 8ca7647..fbfe998 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -4,8 +4,14 @@ # model remove the '{}' from the fixture names and add the columns immediately # below each fixture, per the syntax in the comments below # -one: {} +one: + name: Jose Perez + email: jose.perez@gmail.com + encrypted_password: perez22222 # column: value # -two: {} +two: + name: Jose Perez + email: jose.perez@me.com + encrypted_password: perez33333 # column: value diff --git a/test/fixtures/visits.yml b/test/fixtures/visits.yml index 6a15000..0cf5933 100644 --- a/test/fixtures/visits.yml +++ b/test/fixtures/visits.yml @@ -1,11 +1,11 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html - -one: - trip_id: 1 - site_id: 1 - hour: 1 - -two: - trip_id: 1 - site_id: 1 - hour: 1 +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + trip: one + site: one + hour: 9 + +two: + trip: two + site: two + hour: 9 diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb index b2b500c..7b16a47 100644 --- a/test/functional/comments_controller_test.rb +++ b/test/functional/comments_controller_test.rb @@ -3,25 +3,32 @@ class CommentsControllerTest < ActionController::TestCase setup do @comment = comments(:one) + @update = { # @update: parametros diferentes + :comment => 'AnotherComment', + :site_id => sites(:one).id + } + @site = @comment.site + @user = @comment.user + sign_in @user end test "should get index" do - get :index + get :index, :site_id => @comment.to_param assert_response :success assert_not_nil assigns(:comments) end test "should get new" do - get :new + get :new, :site_id => @comment.to_param assert_response :success end test "should create comment" do assert_difference('Comment.count') do - post :create, comment: @comment.attributes + post :create, comment: @update end - assert_redirected_to comment_path(assigns(:comment)) + assert_redirected_to @site end test "should show comment" do @@ -35,8 +42,8 @@ class CommentsControllerTest < ActionController::TestCase end test "should update comment" do - put :update, id: @comment, comment: @comment.attributes - assert_redirected_to comment_path(assigns(:comment)) + put :update, id: @comment, comment: @update + assert_redirected_to @site end test "should destroy comment" do @@ -44,6 +51,6 @@ class CommentsControllerTest < ActionController::TestCase delete :destroy, id: @comment end - assert_redirected_to comments_path + assert_redirected_to @site end end diff --git a/test/functional/planet_controller_test.rb b/test/functional/planet_controller_test.rb index 84d5ebb..cdc5356 100644 --- a/test/functional/planet_controller_test.rb +++ b/test/functional/planet_controller_test.rb @@ -1,14 +1,15 @@ require 'test_helper' -class PlanetControllerTest < ActionController::TestCase +class PlanetControllerTest < ActionController::TestCase + test "should get index" do - get :index - assert_response :success + get :index + assert_response :success end test "should get contact" do - get :contact - assert_response :success + get :contact + assert_response :success end test "should get author" do @@ -22,5 +23,14 @@ class PlanetControllerTest < ActionController::TestCase # Invoca “get” en acción “ejemplo” assert_response :success # código HTTP: “200 OK” end - + + test "should get search" do + get :search, :search => 'X' + # Invoca “get” en acción “ejemplo” con búsqueda errónea + assert_response :success # código HTTP: “200 OK” + + get :search, :search => 'Correcta' + # Invoca “get” en acción “ejemplo” con búsqueda correcta + assert_response :success # código HTTP: “200 OK” + end end diff --git a/test/functional/planet_controller_test.rb~ b/test/functional/planet_controller_test.rb~ new file mode 100644 index 0000000..31a0509 --- /dev/null +++ b/test/functional/planet_controller_test.rb~ @@ -0,0 +1,36 @@ +require 'test_helper' + +class PlanetControllerTest < ActionController::TestCase + + test "should get index" do + get :index + assert_response :success + end + + test "should get contact" do + get :contact + assert_response :success + end + + test "should get author" do + get :author + # Invoca “get” en acción “author” + assert_response :success # código HTTP: “200 OK” + end + + test "should get ejemplo" do + get :ejemplo + # Invoca “get” en acción “ejemplo” + assert_response :success # código HTTP: “200 OK” + end + + test "should get search" do + get :search, :search => 'X'.to_param + # Invoca “get” en acción “ejemplo” con búsqueda errónea + assert_response :success # código HTTP: “200 OK” + + get :search, :search => 'Correcta'.to_param + # Invoca “get” en acción “ejemplo” con búsqueda correcta + assert_response :success # código HTTP: “200 OK” + end +end diff --git a/test/functional/sites_controller_test.rb b/test/functional/sites_controller_test.rb index 82688ba..aa5865c 100644 --- a/test/functional/sites_controller_test.rb +++ b/test/functional/sites_controller_test.rb @@ -3,6 +3,13 @@ class SitesControllerTest < ActionController::TestCase setup do @site = sites(:one) + @update = { # @update: parametros diferentes + :name => 'AnotherType', + :description => 'AnotherText', + :type_id => types(:one).id + } + @user = @site.user + sign_in @user end test "should get index" do @@ -18,7 +25,7 @@ class SitesControllerTest < ActionController::TestCase test "should create site" do assert_difference('Site.count') do - post :create, site: @site.attributes + post :create, site: @update end assert_redirected_to site_path(assigns(:site)) @@ -35,7 +42,7 @@ class SitesControllerTest < ActionController::TestCase end test "should update site" do - put :update, id: @site, site: @site.attributes + put :update, id: @site, site: @update assert_redirected_to site_path(assigns(:site)) end diff --git a/test/functional/trips_controller_test.rb b/test/functional/trips_controller_test.rb index b09dce2..eb6f095 100644 --- a/test/functional/trips_controller_test.rb +++ b/test/functional/trips_controller_test.rb @@ -1,49 +1,56 @@ -require 'test_helper' - -class TripsControllerTest < ActionController::TestCase - setup do - @trip = trips(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:trips) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create trip" do - assert_difference('Trip.count') do - post :create, trip: @trip.attributes - end - - assert_redirected_to trip_path(assigns(:trip)) - end - - test "should show trip" do - get :show, id: @trip - assert_response :success - end - - test "should get edit" do - get :edit, id: @trip - assert_response :success - end - - test "should update trip" do - put :update, id: @trip, trip: @trip.attributes - assert_redirected_to trip_path(assigns(:trip)) - end - - test "should destroy trip" do - assert_difference('Trip.count', -1) do - delete :destroy, id: @trip - end - - assert_redirected_to trips_path - end -end +require 'test_helper' + +class TripsControllerTest < ActionController::TestCase + setup do + @trip = trips(:one) + @update = { # @update: parametros diferentes + :name => 'AnotherType', + :description => 'AnotherText', + :date => '2012-04-09' + } + @user = @trip.user + sign_in @user + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:trips) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create trip" do + assert_difference('Trip.count') do + post :create, trip: @update + end + + assert_redirected_to trip_path(assigns(:trip)) + end + + test "should show trip" do + get :show, id: @trip + assert_response :success + end + + test "should get edit" do + get :edit, id: @trip + assert_response :success + end + + test "should update trip" do + put :update, id: @trip, trip: @update + assert_redirected_to trip_path(assigns(:trip)) + end + + test "should destroy trip" do + assert_difference('Trip.count', -1) do + delete :destroy, id: @trip + end + + assert_redirected_to trips_path + end +end diff --git a/test/functional/types_controller_test.rb b/test/functional/types_controller_test.rb index cf68df1..fa3eff6 100644 --- a/test/functional/types_controller_test.rb +++ b/test/functional/types_controller_test.rb @@ -7,6 +7,8 @@ class TypesControllerTest < ActionController::TestCase :name => 'AnotherType', :description => 'AnotherText', } + @user = users(:one) + sign_in @user end test "should get index" do diff --git a/test/functional/visits_controller_test.rb b/test/functional/visits_controller_test.rb index 45397e3..4453dcb 100644 --- a/test/functional/visits_controller_test.rb +++ b/test/functional/visits_controller_test.rb @@ -1,49 +1,50 @@ -require 'test_helper' - -class VisitsControllerTest < ActionController::TestCase - setup do - @visit = visits(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:visits) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create visit" do - assert_difference('Visit.count') do - post :create, visit: @visit.attributes - end - - assert_redirected_to visit_path(assigns(:visit)) - end - - test "should show visit" do - get :show, id: @visit - assert_response :success - end - - test "should get edit" do - get :edit, id: @visit - assert_response :success - end - - test "should update visit" do - put :update, id: @visit, visit: @visit.attributes - assert_redirected_to visit_path(assigns(:visit)) - end - - test "should destroy visit" do - assert_difference('Visit.count', -1) do - delete :destroy, id: @visit - end - - assert_redirected_to visits_path - end -end +require 'test_helper' + +class VisitsControllerTest < ActionController::TestCase + setup do + @visit = visits(:one) + @trip = @visit.trip + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:visits) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create visit" do + assert_difference('Visit.count') do + post :create, visit: @visit.attributes + end + + assert_redirected_to @trip + end + + test "should show visit" do + get :show, id: @visit + assert_response :success + end + + test "should get edit" do + get :edit, id: @visit + assert_response :success + end + + test "should update visit" do + put :update, id: @visit, visit: @visit.attributes + assert_redirected_to @trip + end + + test "should destroy visit" do + assert_difference('Visit.count', -1) do + delete :destroy, id: @visit + end + + assert_redirected_to @trip + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index abf331b..3bf88c0 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -9,5 +9,10 @@ class ActiveSupport::TestCase # -- they do not yet inherit this setting fixtures :all + # Add more helper methods to be used by all tests here... end + +ActionController::TestCase.class_eval do + include Devise::TestHelpers +end diff --git a/test/unit/site_test.rb b/test/unit/site_test.rb index 1bd2cb8..e457320 100644 --- a/test/unit/site_test.rb +++ b/test/unit/site_test.rb @@ -12,6 +12,6 @@ class SiteTest < ActiveSupport::TestCase assert site.errors[:name].any? assert not(site.errors[:description].any?) assert site.errors[:type_id].any? - assert site.errors[:image_url].any? + # assert site.errors[:image_url].any? not used with paperclip end end