diff --git a/Gemfile.lock b/Gemfile.lock index fd905dc..53fc807 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,7 +60,7 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.18) - multi_json (1.3.1) + multi_json (1.3.2) orm_adapter (0.0.7) paperclip (3.0.2) activemodel (>= 3.0.0) @@ -95,7 +95,7 @@ GEM rake (0.9.2.2) rdoc (3.12) json (~> 1.4) - sass (3.1.15) + sass (3.1.16) sass-rails (3.2.5) railties (~> 3.2.0) sass (>= 3.1.10) @@ -104,7 +104,7 @@ GEM hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.5) + sqlite3 (1.3.6) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) diff --git a/Gemfile~ b/Gemfile~ new file mode 100644 index 0000000..f3540ce --- /dev/null +++ b/Gemfile~ @@ -0,0 +1,51 @@ +source 'https://rubygems.org' + +gem 'rails', '3.2.2' + +# Bundle edge Rails instead: +# gem 'rails', :git => 'git://github.com/rails/rails.git' + +group :development, :test do + gem 'sqlite3' +end + +group :production do + gem 'pg' +end + + +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' +gem 'paperclip' + +# 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' + +#gem 'json', '1.6.5' + diff --git a/app/assets/images/foto.jpg b/app/assets/images/foto.jpg new file mode 100644 index 0000000..79bc033 Binary files /dev/null and b/app/assets/images/foto.jpg differ diff --git a/app/assets/javascripts/comentarios.js.coffee b/app/assets/javascripts/comentarios.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/comentarios.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/comentarios.css.scss b/app/assets/stylesheets/comentarios.css.scss new file mode 100644 index 0000000..494c101 --- /dev/null +++ b/app/assets/stylesheets/comentarios.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the comentarios controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/planet.css b/app/assets/stylesheets/planet.css index ead053a..9a73c71 100644 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -89,6 +89,22 @@ font-size: small; } +#search { + float: right; + position: relative; + +margin-right: 1em; +margin-top: 14px; + + +} + +#map_canvas { + margin-left: 9em; /* Ajuste de borde izquierdo */ + padding-top: 4ex; + padding-left: 2em; +} + #columns { background: #446; } diff --git a/app/controllers/comentarios_controller.rb b/app/controllers/comentarios_controller.rb new file mode 100644 index 0000000..becec6a --- /dev/null +++ b/app/controllers/comentarios_controller.rb @@ -0,0 +1,90 @@ +#ComentariosController es la clase que aglutina los métodos +#necesarios para tratar con los comentarios creados en un determinado sitio +# +class ComentariosController < ApplicationController + + + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] + + # Método que devuelve todos los comentarios existentes + def index + + @comentarios=Comentario.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @comentarios } + end + end + + #método que muestra los comentarios correspondientes a un determinado sitio + def show + @comentario = Comentario.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comentario } + end + end + + # método que crea un nuevo comentario "vacío" + def new + @comentario = Comentario.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @comentario } + end + end + + #método que se emplea para editar un nuevo comentario + def edit + @comentario = Comentario.find(params[:id]) + end + + #método que crea un nuevo comentario asociado a un determinado sitio + def create + @site=Site.find(params[:site_id]) + @comentario=@site.comentarios.create(params[:comentario]) + @comentario.user_id=current_user.id + + + respond_to do |format| + if @comentario.save + format.html { redirect_to @comentario, notice: 'Comentario was successfully created.' } + format.json { render json: @comentario, status: :created, location: @comentario } + else + format.html { render action: "new" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + #método empleado para actualizar un comentario + def update + @comentario = current_user.comentarios.find(params[:id]) + + respond_to do |format| + if @comentario.update_attributes(params[:comentario]) + format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + #método para eliminar un comentario determinado + def destroy + @comentario = current_user.comentarios.find(params[:id]) + @comentario.destroy + + respond_to do |format| + format.html { redirect_to @comentario, notice: 'Comentario was successfully destroyed.' } + format.json { render json: @comentario, status: :created, location: @comentario } + end + end +end \ No newline at end of file diff --git a/app/controllers/planet_controller.rb b/app/controllers/planet_controller.rb index a8636bd..3fa4183 100644 --- a/app/controllers/planet_controller.rb +++ b/app/controllers/planet_controller.rb @@ -29,5 +29,15 @@ def contact # 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 define la acción de buscar en el controlador + def search + + @sites = Site.where("name like ? OR description like ?", "%#{params[:search]}%", "%#{params[:search]}%") + @trips = Trip.where("name like ? OR description like ?", "%#{params[:search]}%", "%#{params[:search]}%") + end + end diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 57e0611..833a5c8 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -1,11 +1,15 @@ +#SitesController es la clase que aglutina los métodos +#necesarios para tratar con los sitios registrados en el sistema +# 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 + #método que muestra todos los sitios creados def index if params[:type_id].nil? or params[:type_id].empty? @sites = Site.all # path: /types @@ -18,19 +22,19 @@ def index end end - # GET /sites/1 - # GET /sites/1.json + # método que muestra el sitio con un determinado id def show @site = Site.find(params[:id]) + @comentario=Comentario.new(:site=>@site) + respond_to do |format| format.html # show.html.erb format.json { render json: @site } end end - # GET /sites/new - # GET /sites/new.json + #método que crea un nuevo sitio vacío def new @site = current_user.sites.build # crea sitio vacio asociado a current_user @@ -40,13 +44,12 @@ def new end end - # GET /sites/1/edit + # método para editar un sitio creado con anterioridad 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 necesario para crear un nuevo sitio asignado a un usuario def create @site = current_user.sites.build(params[:site]) # Asigna solo si sitio asociado a current_user @@ -61,8 +64,7 @@ def create end end - # PUT /sites/1 - # PUT /sites/1.json + # método para actualizar sitios creados por un usuario def update @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user @@ -77,8 +79,7 @@ def update end end - # DELETE /sites/1 - # DELETE /sites/1.json + #método para eleminar los sitios creados por el usuario def destroy @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user @site.destroy @@ -88,9 +89,10 @@ def destroy format.json { head :no_content } end end - + private def count_visita @site.increment!(:visitas) end -end + +end \ No newline at end of file diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 321f6e3..cdd49e2 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -1,10 +1,13 @@ +#TripsController es la clase que aglutina los métodos +#necesarios para tratar con los viajes creados +# class TripsController < ApplicationController + # authenticate_user! ejecuta acción solo si sesión existe before_filter :authenticate_user!, :except => [ :index, :show ] - # GET /trips - # GET /trips.json + # método que muestra todos los viajes disponibles def index @trips = Trip.all @@ -14,8 +17,7 @@ def index end end - # GET /trips/1 - # GET /trips/1.json + # método que muestra un determinado viaje def show @trip = Trip.find(params[:id]) @visit = @trip.visits.build @@ -26,8 +28,7 @@ def show end end - # GET /trips/new - # GET /trips/new.json + # método que crea un nuevo viaje vacío def new @trip = current_user.trips.build @@ -37,13 +38,12 @@ def new end end - # GET /trips/1/edit + # método para editar un viaje def edit @trip = current_user.trips.find(params[:id]) end - # POST /trips - # POST /trips.json + # método para crear un nuevo viaje asociado al usuario actual def create @trip = current_user.trips.build(params[:trip]) @@ -58,8 +58,7 @@ def create end end - # PUT /trips/1 - # PUT /trips/1.json + # método para actualizar un viaje determinado def update @trip = current_user.trips.find(params[:id]) @@ -74,8 +73,7 @@ def update end end - # DELETE /trips/1 - # DELETE /trips/1.json + # método para eliminar un viaje determinado def destroy @trip = current_user.trips.find(params[:id]) @trip.destroy diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb index da826f4..de56559 100644 --- a/app/controllers/types_controller.rb +++ b/app/controllers/types_controller.rb @@ -1,6 +1,10 @@ +#TypesController es la clase que aglutina los métodos +#necesarios para tratar con las tipos de lugares del sistema +# class TypesController < ApplicationController - # GET /types - # GET /types.json + + +#método que muestra todos los tipos disponibles def index @types = Type.all @@ -10,8 +14,7 @@ def index end end - # GET /types/1 - # GET /types/1.json + #método qeu muestra un determinado tipo creado def show @type = Type.find(params[:id]) @@ -21,8 +24,7 @@ def show end end - # GET /types/new - # GET /types/new.json + #método que crea un nuevo tipo vacío def new @type = Type.new @@ -32,13 +34,12 @@ def new end end - # GET /types/1/edit + #método que edita un tipo creado anteriormente def edit @type = Type.find(params[:id]) end - # POST /types - # POST /types.json + #método que crea nuevo un tipo determinado def create @type = Type.new(params[:type]) @@ -53,8 +54,7 @@ def create end end - # PUT /types/1 - # PUT /types/1.json + # método que actualiza un tipo creado previamente def update @type = Type.find(params[:id]) @@ -69,8 +69,7 @@ def update end end - # DELETE /types/1 - # DELETE /types/1.json + # método para eliminar un tipo existente def destroy @type = Type.find(params[:id]) @type.destroy @@ -80,4 +79,19 @@ def destroy format.json { head :no_content } end end + + +#método que devuelve los tipos ordenados alfabéticamente + +def ordered_index + + @types=Type.find(:all, :order => :name) + + respond_to do |format| + format.html #index.html.erb + format.json { render json: @types} +end + +end + end diff --git a/app/controllers/visits_controller.rb b/app/controllers/visits_controller.rb index 5bd5366..641a0ae 100644 --- a/app/controllers/visits_controller.rb +++ b/app/controllers/visits_controller.rb @@ -1,6 +1,9 @@ +#VisitsController es la clase que aglutina los métodos +#necesarios para tratar con las visitas a un determinado lugar class VisitsController < ApplicationController - # GET /visits - # GET /visits.json + + + #método que muestra todas las visitas def index @visits = Visit.all @@ -10,8 +13,7 @@ def index end end - # GET /visits/1 - # GET /visits/1.json + #método que muestra las visitas de un determinado lugar def show @visit = Visit.find(params[:id]) @@ -21,8 +23,7 @@ def show end end - # GET /visits/new - # GET /visits/new.json + #método que crea una nueva visita vacía def new @visit = Visit.new @@ -32,13 +33,12 @@ def new end end - # GET /visits/1/edit + # método para editar visitas def edit @visit = Visit.find(params[:id]) end - # POST /visits - # POST /visits.json + # método que crea una visita y la asocia a un lugar determinado def create @visit = Visit.new(params[:visit]) @@ -54,8 +54,7 @@ def create end end - # PUT /visits/1 - # PUT /visits/1.json + # método para actualizar las visitas de un lugar def update @visit = Visit.find(params[:id]) @@ -70,8 +69,7 @@ def update end end - # DELETE /visits/1 - # DELETE /visits/1.json + # método que elimina las visitas de un lugar def destroy @visit = Visit.find(params[:id]) @visit.destroy diff --git a/app/helpers/comentarios_helper.rb b/app/helpers/comentarios_helper.rb new file mode 100644 index 0000000..a8f928b --- /dev/null +++ b/app/helpers/comentarios_helper.rb @@ -0,0 +1,2 @@ +module ComentariosHelper +end diff --git a/app/models/comentario.rb b/app/models/comentario.rb new file mode 100644 index 0000000..bff3005 --- /dev/null +++ b/app/models/comentario.rb @@ -0,0 +1,12 @@ +#Comentario muestra las relaciones de la tabla comentarios en el modelo de datos. +# +# == Relaciones +# +# * Un comentario pertenece a un trip. +# * Un comentario pertenece a un site. +# +class Comentario < ActiveRecord::Base + + belongs_to :site + belongs_to :user +end diff --git a/app/models/site.rb b/app/models/site.rb index 2b2f99a..58a191d 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -1,9 +1,21 @@ +#Site muestra las relaciones de la tabla site en el modelo de datos. +# +# == Relaciones +# +# * Un sitio pertenece a un tipo. +# * Un sitio pertenece a un usuario. +# * Un sitio puede tener muchas visitas. +# * Un sitio puede tener muchos viajes. +# * Un sitio puede tener muchos comentarios. +# * Un sitio tiene una imagen asociada. +# class Site < ActiveRecord::Base belongs_to :type belongs_to :user has_many :visits has_many :trips, :through => :visits has_attached_file :image + has_many :comentarios # Debe estar protegido para evitar accesos indeseados diff --git a/app/models/trip.rb b/app/models/trip.rb index 4ff6d83..7942d82 100644 --- a/app/models/trip.rb +++ b/app/models/trip.rb @@ -1,3 +1,11 @@ +# Trip muestra las relaciones de la tabla trip en el modelo de datos. +# +# == Relaciones +# +# * Un viaje puede tener muchas visitas. +# * Un viaje puede tener muchos sitios. +# * Un viaje pertenece a un usuario. +# class Trip < ActiveRecord::Base belongs_to :user has_many :visits diff --git a/app/models/type.rb b/app/models/type.rb index 2284d1f..5ce49d2 100644 --- a/app/models/type.rb +++ b/app/models/type.rb @@ -1,3 +1,12 @@ +#Type muestra las relaciones de la tabla type en el modelo de datos. +# +# == Relaciones +# +# Tal y como muestra el subitulo anterior, este se define empezando la +# línea con ==. En los títulos debe empezar por =. +# +# * Un type puede tener muchos sitios. +# class Type < ActiveRecord::Base has_many :sites diff --git a/app/models/user.rb b/app/models/user.rb index 35b8159..1cc1ea7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,16 @@ +#User muestra las relaciones de la tabla user en el modelo de datos. +# +# == Relaciones +# +# * Un usuario puede tener muchos sitios. +# * Un usuario puede tener muchos viajes. +# * Un usuario puede tener muchos comentarios. +# class User < ActiveRecord::Base has_many :sites has_many :trips + has_many :comentarios # 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 57546da..c49ad3c 100644 --- a/app/models/visit.rb +++ b/app/models/visit.rb @@ -1,3 +1,10 @@ +#Visit muestra las relaciones de la tabla visit en el modelo de datos. +# +# == Relaciones +# +# * Una visita pertenece a un viaje. +# * Una visita pertenece a un sitio. +# class Visit < ActiveRecord::Base belongs_to :trip belongs_to :site diff --git a/app/views/comentarios/_form.html.erb b/app/views/comentarios/_form.html.erb new file mode 100644 index 0000000..85a0741 --- /dev/null +++ b/app/views/comentarios/_form.html.erb @@ -0,0 +1,30 @@ +<%= form_for(@comentario) do |f| %> + <% if @comentario.errors.any? %> +
+

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

+ + +
+ <% end %> + +
+ <%= f.label :coment %>
+ <%= f.text_area :coment, :maxlength => 240,:rows => 6 %> +
+ +
+ <%= f.label :user_id %>
+ <%= f.number_field :user_id %> +
+
+ <%= f.label :site_id %>
+ <%= f.number_field :site_id %> +
+
+ <%= f.submit %> +
+<% end %> \ No newline at end of file diff --git a/app/views/comentarios/edit.html.erb b/app/views/comentarios/edit.html.erb new file mode 100644 index 0000000..9a8929b --- /dev/null +++ b/app/views/comentarios/edit.html.erb @@ -0,0 +1,6 @@ +

Editing comentario

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

Listing Comentarios

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

New comentario

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

<%= notice %>

+ +

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

+ +

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

+ +

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

+ +<% if @comentario.user == current_user %> + <%= link_to 'Edit', edit_comentario_path(@comentario) %> + <%= link_to 'Destroy', @comentario, confirm: 'Are you sure?', method: :delete %> + <% end %>

+<%= link_to 'Back', site_path(@comentario.site_id) %> \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e4c9e36..af4c813 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,7 +6,11 @@ <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> - + @@ -14,22 +18,56 @@
- <%= f.label :image %>
- <%= f.file_field :image %> + <%= f.label :image_url %>
+ <%= f.text_field :image_url %> +
+
+ <%= f.label :latitud %>
+ <%= f.text_field :latitud %> +
+
+ <%= f.label :longitud %>
+ <%= f.text_field :longitud %> +
+
+ <%= f.label :zoom %>
+ <%= f.text_field :zoom %>
<%= f.submit %>
-<% end %> +<% end %> \ No newline at end of file diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index b8e4cae..d03d4f5 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -6,7 +6,7 @@ - <%= link_to image_tag(site.image.url, :class => 'list_image'), site %> + <%= link_to image_tag(site.image_url, :class => 'list_image'), site %> @@ -14,16 +14,22 @@
<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
+ <% if site.trips.size>0 %> + Incluído en: <%= site.trips.size%> viajes + <% end %> +
<%= (link_to 'Comentarios', site_comentarios_path(site.id)) if (site.comentarios.size > 0) %>
<%= link_to 'Show', site %>
- <% if site.user == current_user %> <%= link_to 'Edit', edit_site_path(site) %>
+ <% if site.user == current_user %> + <%= link_to 'Edit', edit_site_path(site) %>
<%= link_to 'Destroy', site, :confirm => 'Are you sure?', :method => :delete %> - <% end %> + <% end %> + <% end %> diff --git a/app/views/sites/new.html.erb b/app/views/sites/new.html.erb index 2988bdc..1c2b7e1 100644 --- a/app/views/sites/new.html.erb +++ b/app/views/sites/new.html.erb @@ -1,4 +1,30 @@ -

New site

+ + + + +

New site

<%= render 'form' %> diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 01a5417..2172e35 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -2,18 +2,129 @@

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

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

<%= @site.name %>

+ <% if @site.user == current_user %> + <%= link_to 'Edit', edit_site_path(@site) %> +<% end %> + +

Coordenadas: + Latitud: <%= @site.latitud %> + + Longitud <%= @site.longitud %> + + Zoom: <%= @site.zoom %>

<%=sanitize @site.description %>

-

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

- +
+ + + + + + + + + + +
+ + +

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

+ +

Comentarios

+ + + <% @site.comentarios.each do |comentario| %> + +

<%= comentario.user.name if comentario.user%> + : + <%= comentario.coment %> + <% if comentario.user == current_user %> + <%= link_to 'Edit', edit_comentario_path(comentario) %> + <%= link_to 'Destroy', comentario, confirm: 'Are you sure?', method: :delete %> + <% end %>

+ <% end %> + +

Añadir un comentario:

+ <% if current_user %> + <%= form_for ([@site, @comentario]) do |f| %> + <% if @comentario.errors.any? %> +
+

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

+ + +
+ <% end %> + <%= f.number_field :site_id, :value => @site.id, :hidden => true %> + <%= f.number_field :user_id, :value => current_user.id, :hidden => true %> + + <%= f.text_area :coment, :maxlength => 240,:rows => 5 %>
+ <%= f.submit "Añadir comentario" %> + <% end %> + <% else %> + <%= link_to "Login", new_user_session_path %> para comentar: + <% end %> + +

Visitas: <%= @site.visitas %> + <% if @site.trips.size>0 %> + Viajes: <%= @site.trips.size%> + <% end %>
+

-<% if @site.user == current_user %> <%= link_to 'Edit', edit_site_path(@site) %> | <% end %> <%= link_to 'Back', sites_path %> + +<%= link_to 'Back', sites_path %> diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb index 2d69c99..42e9380 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/show.html.erb b/app/views/trips/show.html.erb index 8bced6a..ff12937 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -1,14 +1,78 @@ -

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 %> + <% if @trip.user == current_user %> <%= form_for(@visit, :remote => true) do |f| %> <%= f.number_field :trip_id, :value => @trip.id, :hidden => true %> @@ -24,5 +88,7 @@
- <% if @trip.user == current_user %> <%= link_to 'Edit', edit_trip_path(@trip) %> | <% end %> <%= link_to 'Back', trips_path %> - \ No newline at end of file +<% if @trip.user == current_user %> + <%= link_to 'Edit', edit_trip_path(@trip) %> | +<% end %> +<%= link_to 'Back', trips_path %> diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb index e761359..9f422cc 100644 --- a/app/views/types/index.html.erb +++ b/app/views/types/index.html.erb @@ -1,3 +1,4 @@ +

Listing Types

@@ -10,6 +11,7 @@
<%= link_to type.name, type_sites_path(type) %>
<%= truncate(strip_tags(type.description), :length => 80) %>
+
<%= type.updated_at %>
@@ -25,6 +27,7 @@
+
<%= link_to 'New Type', new_type_path %> diff --git a/app/views/types/ordered_index.html.erb b/app/views/types/ordered_index.html.erb new file mode 100644 index 0000000..a5a6b2c --- /dev/null +++ b/app/views/types/ordered_index.html.erb @@ -0,0 +1,32 @@ + +
+

Listing ordered Types

+ + + <% @types.each do |type| %> + + + + + + + <% end %> +
+
+
<%= link_to type.name, type_sites_path(type) %>
+
<%= truncate(strip_tags(type.description), + :length => 80) %>
+
Ultima modificación: <%= 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..6005a49 100644 --- a/app/views/types/show.html.erb +++ b/app/views/types/show.html.erb @@ -10,6 +10,10 @@ <%= @type.description %>

+

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

<%= link_to 'Edit', edit_type_path(@type) %> | <%= link_to 'Back', types_path %> diff --git a/config/routes.rb b/config/routes.rb index 29d3c86..c20d05c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,15 +1,24 @@ Planet::Application.routes.draw do + resources :comentarios + resources :visits resources :trips devise_for :users - resources :sites + resources :sites do + resources :comentarios + end + + resources :types do # Rutas anidadas /types/id/sites..., resources :sites, :only => [ :index ] # Restringe a acción “index” + collection do + get 'ordered_index' + end end get "planet/index" @@ -18,6 +27,12 @@ get "planet/ejemplo" + get "planet/author" + + get "planet/search" + + get "/doc/app/index" + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/db/migrate/20120415103228_create_comentarios.rb b/db/migrate/20120415103228_create_comentarios.rb new file mode 100644 index 0000000..1f46d24 --- /dev/null +++ b/db/migrate/20120415103228_create_comentarios.rb @@ -0,0 +1,11 @@ +class CreateComentarios < ActiveRecord::Migration + def change + create_table :comentarios do |t| + t.string :coment + t.integer :user_id + t.integer :site_id + + t.timestamps + end + end +end diff --git a/db/migrate/20120420163650_geo_site.rb b/db/migrate/20120420163650_geo_site.rb new file mode 100644 index 0000000..06ec27c --- /dev/null +++ b/db/migrate/20120420163650_geo_site.rb @@ -0,0 +1,29 @@ +class GeoSite < ActiveRecord::Migration + + def up + change_table :sites do |t| + t.column :latitud, :float + end + change_table :sites do |t| + t.column :longitud, :float + end + change_table :sites do |t| + t.column :zoom, :integer + end + end + + def down + change_table :sites do |t| + t.remove :latitud + end + change_table :sites do |t| + t.remove :longitud + end + change_table :sites do |t| + t.remove :zoom + end + end + + + +end diff --git a/db/schema.rb b/db/schema.rb index e6aa66f..24165ab 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,15 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120411160519) do +ActiveRecord::Schema.define(:version => 20120420163650) do + + create_table "comentarios", :force => true do |t| + t.string "coment" + t.integer "user_id" + t.integer "site_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end create_table "sites", :force => true do |t| t.string "name" @@ -26,6 +34,9 @@ t.string "image_file_size" t.datetime "image_updated_at" t.integer "visitas", :default => 0 + t.float "latitud" + t.float "longitud" + t.integer "zoom" end create_table "trips", :force => true do |t| diff --git a/db/seeds.rb b/db/seeds.rb index 2bda1ab..c0f6b1f 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -43,12 +43,18 @@ name: 'Pedriza', description: 'Magnifico valle al norte de Madrid en el Macizo Central', type_id: type2.id, + latitud: '40.751244', + longitud: '-3.893069', + zoom: '15', image_url: 'pedriza.png', image: File.open(File.join(Rails.root, 'app', 'assets','images', 'pedriza.png'), "r")) site1.user_id = user1.id ; site1.save site2 = Site.create!( name: 'Catedral de Florencia', + latitud: '43.773232', + longitud: '11.255992', + zoom: '15', description: 'Catedral de la ciudad de Florencia con la que se inicia el Renacimiento', type_id: type1.id, image_url: 'florencia.png', @@ -57,6 +63,9 @@ site3 = Site.create!( name: 'Jardin de Lineo', + latitud: '59.862222', + longitud: '17.633889', + zoom: '15', 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', @@ -65,6 +74,9 @@ site4 = Site.create!( name: 'Reichstag', + latitud: '52.5186', + longitud: '13.376', + zoom: '15', description: 'Parlamento aleman en la ciudad de Berlin', type_id: type2.id, image_url: 'reichstag.png', @@ -73,6 +85,9 @@ site5 = Site.create!( name: 'Pergamo', + latitud: '52.521111', + longitud: '13.396667', + zoom: '15', description: 'Puerta del mercado de la antigua ciudad griega de Pergamo del museo arquelogico de Berlin', type_id: type3.id, image_url: 'pergamo.png', diff --git a/doc/app/ApplicationController.html b/doc/app/ApplicationController.html index 65ef712..04bd7c9 100644 --- a/doc/app/ApplicationController.html +++ b/doc/app/ApplicationController.html @@ -87,6 +87,12 @@

Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper diff --git a/doc/app/ApplicationHelper.html b/doc/app/ApplicationHelper.html index efcf78f..256ce6c 100644 --- a/doc/app/ApplicationHelper.html +++ b/doc/app/ApplicationHelper.html @@ -81,6 +81,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper diff --git a/doc/app/Comentario.html b/doc/app/Comentario.html new file mode 100644 index 0000000..5254a2f --- /dev/null +++ b/doc/app/Comentario.html @@ -0,0 +1,171 @@ + + + + + + +class Comentario - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Comentario

    + +
    + +

    Comentario muestra las relaciones de la tabla +comentarios en el modelo de datos.

    + +
    == Relaciones
    +
    +* Un comentario pertenece a un trip. 
    +* Un comentario pertenece a un site.
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/ComentariosController.html b/doc/app/ComentariosController.html new file mode 100644 index 0000000..89a91f9 --- /dev/null +++ b/doc/app/ComentariosController.html @@ -0,0 +1,450 @@ + + + + + + +class ComentariosController - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class ComentariosController

    + +
    + +

    ComentariosController es la clase +que aglutina los métodos necesarios para tratar con los comentarios +creados en un determinado sitio

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

    Public Instance Methods

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

    método que crea un nuevo comentario asociado a un determinado sitio

    + + + +
    +
    # File app/controllers/comentarios_controller.rb, line 48
    +def create
    +  @site=Site.find(params[:site_id])
    +  @comentario=@site.comentarios.create(params[:comentario])
    +  @comentario.user_id=current_user.id
    +  
    +  
    +  respond_to do |format|
    +    if @comentario.save
    +      format.html { redirect_to @comentario, notice: 'Comentario was successfully created.' }
    +      format.json { render json: @comentario, status: :created, location: @comentario }
    +    else
    +      format.html { render action: "new" }
    +      format.json { render json: @comentario.errors, status: :unprocessable_entity }
    +    end
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + destroy() + click to toggle source +
    + + +
    + +

    método para eliminar un comentario determinado

    + + + +
    +
    # File app/controllers/comentarios_controller.rb, line 81
    +def destroy
    +  @comentario = current_user.comentarios.find(params[:id]) 
    +  @comentario.destroy
    +
    +  respond_to do |format|
    +    format.html { redirect_to @comentario, notice: 'Comentario was successfully destroyed.' }
    +      format.json { render json: @comentario, status: :created, location: @comentario }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    método que se emplea para editar un nuevo comentario

    + + + +
    +
    # File app/controllers/comentarios_controller.rb, line 43
    +def edit
    +  @comentario = Comentario.find(params[:id])  
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + index() + click to toggle source +
    + + +
    + +

    Método que devuelve todos los comentarios existentes

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

    método que crea un nuevo comentario “vacío”

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

    método que muestra los comentarios correspondientes a un determinado sitio

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

    método empleado para actualizar un comentario

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

    module ComentariosHelper

    + +
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/PlanetController.html b/doc/app/PlanetController.html index e3bde99..1deebcb 100644 --- a/doc/app/PlanetController.html +++ b/doc/app/PlanetController.html @@ -70,12 +70,16 @@

    Methods

    @@ -101,6 +105,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -198,6 +208,35 @@

    Algunos comandos de formateo

    Public Instance Methods

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

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

    + + + +
    +
    # File app/controllers/planet_controller.rb, line 33
    +def author
    +end
    +
    + +
    + + + + +
    + +
    @@ -214,7 +253,7 @@

    Public Instance Methods

    -
    # File app/controllers/planet_controller.rb, line 28
    +            
    # File app/controllers/planet_controller.rb, line 27
     def contact
     end
    @@ -243,7 +282,7 @@

    Public Instance Methods

    -
    # File app/controllers/planet_controller.rb, line 31
    +            
    # File app/controllers/planet_controller.rb, line 30
     def ejemplo
     end
    @@ -272,7 +311,7 @@

    Public Instance Methods

    -
    # File app/controllers/planet_controller.rb, line 25
    +            
    # File app/controllers/planet_controller.rb, line 24
     def index
     end
    @@ -285,6 +324,39 @@

    Public Instance Methods

    + + + diff --git a/doc/app/PlanetHelper.html b/doc/app/PlanetHelper.html index 578d307..2dee8a8 100644 --- a/doc/app/PlanetHelper.html +++ b/doc/app/PlanetHelper.html @@ -81,6 +81,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper diff --git a/doc/app/Site.html b/doc/app/Site.html index 3c8b96c..e322e73 100644 --- a/doc/app/Site.html +++ b/doc/app/Site.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,18 @@

    class Site

    +

    Site muestra las relaciones de la tabla site en el +modelo de datos.

    + +
    == Relaciones
    +
    +* Un sitio pertenece a un tipo. 
    +* Un sitio pertenece a un usuario.
    +* Un sitio puede tener muchas visitas.
    +* Un sitio puede tener muchos viajes.
    +* Un sitio puede tener muchos comentarios.
    +* Un sitio tiene una imagen asociada.
    +
    diff --git a/doc/app/SitesController.html b/doc/app/SitesController.html index c02b5c6..e531376 100644 --- a/doc/app/SitesController.html +++ b/doc/app/SitesController.html @@ -109,6 +109,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -150,6 +156,10 @@

    class SitesController

    +

    SitesController es la clase que aglutina +los métodos necesarios para tratar con los sitios registrados en el +sistema

    +
    @@ -181,12 +191,12 @@

    Public Instance Methods

    -

    POST /sites POST /sites.json

    +

    método necesario para crear un nuevo sitio asignado a un usuario

    -
    # File app/controllers/sites_controller.rb, line 50
    +            
    # File app/controllers/sites_controller.rb, line 53
     def create
       @site = current_user.sites.build(params[:site]) # Asigna solo si sitio asociado a current_user
       
    @@ -221,12 +231,12 @@ 

    Public Instance Methods

    -

    DELETE /sites/1 DELETE /sites/1.json

    +

    método para eleminar los sitios creados por el usuario

    -
    # File app/controllers/sites_controller.rb, line 82
    +            
    # File app/controllers/sites_controller.rb, line 83
     def destroy
       @site = current_user.sites.find(params[:id])  # busca solo en sitios asociados a current_user
       @site.destroy
    @@ -257,12 +267,12 @@ 

    Public Instance Methods

    -

    GET /sites/1/edit

    +

    método para editar un sitio creado con anterioridad

    -
    # File app/controllers/sites_controller.rb, line 44
    +            
    # File app/controllers/sites_controller.rb, line 48
     def edit
       @site = current_user.sites.find(params[:id])  # busca solo en sitios asociados a current_user
     end
    @@ -287,12 +297,12 @@

    Public Instance Methods

    -

    GET /sites GET /sites.json

    +

    método que muestra todos los sitios creados

    -
    # File app/controllers/sites_controller.rb, line 9
    +            
    # File app/controllers/sites_controller.rb, line 13
     def index
       if params[:type_id].nil? or params[:type_id].empty?
         @sites = Site.all            # path: /types
    @@ -325,12 +335,12 @@ 

    Public Instance Methods

    -

    GET /sites/new GET /sites/new.json

    +

    método que crea un nuevo sitio vacío

    -
    # File app/controllers/sites_controller.rb, line 34
    +            
    # File app/controllers/sites_controller.rb, line 38
     def new
       @site = current_user.sites.build # crea sitio vacio asociado a current_user
       
    @@ -360,15 +370,17 @@ 

    Public Instance Methods

    -

    GET /sites/1 GET /sites/1.json

    +

    método que muestra el sitio con un determinado id

    -
    # File app/controllers/sites_controller.rb, line 23
    +            
    # File app/controllers/sites_controller.rb, line 26
     def show
       @site = Site.find(params[:id])
     
    +      @comentario=Comentario.new(:site=>@site)
    +
       respond_to do |format|
         format.html # show.html.erb
         format.json { render json: @site }
    @@ -395,12 +407,12 @@ 

    Public Instance Methods

    -

    PUT /sites/1 PUT /sites/1.json

    +

    método para actualizar sitios creados por un usuario

    -
    # File app/controllers/sites_controller.rb, line 66
    +            
    # File app/controllers/sites_controller.rb, line 68
     def update
       @site = current_user.sites.find(params[:id])  # busca solo en sitios asociados a current_user 
       
    diff --git a/doc/app/SitesHelper.html b/doc/app/SitesHelper.html
    index aa932c6..146bf3e 100644
    --- a/doc/app/SitesHelper.html
    +++ b/doc/app/SitesHelper.html
    @@ -81,6 +81,12 @@ 

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper diff --git a/doc/app/Trip.html b/doc/app/Trip.html index 9a51e94..42eb367 100644 --- a/doc/app/Trip.html +++ b/doc/app/Trip.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,18 @@

    class Trip

    +

    Trip muestra las relaciones de la tabla trip en el +modelo de datos.

    + +

    Relaciones

    +
    • +

      Un viaje puede tener muchas visitas.

      +
    • +

      Un viaje puede tener muchos sitios.

      +
    • +

      Un viaje pertenece a un usuario.

      +
    +
    diff --git a/doc/app/TripsController.html b/doc/app/TripsController.html index abfde19..aae7cd1 100644 --- a/doc/app/TripsController.html +++ b/doc/app/TripsController.html @@ -109,6 +109,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -150,6 +156,9 @@

    class TripsController

    +

    TripsController es la clase que aglutina +los métodos necesarios para tratar con los viajes creados

    +
    @@ -181,7 +190,7 @@

    Public Instance Methods

    -

    POST /trips POST /trips.json

    +

    método para crear un nuevo viaje asociado al usuario actual

    @@ -221,12 +230,12 @@

    Public Instance Methods

    -

    DELETE /trips/1 DELETE /trips/1.json

    +

    método para eliminar un viaje determinado

    -
    # File app/controllers/trips_controller.rb, line 79
    +            
    # File app/controllers/trips_controller.rb, line 77
     def destroy
       @trip = current_user.trips.find(params[:id])
       @trip.destroy
    @@ -257,12 +266,12 @@ 

    Public Instance Methods

    -

    GET /trips/1/edit

    +

    método para editar un viaje

    -
    # File app/controllers/trips_controller.rb, line 41
    +            
    # File app/controllers/trips_controller.rb, line 42
     def edit
       @trip = current_user.trips.find(params[:id])
     end
    @@ -287,12 +296,12 @@

    Public Instance Methods

    -

    GET /trips GET /trips.json

    +

    método que muestra todos los viajes disponibles

    -
    # File app/controllers/trips_controller.rb, line 8
    +            
    # File app/controllers/trips_controller.rb, line 11
     def index
       @trips = Trip.all
     
    @@ -322,12 +331,12 @@ 

    Public Instance Methods

    -

    GET /trips/new GET /trips/new.json

    +

    método que crea un nuevo viaje vacío

    -
    # File app/controllers/trips_controller.rb, line 31
    +            
    # File app/controllers/trips_controller.rb, line 32
     def new
       @trip = current_user.trips.build
       
    @@ -357,12 +366,12 @@ 

    Public Instance Methods

    -

    GET /trips/1 GET /trips/1.json

    +

    método que muestra un determinado viaje

    -
    # File app/controllers/trips_controller.rb, line 19
    +            
    # File app/controllers/trips_controller.rb, line 21
     def show
       @trip = Trip.find(params[:id])
       @visit = @trip.visits.build
    @@ -393,12 +402,12 @@ 

    Public Instance Methods

    -

    PUT /trips/1 PUT /trips/1.json

    +

    método para actualizar un viaje determinado

    -
    # File app/controllers/trips_controller.rb, line 63
    +            
    # File app/controllers/trips_controller.rb, line 62
     def update
       @trip = current_user.trips.find(params[:id])
       
    diff --git a/doc/app/TripsHelper.html b/doc/app/TripsHelper.html
    index 7d08398..b79e648 100644
    --- a/doc/app/TripsHelper.html
    +++ b/doc/app/TripsHelper.html
    @@ -81,6 +81,12 @@ 

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper diff --git a/doc/app/Type.html b/doc/app/Type.html index c9f3a24..1010a33 100644 --- a/doc/app/Type.html +++ b/doc/app/Type.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,16 @@

    class Type

    +

    Type muestra las relaciones de la tabla type en el +modelo de datos.

    + +
    == Relaciones
    +
    +Tal y como muestra el subitulo anterior, este se define empezando la 
    +línea con ==. En los títulos debe empezar por =.
    +
    +* Un type puede tener muchos sitios.
    +
    diff --git a/doc/app/TypesController.html b/doc/app/TypesController.html index e69e052..cbb4ff7 100644 --- a/doc/app/TypesController.html +++ b/doc/app/TypesController.html @@ -80,6 +80,8 @@

    Methods

  • #new +
  • #ordered_index +
  • #show
  • #update @@ -109,6 +111,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -150,6 +158,9 @@

    class TypesController

    +

    TypesController es la clase que aglutina +los métodos necesarios para tratar con las tipos de lugares del sistema

    +
    @@ -181,12 +192,12 @@

    Public Instance Methods

    -

    POST /types POST /types.json

    +

    método que crea nuevo un tipo determinado

    -
    # File app/controllers/types_controller.rb, line 42
    +            
    # File app/controllers/types_controller.rb, line 43
     def create
       @type = Type.new(params[:type])
     
    @@ -221,12 +232,12 @@ 

    Public Instance Methods

    -

    DELETE /types/1 DELETE /types/1.json

    +

    método para eliminar un tipo existente

    -
    # File app/controllers/types_controller.rb, line 74
    +            
    # File app/controllers/types_controller.rb, line 73
     def destroy
       @type = Type.find(params[:id])
       @type.destroy
    @@ -257,12 +268,12 @@ 

    Public Instance Methods

    -

    GET /types/1/edit

    +

    método que edita un tipo creado anteriormente

    -
    # File app/controllers/types_controller.rb, line 36
    +            
    # File app/controllers/types_controller.rb, line 38
     def edit
       @type = Type.find(params[:id])
     end
    @@ -287,12 +298,12 @@

    Public Instance Methods

    -

    GET /types GET /types.json

    +

    método que muestra todos los tipos disponibles

    -
    # File app/controllers/types_controller.rb, line 4
    +            
    # File app/controllers/types_controller.rb, line 8
     def index
       @types = Type.all
     
    @@ -322,12 +333,12 @@ 

    Public Instance Methods

    -

    GET /types/new GET /types/new.json

    +

    método que crea un nuevo tipo vacío

    -
    # File app/controllers/types_controller.rb, line 26
    +            
    # File app/controllers/types_controller.rb, line 28
     def new
       @type = Type.new
     
    @@ -346,6 +357,43 @@ 

    Public Instance Methods

    +
    + +
    + ordered_index() + click to toggle source +
    + + +
    + +

    método que devuelve los tipos ordenados alfabéticamente

    + + + +
    +
    # File app/controllers/types_controller.rb, line 86
    +def ordered_index
    +
    +    @types=Type.find(:all, :order => :name) 
    +
    +  respond_to do |format|
    +    format.html #index.html.erb
    +    format.json { render json: @types}
    +end
    +
    +end
    +
    + +
    + + + + +
    + +
    @@ -357,12 +405,12 @@

    Public Instance Methods

    -

    GET /types/1 GET /types/1.json

    +

    método qeu muestra un determinado tipo creado

    -
    # File app/controllers/types_controller.rb, line 15
    +            
    # File app/controllers/types_controller.rb, line 18
     def show
       @type = Type.find(params[:id])
     
    @@ -392,7 +440,7 @@ 

    Public Instance Methods

    -

    PUT /types/1 PUT /types/1.json

    +

    método que actualiza un tipo creado previamente

    diff --git a/doc/app/TypesHelper.html b/doc/app/TypesHelper.html index d7e732d..7fa0b66 100644 --- a/doc/app/TypesHelper.html +++ b/doc/app/TypesHelper.html @@ -81,6 +81,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper diff --git a/doc/app/User.html b/doc/app/User.html index 5fa3862..436bc89 100644 --- a/doc/app/User.html +++ b/doc/app/User.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,15 @@

    class User

    +

    User muestra las relaciones de la tabla user en el +modelo de datos.

    + +
    == Relaciones
    +
    +* Un usuario puede tener muchos sitios. 
    +* Un usuario puede tener muchos viajes. 
    +* Un usuario puede tener muchos comentarios.
    +
    diff --git a/doc/app/Visit.html b/doc/app/Visit.html index ad56b8f..65babbc 100644 --- a/doc/app/Visit.html +++ b/doc/app/Visit.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,14 @@

    class Visit

    +

    Visit muestra las relaciones de la tabla visit en +el modelo de datos.

    + +
    == Relaciones
    +
    +* Una visita pertenece a un viaje. 
    +* Una visita pertenece a un sitio.
    +
    diff --git a/doc/app/VisitsController.html b/doc/app/VisitsController.html index 00709aa..ee1513f 100644 --- a/doc/app/VisitsController.html +++ b/doc/app/VisitsController.html @@ -109,6 +109,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -150,6 +156,10 @@

    class VisitsController

    +

    VisitsController es la clase que +aglutina los métodos necesarios para tratar con las visitas a un +determinado lugar

    +
    @@ -181,7 +191,7 @@

    Public Instance Methods

    -

    POST /visits POST /visits.json

    +

    método que crea una visita y la asocia a un lugar determinado

    @@ -222,12 +232,12 @@

    Public Instance Methods

    -

    DELETE /visits/1 DELETE /visits/1.json

    +

    método que elimina las visitas de un lugar

    -
    # File app/controllers/visits_controller.rb, line 75
    +            
    # File app/controllers/visits_controller.rb, line 73
     def destroy
       @visit = Visit.find(params[:id])
       @visit.destroy
    @@ -258,12 +268,12 @@ 

    Public Instance Methods

    -

    GET /visits/1/edit

    +

    método para editar visitas

    -
    # File app/controllers/visits_controller.rb, line 36
    +            
    # File app/controllers/visits_controller.rb, line 37
     def edit
       @visit = Visit.find(params[:id])
     end
    @@ -288,12 +298,12 @@

    Public Instance Methods

    -

    GET /visits GET /visits.json

    +

    método que muestra todas las visitas

    -
    # File app/controllers/visits_controller.rb, line 4
    +            
    # File app/controllers/visits_controller.rb, line 7
     def index
       @visits = Visit.all
     
    @@ -323,12 +333,12 @@ 

    Public Instance Methods

    -

    GET /visits/new GET /visits/new.json

    +

    método que crea una nueva visita vacía

    -
    # File app/controllers/visits_controller.rb, line 26
    +            
    # File app/controllers/visits_controller.rb, line 27
     def new
       @visit = Visit.new
     
    @@ -358,12 +368,12 @@ 

    Public Instance Methods

    -

    GET /visits/1 GET /visits/1.json

    +

    método que muestra las visitas de un determinado lugar

    -
    # File app/controllers/visits_controller.rb, line 15
    +            
    # File app/controllers/visits_controller.rb, line 17
     def show
       @visit = Visit.find(params[:id])
     
    @@ -393,12 +403,12 @@ 

    Public Instance Methods

    -

    PUT /visits/1 PUT /visits/1.json

    +

    método para actualizar las visitas de un lugar

    -
    # File app/controllers/visits_controller.rb, line 59
    +            
    # File app/controllers/visits_controller.rb, line 58
     def update
       @visit = Visit.find(params[:id])
     
    diff --git a/doc/app/VisitsHelper.html b/doc/app/VisitsHelper.html
    index 4ff2034..0cd627c 100644
    --- a/doc/app/VisitsHelper.html
    +++ b/doc/app/VisitsHelper.html
    @@ -81,6 +81,12 @@ 

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper diff --git a/doc/app/created.rid b/doc/app/created.rid index 2aaa3ea..3272fb6 100644 --- a/doc/app/created.rid +++ b/doc/app/created.rid @@ -1,19 +1,22 @@ -Mon, 16 Apr 2012 08:53:15 +0200 -doc/README_FOR_APP Sat, 17 Mar 2012 23:42:41 +0100 -app/controllers/application_controller.rb Sat, 17 Mar 2012 23:42:41 +0100 -app/controllers/planet_controller.rb Mon, 16 Apr 2012 08:53:07 +0200 -app/controllers/sites_controller.rb Thu, 12 Apr 2012 11:23:00 +0200 -app/controllers/trips_controller.rb Mon, 09 Apr 2012 17:09:15 +0200 -app/controllers/types_controller.rb Sun, 18 Mar 2012 00:15:37 +0100 -app/controllers/visits_controller.rb Tue, 10 Apr 2012 18:45:27 +0200 -app/helpers/application_helper.rb Sat, 17 Mar 2012 23:42:41 +0100 -app/helpers/planet_helper.rb Sat, 17 Mar 2012 23:48:05 +0100 -app/helpers/sites_helper.rb Tue, 20 Mar 2012 11:01:45 +0100 -app/helpers/trips_helper.rb Mon, 09 Apr 2012 10:57:40 +0200 -app/helpers/types_helper.rb Sun, 18 Mar 2012 00:15:37 +0100 -app/helpers/visits_helper.rb Mon, 09 Apr 2012 17:09:15 +0200 -app/models/site.rb Wed, 11 Apr 2012 13:04:49 +0200 -app/models/trip.rb Mon, 09 Apr 2012 17:09:15 +0200 -app/models/type.rb Wed, 28 Mar 2012 18:02:57 +0200 -app/models/user.rb Mon, 09 Apr 2012 17:09:15 +0200 -app/models/visit.rb Mon, 09 Apr 2012 17:09:15 +0200 +Wed, 25 Apr 2012 23:55:34 +0200 +doc/README_FOR_APP Sun, 15 Apr 2012 12:30:16 +0200 +app/helpers/application_helper.rb Sun, 15 Apr 2012 12:30:16 +0200 +app/helpers/comentarios_helper.rb Sun, 15 Apr 2012 12:32:28 +0200 +app/helpers/visits_helper.rb Sun, 15 Apr 2012 12:30:16 +0200 +app/helpers/trips_helper.rb Sun, 15 Apr 2012 12:30:16 +0200 +app/helpers/planet_helper.rb Sun, 15 Apr 2012 12:30:16 +0200 +app/helpers/types_helper.rb Sun, 15 Apr 2012 12:30:16 +0200 +app/helpers/sites_helper.rb Sun, 15 Apr 2012 12:30:16 +0200 +app/models/visit.rb Wed, 25 Apr 2012 23:55:29 +0200 +app/models/type.rb Wed, 25 Apr 2012 23:55:28 +0200 +app/models/trip.rb Wed, 25 Apr 2012 23:52:37 +0200 +app/models/site.rb Wed, 25 Apr 2012 23:55:30 +0200 +app/models/user.rb Wed, 25 Apr 2012 23:55:28 +0200 +app/models/comentario.rb Wed, 25 Apr 2012 23:55:31 +0200 +app/controllers/application_controller.rb Sun, 15 Apr 2012 12:30:16 +0200 +app/controllers/visits_controller.rb Wed, 25 Apr 2012 19:06:40 +0200 +app/controllers/comentarios_controller.rb Wed, 25 Apr 2012 19:07:28 +0200 +app/controllers/sites_controller.rb Wed, 25 Apr 2012 19:07:18 +0200 +app/controllers/types_controller.rb Wed, 25 Apr 2012 19:07:03 +0200 +app/controllers/trips_controller.rb Wed, 25 Apr 2012 19:07:12 +0200 +app/controllers/planet_controller.rb Wed, 25 Apr 2012 19:27:35 +0200 diff --git a/doc/app/doc/README_FOR_APP.html b/doc/app/doc/README_FOR_APP.html index cfe337b..577df8f 100644 --- a/doc/app/doc/README_FOR_APP.html +++ b/doc/app/doc/README_FOR_APP.html @@ -63,6 +63,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper diff --git a/doc/app/images/add.png b/doc/app/images/add.png old mode 100755 new mode 100644 diff --git a/doc/app/images/delete.png b/doc/app/images/delete.png old mode 100755 new mode 100644 diff --git a/doc/app/images/tag_blue.png b/doc/app/images/tag_blue.png old mode 100755 new mode 100644 diff --git a/doc/app/index.html b/doc/app/index.html index a944adb..8cddd7f 100644 --- a/doc/app/index.html +++ b/doc/app/index.html @@ -63,6 +63,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper diff --git a/doc/app/js/search_index.js b/doc/app/js/search_index.js index f5703f3..fce747a 100644 --- a/doc/app/js/search_index.js +++ b/doc/app/js/search_index.js @@ -1 +1 @@ -var search_data = {"index":{"searchIndex":["applicationcontroller","applicationhelper","planetcontroller","planethelper","site","sitescontroller","siteshelper","trip","tripscontroller","tripshelper","type","typescontroller","typeshelper","user","visit","visitscontroller","visitshelper","contact()","create()","create()","create()","create()","destroy()","destroy()","destroy()","destroy()","edit()","edit()","edit()","edit()","ejemplo()","index()","index()","index()","index()","index()","new()","new()","new()","new()","show()","show()","show()","show()","update()","update()","update()","update()","readme_for_app"],"longSearchIndex":["applicationcontroller","applicationhelper","planetcontroller","planethelper","site","sitescontroller","siteshelper","trip","tripscontroller","tripshelper","type","typescontroller","typeshelper","user","visit","visitscontroller","visitshelper","planetcontroller#contact()","sitescontroller#create()","tripscontroller#create()","typescontroller#create()","visitscontroller#create()","sitescontroller#destroy()","tripscontroller#destroy()","typescontroller#destroy()","visitscontroller#destroy()","sitescontroller#edit()","tripscontroller#edit()","typescontroller#edit()","visitscontroller#edit()","planetcontroller#ejemplo()","planetcontroller#index()","sitescontroller#index()","tripscontroller#index()","typescontroller#index()","visitscontroller#index()","sitescontroller#new()","tripscontroller#new()","typescontroller#new()","visitscontroller#new()","sitescontroller#show()","tripscontroller#show()","typescontroller#show()","visitscontroller#show()","sitescontroller#update()","tripscontroller#update()","typescontroller#update()","visitscontroller#update()",""],"info":[["ApplicationController","","ApplicationController.html","",""],["ApplicationHelper","","ApplicationHelper.html","",""],["PlanetController","","PlanetController.html","","

    PlanetController ilustra el uso de RDoc. La documentación\nde un proyecto en genera en el directorio …\n"],["PlanetHelper","","PlanetHelper.html","",""],["Site","","Site.html","",""],["SitesController","","SitesController.html","",""],["SitesHelper","","SitesHelper.html","",""],["Trip","","Trip.html","",""],["TripsController","","TripsController.html","",""],["TripsHelper","","TripsHelper.html","",""],["Type","","Type.html","",""],["TypesController","","TypesController.html","",""],["TypesHelper","","TypesHelper.html","",""],["User","","User.html","",""],["Visit","","Visit.html","",""],["VisitsController","","VisitsController.html","",""],["VisitsHelper","","VisitsHelper.html","",""],["contact","PlanetController","PlanetController.html#method-i-contact","()","

    Método que define una acción vacía del controlador\n"],["create","SitesController","SitesController.html#method-i-create","()","

    POST /sites POST /sites.json\n"],["create","TripsController","TripsController.html#method-i-create","()","

    POST /trips POST /trips.json\n"],["create","TypesController","TypesController.html#method-i-create","()","

    POST /types POST /types.json\n"],["create","VisitsController","VisitsController.html#method-i-create","()","

    POST /visits POST /visits.json\n"],["destroy","SitesController","SitesController.html#method-i-destroy","()","

    DELETE /sites/1 DELETE /sites/1.json\n"],["destroy","TripsController","TripsController.html#method-i-destroy","()","

    DELETE /trips/1 DELETE /trips/1.json\n"],["destroy","TypesController","TypesController.html#method-i-destroy","()","

    DELETE /types/1 DELETE /types/1.json\n"],["destroy","VisitsController","VisitsController.html#method-i-destroy","()","

    DELETE /visits/1 DELETE /visits/1.json\n"],["edit","SitesController","SitesController.html#method-i-edit","()","

    GET /sites/1/edit\n"],["edit","TripsController","TripsController.html#method-i-edit","()","

    GET /trips/1/edit\n"],["edit","TypesController","TypesController.html#method-i-edit","()","

    GET /types/1/edit\n"],["edit","VisitsController","VisitsController.html#method-i-edit","()","

    GET /visits/1/edit\n"],["ejemplo","PlanetController","PlanetController.html#method-i-ejemplo","()","

    Método que define una acción vacía del controlador\n"],["index","PlanetController","PlanetController.html#method-i-index","()","

    Método que define una acción vacía del controlador\n"],["index","SitesController","SitesController.html#method-i-index","()","

    GET /sites GET /sites.json\n"],["index","TripsController","TripsController.html#method-i-index","()","

    GET /trips GET /trips.json\n"],["index","TypesController","TypesController.html#method-i-index","()","

    GET /types GET /types.json\n"],["index","VisitsController","VisitsController.html#method-i-index","()","

    GET /visits GET /visits.json\n"],["new","SitesController","SitesController.html#method-i-new","()","

    GET /sites/new GET /sites/new.json\n"],["new","TripsController","TripsController.html#method-i-new","()","

    GET /trips/new GET /trips/new.json\n"],["new","TypesController","TypesController.html#method-i-new","()","

    GET /types/new GET /types/new.json\n"],["new","VisitsController","VisitsController.html#method-i-new","()","

    GET /visits/new GET /visits/new.json\n"],["show","SitesController","SitesController.html#method-i-show","()","

    GET /sites/1 GET /sites/1.json\n"],["show","TripsController","TripsController.html#method-i-show","()","

    GET /trips/1 GET /trips/1.json\n"],["show","TypesController","TypesController.html#method-i-show","()","

    GET /types/1 GET /types/1.json\n"],["show","VisitsController","VisitsController.html#method-i-show","()","

    GET /visits/1 GET /visits/1.json\n"],["update","SitesController","SitesController.html#method-i-update","()","

    PUT /sites/1 PUT /sites/1.json\n"],["update","TripsController","TripsController.html#method-i-update","()","

    PUT /trips/1 PUT /trips/1.json\n"],["update","TypesController","TypesController.html#method-i-update","()","

    PUT /types/1 PUT /types/1.json\n"],["update","VisitsController","VisitsController.html#method-i-update","()","

    PUT /visits/1 PUT /visits/1.json\n"],["README_FOR_APP","","doc/README_FOR_APP.html","","

    Use this README file to introduce your application and point to useful\nplaces in the API for learning …\n"]]}} \ No newline at end of file +var search_data = {"index":{"searchIndex":["applicationcontroller","applicationhelper","comentario","comentarioscontroller","comentarioshelper","planetcontroller","planethelper","site","sitescontroller","siteshelper","trip","tripscontroller","tripshelper","type","typescontroller","typeshelper","user","visit","visitscontroller","visitshelper","author()","contact()","create()","create()","create()","create()","create()","destroy()","destroy()","destroy()","destroy()","destroy()","edit()","edit()","edit()","edit()","edit()","ejemplo()","index()","index()","index()","index()","index()","index()","new()","new()","new()","new()","new()","ordered_index()","search()","show()","show()","show()","show()","show()","update()","update()","update()","update()","update()","readme_for_app"],"longSearchIndex":["applicationcontroller","applicationhelper","comentario","comentarioscontroller","comentarioshelper","planetcontroller","planethelper","site","sitescontroller","siteshelper","trip","tripscontroller","tripshelper","type","typescontroller","typeshelper","user","visit","visitscontroller","visitshelper","planetcontroller#author()","planetcontroller#contact()","comentarioscontroller#create()","sitescontroller#create()","tripscontroller#create()","typescontroller#create()","visitscontroller#create()","comentarioscontroller#destroy()","sitescontroller#destroy()","tripscontroller#destroy()","typescontroller#destroy()","visitscontroller#destroy()","comentarioscontroller#edit()","sitescontroller#edit()","tripscontroller#edit()","typescontroller#edit()","visitscontroller#edit()","planetcontroller#ejemplo()","comentarioscontroller#index()","planetcontroller#index()","sitescontroller#index()","tripscontroller#index()","typescontroller#index()","visitscontroller#index()","comentarioscontroller#new()","sitescontroller#new()","tripscontroller#new()","typescontroller#new()","visitscontroller#new()","typescontroller#ordered_index()","planetcontroller#search()","comentarioscontroller#show()","sitescontroller#show()","tripscontroller#show()","typescontroller#show()","visitscontroller#show()","comentarioscontroller#update()","sitescontroller#update()","tripscontroller#update()","typescontroller#update()","visitscontroller#update()",""],"info":[["ApplicationController","","ApplicationController.html","",""],["ApplicationHelper","","ApplicationHelper.html","",""],["Comentario","","Comentario.html","","

    Comentario muestra las relaciones de la tabla comentarios en el modelo de\ndatos.\n\n

    == Relaciones\n\n* Un comentario ...
    \n"],["ComentariosController","","ComentariosController.html","","

    ComentariosController es la clase que aglutina los métodos necesarios para\ntratar con los comentarios …\n"],["ComentariosHelper","","ComentariosHelper.html","",""],["PlanetController","","PlanetController.html","","

    PlanetController ilustra el uso de RDoc. La documentación\nde un proyecto en genera en el directorio …\n"],["PlanetHelper","","PlanetHelper.html","",""],["Site","","Site.html","","

    Site muestra las relaciones de la tabla site en el modelo de datos.\n\n

    == Relaciones\n\n* Un sitio pertenece ...
    \n"],["SitesController","","SitesController.html","","

    SitesController es la clase que aglutina los métodos necesarios para\ntratar con los sitios registrados …\n"],["SitesHelper","","SitesHelper.html","",""],["Trip","","Trip.html","","

    Trip muestra las relaciones de la tabla trip en el modelo de datos.\n

    Relaciones\n

    Un viaje puede tener muchas …\n"],["TripsController","","TripsController.html","","

    TripsController es la clase que aglutina los métodos necesarios para\ntratar con los viajes creados\n"],["TripsHelper","","TripsHelper.html","",""],["Type","","Type.html","","

    Type muestra las relaciones de la tabla type en el modelo de datos.\n\n

    == Relaciones\n\nTal y como muestra ...
    \n"],["TypesController","","TypesController.html","","

    TypesController es la clase que aglutina los métodos necesarios para\ntratar con las tipos de lugares …\n"],["TypesHelper","","TypesHelper.html","",""],["User","","User.html","","

    User muestra las relaciones de la tabla user en el modelo de datos.\n\n

    == Relaciones\n\n* Un usuario puede ...
    \n"],["Visit","","Visit.html","","

    Visit muestra las relaciones de la tabla visit en el modelo de datos.\n\n

    == Relaciones\n\n* Una visita pertenece ...
    \n"],["VisitsController","","VisitsController.html","","

    VisitsController es la clase que aglutina los métodos necesarios para\ntratar con las visitas a un determinado …\n"],["VisitsHelper","","VisitsHelper.html","",""],["author","PlanetController","PlanetController.html#method-i-author","()","

    Método que define una acción vacía del controlador\n"],["contact","PlanetController","PlanetController.html#method-i-contact","()","

    Método que define una acción vacía del controlador\n"],["create","ComentariosController","ComentariosController.html#method-i-create","()","

    método que crea un nuevo comentario asociado a un determinado sitio\n"],["create","SitesController","SitesController.html#method-i-create","()","

    método necesario para crear un nuevo sitio asignado a un usuario\n"],["create","TripsController","TripsController.html#method-i-create","()","

    método para crear un nuevo viaje asociado al usuario actual\n"],["create","TypesController","TypesController.html#method-i-create","()","

    método que crea nuevo un tipo determinado\n"],["create","VisitsController","VisitsController.html#method-i-create","()","

    método que crea una visita y la asocia a un lugar determinado\n"],["destroy","ComentariosController","ComentariosController.html#method-i-destroy","()","

    método para eliminar un comentario determinado\n"],["destroy","SitesController","SitesController.html#method-i-destroy","()","

    método para eleminar los sitios creados por el usuario\n"],["destroy","TripsController","TripsController.html#method-i-destroy","()","

    método para eliminar un viaje determinado\n"],["destroy","TypesController","TypesController.html#method-i-destroy","()","

    método para eliminar un tipo existente\n"],["destroy","VisitsController","VisitsController.html#method-i-destroy","()","

    método que elimina las visitas de un lugar\n"],["edit","ComentariosController","ComentariosController.html#method-i-edit","()","

    método que se emplea para editar un nuevo comentario\n"],["edit","SitesController","SitesController.html#method-i-edit","()","

    método para editar un sitio creado con anterioridad\n"],["edit","TripsController","TripsController.html#method-i-edit","()","

    método para editar un viaje\n"],["edit","TypesController","TypesController.html#method-i-edit","()","

    método que edita un tipo creado anteriormente\n"],["edit","VisitsController","VisitsController.html#method-i-edit","()","

    método para editar visitas\n"],["ejemplo","PlanetController","PlanetController.html#method-i-ejemplo","()","

    Método que define una acción vacía del controlador\n"],["index","ComentariosController","ComentariosController.html#method-i-index","()","

    Método que devuelve todos los comentarios existentes\n"],["index","PlanetController","PlanetController.html#method-i-index","()","

    Método que define una acción vacía del controlador\n"],["index","SitesController","SitesController.html#method-i-index","()","

    método que muestra todos los sitios creados\n"],["index","TripsController","TripsController.html#method-i-index","()","

    método que muestra todos los viajes disponibles\n"],["index","TypesController","TypesController.html#method-i-index","()","

    método que muestra todos los tipos disponibles\n"],["index","VisitsController","VisitsController.html#method-i-index","()","

    método que muestra todas las visitas\n"],["new","ComentariosController","ComentariosController.html#method-i-new","()","

    método que crea un nuevo comentario “vacío”\n"],["new","SitesController","SitesController.html#method-i-new","()","

    método que crea un nuevo sitio vacío\n"],["new","TripsController","TripsController.html#method-i-new","()","

    método que crea un nuevo viaje vacío\n"],["new","TypesController","TypesController.html#method-i-new","()","

    método que crea un nuevo tipo vacío\n"],["new","VisitsController","VisitsController.html#method-i-new","()","

    método que crea una nueva visita vacía\n"],["ordered_index","TypesController","TypesController.html#method-i-ordered_index","()","

    método que devuelve los tipos ordenados alfabéticamente\n"],["search","PlanetController","PlanetController.html#method-i-search","()","

    Método que define la acción de buscar en el controlador\n"],["show","ComentariosController","ComentariosController.html#method-i-show","()","

    método que muestra los comentarios correspondientes a un determinado sitio\n"],["show","SitesController","SitesController.html#method-i-show","()","

    método que muestra el sitio con un determinado id\n"],["show","TripsController","TripsController.html#method-i-show","()","

    método que muestra un determinado viaje\n"],["show","TypesController","TypesController.html#method-i-show","()","

    método qeu muestra un determinado tipo creado\n"],["show","VisitsController","VisitsController.html#method-i-show","()","

    método que muestra las visitas de un determinado lugar\n"],["update","ComentariosController","ComentariosController.html#method-i-update","()","

    método empleado para actualizar un comentario\n"],["update","SitesController","SitesController.html#method-i-update","()","

    método para actualizar sitios creados por un usuario\n"],["update","TripsController","TripsController.html#method-i-update","()","

    método para actualizar un viaje determinado\n"],["update","TypesController","TypesController.html#method-i-update","()","

    método que actualiza un tipo creado previamente\n"],["update","VisitsController","VisitsController.html#method-i-update","()","

    método para actualizar las visitas de un lugar\n"],["README_FOR_APP","","doc/README_FOR_APP.html","","

    Use this README file to introduce your application and point to useful\nplaces in the API for learning …\n"]]}} \ No newline at end of file diff --git a/doc/app/table_of_contents.html b/doc/app/table_of_contents.html index cf87ce4..cf6643c 100644 --- a/doc/app/table_of_contents.html +++ b/doc/app/table_of_contents.html @@ -38,6 +38,15 @@

    Classes/Modules

  • ApplicationHelper +
  • +
  • + Comentario +
  • +
  • + ComentariosController +
  • +
  • + ComentariosHelper
  • PlanetController @@ -61,6 +70,11 @@

    Classes/Modules

  • Trip + + +
  • TripsController @@ -95,68 +109,88 @@

    Classes/Modules

    Methods

    diff --git a/public/images/la_pedriza_19.JPG b/public/images/la_pedriza_19.JPG new file mode 100644 index 0000000..0c46ee8 Binary files /dev/null and b/public/images/la_pedriza_19.JPG differ diff --git a/test/fixtures/comentarios.yml b/test/fixtures/comentarios.yml new file mode 100644 index 0000000..e7e2ac9 --- /dev/null +++ b/test/fixtures/comentarios.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + coment: MyString + user_id: 1 + site_id: 1 + +two: + coment: MyString + user_id: 1 + site_id: 1 diff --git a/test/functional/comentarios_controller_test.rb b/test/functional/comentarios_controller_test.rb new file mode 100644 index 0000000..2c09333 --- /dev/null +++ b/test/functional/comentarios_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class ComentariosControllerTest < ActionController::TestCase + setup do + @comentario = comentarios(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:comentarios) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create comentario" do + assert_difference('Comentario.count') do + post :create, comentario: @comentario.attributes + end + + assert_redirected_to comentario_path(assigns(:comentario)) + end + + test "should show comentario" do + get :show, id: @comentario + assert_response :success + end + + test "should get edit" do + get :edit, id: @comentario + assert_response :success + end + + test "should update comentario" do + put :update, id: @comentario, comentario: @comentario.attributes + assert_redirected_to comentario_path(assigns(:comentario)) + end + + test "should destroy comentario" do + assert_difference('Comentario.count', -1) do + delete :destroy, id: @comentario + end + + assert_redirected_to comentarios_path + end +end diff --git a/test/functional/planet_controller_test.rb b/test/functional/planet_controller_test.rb index ce15d1b..6541e20 100644 --- a/test/functional/planet_controller_test.rb +++ b/test/functional/planet_controller_test.rb @@ -12,4 +12,9 @@ class PlanetControllerTest < ActionController::TestCase assert_response :success end + test "should get search" do + get :search + assert_response :success + end + end diff --git a/test/unit/comentario_test.rb b/test/unit/comentario_test.rb new file mode 100644 index 0000000..02f982d --- /dev/null +++ b/test/unit/comentario_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ComentarioTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/comentarios_helper_test.rb b/test/unit/helpers/comentarios_helper_test.rb new file mode 100644 index 0000000..d553eef --- /dev/null +++ b/test/unit/helpers/comentarios_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ComentariosHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/planet_controller_test.rb b/test/unit/helpers/planet_controller_test.rb new file mode 100644 index 0000000..360ca02 --- /dev/null +++ b/test/unit/helpers/planet_controller_test.rb @@ -0,0 +1,28 @@ +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 ejemplo" do + get:ejemplo + assert_response:success + end + + + test "should get author" do + get:author + assert_response:success + end + + +end