diff --git a/Gemfile b/Gemfile index b0be4dd..36747b1 100644 --- a/Gemfile +++ b/Gemfile @@ -5,14 +5,7 @@ gem 'rails', '3.2.2' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' -group :development do - gem 'sqlite3' -end - -group :production do - gem 'pg' -end - +gem 'sqlite3' gem 'devise' diff --git a/Gemfile.lock b/Gemfile.lock index 3b96e7c..6247569 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -62,12 +62,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) + paperclip (3.0.2) + activemodel (>= 3.0.0) + activerecord (>= 3.0.0) + activesupport (>= 3.0.0) cocaine (>= 0.0.2) mime-types - pg (0.13.2) polyglot (0.3.3) rack (1.4.1) rack-cache (1.2) @@ -125,7 +125,6 @@ DEPENDENCIES devise jquery-rails paperclip - pg rails (= 3.2.2) sass-rails (~> 3.2.3) sqlite3 diff --git a/app/assets/images/auto1.jpeg b/app/assets/images/auto1.jpeg new file mode 100644 index 0000000..9d0c91e Binary files /dev/null and b/app/assets/images/auto1.jpeg differ diff --git a/app/assets/images/auto2.jpg b/app/assets/images/auto2.jpg new file mode 100644 index 0000000..da21cb9 Binary files /dev/null and b/app/assets/images/auto2.jpg differ diff --git a/app/assets/images/beachflag.png b/app/assets/images/beachflag.png new file mode 100644 index 0000000..6e6ad4e Binary files /dev/null and b/app/assets/images/beachflag.png differ diff --git a/app/assets/images/coliseo.png b/app/assets/images/coliseo.png new file mode 100644 index 0000000..c63097e Binary files /dev/null and b/app/assets/images/coliseo.png 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/application.css b/app/assets/stylesheets/application.css index 50d53e3..8689609 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -12,3 +12,12 @@ *= require cleditor *= require_tree . */ + + +#container{} +#enla1{} +#enla1 a{color:blue;} +#cuerpo{} + + + diff --git a/app/assets/stylesheets/author.css.scss b/app/assets/stylesheets/author.css.scss new file mode 100644 index 0000000..d2d9d7e --- /dev/null +++ b/app/assets/stylesheets/author.css.scss @@ -0,0 +1,4 @@ +#espa{background-color:green;color:green;} +.autor1{} +#espacio{background-color:blue;color:blue;} +.autor2{} 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..c6334b0 100644 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -161,9 +161,3 @@ font-weight: bold; margin-right: 2em; } - - -#main .visitas { - text-indent: 70%; -} - diff --git a/app/assets/stylesheets/sites.css.scss b/app/assets/stylesheets/sites.css.scss index 682e55c..1aacaa7 100644 --- a/app/assets/stylesheets/sites.css.scss +++ b/app/assets/stylesheets/sites.css.scss @@ -1,3 +1,6 @@ // Place all the styles related to the sites controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ + +#comentarios a{font-weight:bold;color:red;} + diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e8065d9..089a1f8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# Controlador de la aplicacion. +# class ApplicationController < ActionController::Base protect_from_forgery end diff --git a/app/controllers/comentarios_controller.rb b/app/controllers/comentarios_controller.rb new file mode 100644 index 0000000..b1f46bb --- /dev/null +++ b/app/controllers/comentarios_controller.rb @@ -0,0 +1,87 @@ +# Controlador de los comentarios donde se definen sus metodos +# +class ComentariosController < ApplicationController + +before_filter :authenticate_user! + + # GET /comentarios + # GET /comentarios.json + def index + @comentarios = Comentario.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @comentarios } + end + end + + # GET /comentarios/1 + # GET /comentarios/1.json + def show + @comentario = Comentario.find(params[:id]) + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comentario } + end + end + + # GET /comentarios/new + # GET /comentarios/new.json + def new + @comentario = Comentario.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @comentario } + end + end + + # GET /comentarios/1/edit + def edit + @comentario = Comentario.find(params[:id]) + end + + # POST /comentarios + # POST /comentarios.json + def create + @comentario = Comentario.new(params[:comentario]) + + respond_to do |format| + if @comentario.save + format.html { redirect_to @comentario, notice: 'Comentario was successfully created.' } + format.json { render json: @comentario, status: :created, location: @comentario } + else + format.html { render action: "new" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # PUT /comentarios/1 + # PUT /comentarios/1.json + def update + @comentario = Comentario.find(params[:id]) + + respond_to do |format| + if @comentario.update_attributes(params[:comentario]) + format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comentarios/1 + # DELETE /comentarios/1.json + def destroy + @comentario = Comentario.find(params[:id]) + @comentario.destroy + + respond_to do |format| + format.html { redirect_to comentarios_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/planet_controller.rb b/app/controllers/planet_controller.rb index a8636bd..5fe3d1d 100644 --- a/app/controllers/planet_controller.rb +++ b/app/controllers/planet_controller.rb @@ -29,5 +29,17 @@ 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 realiza la busqueda de sitios y viajes + def search + if params[:q].length >= 3 + @sites = Site.where("name like ? OR description like ?", "%#{params[:q]}%", "%#{params[:q]}%") + @trips = Trip.where("name like ? OR description like ?", "%#{params[:q]}%", "%#{params[:q]}%") + else + render action: "busquedaincorrecta" + end + end + end diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 57e0611..18a06b9 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -1,9 +1,12 @@ +# Controlador de los sitios donde se definen sus metodos +# 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 - + after_filter :count_visita, :only => :show + + # GET /sites # GET /sites.json def index @@ -17,12 +20,21 @@ def index format.json { render json: @sites } end end + # GET + # GET /sites.json + def id + @sites = Visit.find(params[:user_id]).sites # path: /types/id/sites + 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]) - + @comentarios = @site.comentarios respond_to do |format| format.html # show.html.erb format.json { render json: @site } @@ -88,8 +100,8 @@ def destroy format.json { head :no_content } end end - - private +private + #Incrementa visita cuando se accede al sitio def count_visita @site.increment!(:visitas) end diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 321f6e3..82a9d00 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -1,3 +1,5 @@ +# Controlador de los viajes donde se definen sus metodos +# class TripsController < ApplicationController # authenticate_user! ejecuta acción solo si sesión existe diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb index da826f4..62c5386 100644 --- a/app/controllers/types_controller.rb +++ b/app/controllers/types_controller.rb @@ -1,4 +1,17 @@ +# Controlador de los tipos donde se definen sus metodos +# class TypesController < ApplicationController + + # GET /types/ordered_index + # GET /types.json + def ordered_index + @types = Type.find(:all, :order => :name) + respond_to do |format| + format.html # ordered_index.html.erb + format.json { render json: @types } + end + end + # GET /types # GET /types.json def index diff --git a/app/controllers/visits_controller.rb b/app/controllers/visits_controller.rb index 5bd5366..d15a0c0 100644 --- a/app/controllers/visits_controller.rb +++ b/app/controllers/visits_controller.rb @@ -1,3 +1,5 @@ +# Controlador de las visitas donde se definen sus metodos +# class VisitsController < ApplicationController # GET /visits # GET /visits.json @@ -45,7 +47,6 @@ def create 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" } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..fb8e690 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,4 @@ +# Helper de la clase Application +# module ApplicationHelper end diff --git a/app/helpers/comentarios_helper.rb b/app/helpers/comentarios_helper.rb new file mode 100644 index 0000000..020d33a --- /dev/null +++ b/app/helpers/comentarios_helper.rb @@ -0,0 +1,4 @@ +# Helper de la clase Comentarios +# +module ComentariosHelper +end diff --git a/app/helpers/planet_helper.rb b/app/helpers/planet_helper.rb index 5bbc197..3e30c2d 100644 --- a/app/helpers/planet_helper.rb +++ b/app/helpers/planet_helper.rb @@ -1,2 +1,4 @@ +# Helper de la clase Planet +# module PlanetHelper end diff --git a/app/helpers/sites_helper.rb b/app/helpers/sites_helper.rb index 621069d..e532277 100644 --- a/app/helpers/sites_helper.rb +++ b/app/helpers/sites_helper.rb @@ -1,2 +1,3 @@ +# Helper de la clase Sites module SitesHelper end diff --git a/app/helpers/trips_helper.rb b/app/helpers/trips_helper.rb index 04f333d..45b8bd1 100644 --- a/app/helpers/trips_helper.rb +++ b/app/helpers/trips_helper.rb @@ -1,2 +1,4 @@ +# Helper de la clase Trips +# module TripsHelper end diff --git a/app/helpers/types_helper.rb b/app/helpers/types_helper.rb index 40a2b9e..2189db9 100644 --- a/app/helpers/types_helper.rb +++ b/app/helpers/types_helper.rb @@ -1,2 +1,4 @@ +# Helper de la clase Types +# module TypesHelper end diff --git a/app/helpers/visits_helper.rb b/app/helpers/visits_helper.rb index 8ce5f83..8f7335f 100644 --- a/app/helpers/visits_helper.rb +++ b/app/helpers/visits_helper.rb @@ -1,2 +1,4 @@ +# Helper de la clase Visit +# module VisitsHelper end diff --git a/app/models/comentario.rb b/app/models/comentario.rb new file mode 100644 index 0000000..aa9018c --- /dev/null +++ b/app/models/comentario.rb @@ -0,0 +1,11 @@ +# Se definen las relaciones de la clase Comentario +# +class Comentario < ActiveRecord::Base +belongs_to :user +belongs_to :site + +validates :coment, :site_id, :user_id, :length => {:maximum => 240}, :presence => true +# Debe estar protegido para evitar accesos indeseados + #attr_protected :user_id + +end diff --git a/app/models/site.rb b/app/models/site.rb index 2b2f99a..9d64122 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -1,8 +1,11 @@ +# Se definen las relaciones de la clase Site +# 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 :comentarios has_attached_file :image @@ -10,5 +13,5 @@ class Site < ActiveRecord::Base attr_protected :user_id # Se añaden estas definiciones - validates :name, :type_id, :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 4ff6d83..c1b10cb 100644 --- a/app/models/trip.rb +++ b/app/models/trip.rb @@ -1,3 +1,5 @@ +# Se definen las relaciones de la clase Trip +# class Trip < ActiveRecord::Base belongs_to :user has_many :visits diff --git a/app/models/type.rb b/app/models/type.rb index 2284d1f..46025f9 100644 --- a/app/models/type.rb +++ b/app/models/type.rb @@ -1,3 +1,5 @@ +# Se definen las relaciones de la clase Type +# class Type < ActiveRecord::Base has_many :sites diff --git a/app/models/user.rb b/app/models/user.rb index 35b8159..b6c080d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,17 @@ +# Se definen las relaciones de la clase User +# class User < ActiveRecord::Base + # Include default devise modules. Others available are: + # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable + + # Setup accessible (or protected) attributes for your model + attr_accessible :email, :password, :password_confirmation, :remember_me 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..d0d7e0f 100644 --- a/app/models/visit.rb +++ b/app/models/visit.rb @@ -1,3 +1,5 @@ +# Se definen las relaciones de la clase Visit +# 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..59a35a4 --- /dev/null +++ b/app/views/comentarios/_form.html.erb @@ -0,0 +1,29 @@ +<%= 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_field :coment %> +
+
+ <%= f.label :user_id %>
+ <%= f.number_field :user_id %> +
+
+ <%= f.label :site_id %>
+ <%= f.number_field :site_id %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/comentarios/edit.html.erb b/app/views/comentarios/edit.html.erb new file mode 100644 index 0000000..e6754dc --- /dev/null +++ b/app/views/comentarios/edit.html.erb @@ -0,0 +1,8 @@ +# Vista de edicion de los comentarios +# +

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..2fe3f3f --- /dev/null +++ b/app/views/comentarios/index.html.erb @@ -0,0 +1,29 @@ +

Listing comentarios

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

New comentario

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

<%= notice %>

+ +

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

+ +

+ User: + <%= @comentario.user_id %> +

+ +

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

+ + +<%= link_to 'Edit', edit_comentario_path(@comentario) %> | +<%= link_to 'Back', comentarios_path %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e4c9e36..ada4bd3 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,7 +6,11 @@ <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> - + @@ -14,7 +18,18 @@ - \ No newline at end of file + + diff --git a/app/views/planet/author.css b/app/views/planet/author.css new file mode 100644 index 0000000..7e75248 --- /dev/null +++ b/app/views/planet/author.css @@ -0,0 +1,4 @@ + +.autor1{color:red;clear:both;float:left; margin:300;background-color:#fc0;text-align:center;} +.autor2{float:right;margin-left:600;background-color:#0cf;padding: 5px} +.container{ margin-left:30;} diff --git a/app/views/planet/author.html.erb b/app/views/planet/author.html.erb new file mode 100644 index 0000000..2f38299 --- /dev/null +++ b/app/views/planet/author.html.erb @@ -0,0 +1,43 @@ + + + + + + +
+

Autores

+

sepa

+
+
+
+

Nombre:


+

Direccion postal:


+

Direccion electronica:


+ +<%= image_tag('auto1.jpeg') %> + +

Curriculum:

+ +
+

+
+

separacion

+

+
+
+

Nombre:


+

Direccion postal:


+

Direccion electronica:


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

Curriculum:

+ +
+
+ + diff --git a/app/views/planet/busquedaincorrecta.html.erb b/app/views/planet/busquedaincorrecta.html.erb new file mode 100644 index 0000000..f48f54e --- /dev/null +++ b/app/views/planet/busquedaincorrecta.html.erb @@ -0,0 +1 @@ +Introduzca al menos 3 caracteres diff --git a/app/views/planet/search.html.erb b/app/views/planet/search.html.erb new file mode 100644 index 0000000..864930f --- /dev/null +++ b/app/views/planet/search.html.erb @@ -0,0 +1,77 @@ +
+

Sitios encontrados

+ + + <% @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.comentarios.empty? == false %> + <%= link_to "Comentarios", comentarios_path %> + <%end%>
+<% if site.trips.size>0 %> + Incluido en: <%= site.trips.size%> viajes
+ <% 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 %> +
+
+ +
+<%= @sites.length %><%=" Results found."%> + +
+

Viajes encontrados

+ + + <% if @trips %> + <% @trips.each do |trip| %> + + + + + + + <% end %> + <% 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 %> +
+
+<%= @trips.length %><%=" Results found."%> + diff --git a/app/views/sites/_form.html.erb b/app/views/sites/_form.html.erb index f1fd754..0698fe0 100644 --- a/app/views/sites/_form.html.erb +++ b/app/views/sites/_form.html.erb @@ -2,7 +2,6 @@ <% if @site.errors.any? %>

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

-
+
+ <%= f.label :latitud %>
+ <%= f.text_field :latitud %> +
+
+ <%= f.label :longitud %>
+ <%= f.text_field :longitud %> +
+
+ <%= f.label :zoom %>
+ <%= f.text_field :zoom %> +
<%= f.label :image %>
<%= f.file_field :image %> diff --git a/app/views/sites/_form2.html.erb b/app/views/sites/_form2.html.erb new file mode 100644 index 0000000..e50dc30 --- /dev/null +++ b/app/views/sites/_form2.html.erb @@ -0,0 +1,10 @@ +<%= form_for([@site, @site.comentarios.create(:user_id=>current_user,:site_id=>@site)]) do |f| %> +
+
+
+ <%= f.text_area :coment , :rows => 4 %> +
+
+ <%= f.submit "nuevo comentario"%> +
+<% end %> diff --git a/app/views/sites/a b/app/views/sites/a new file mode 100644 index 0000000..f8f4a6b --- /dev/null +++ b/app/views/sites/a @@ -0,0 +1,29 @@ + + +
+ + + +version con pruebas y modificada, pero parece que no entiende el script...solo el formulario + + + + +
+ +
+ diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index b8e4cae..e539162 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -15,20 +15,31 @@
<%= truncate(strip_tags(site.description), :length => 80) %>
+
+ <% if site.comentarios.empty? == false %> + <%= link_to "Comentarios", comentarios_path %> + <%end%>
+<% if site.trips.size>0 %> + Incluido en: <%= site.trips.size%> viajes
+ <% end %> +
- + <%= 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 %>
- +
-<%= link_to 'New site', new_site_path %> \ No newline at end of file + +<%= link_to 'New site', new_site_path %> diff --git a/app/views/sites/new.html.erb b/app/views/sites/new.html.erb index 2988bdc..4613583 100644 --- a/app/views/sites/new.html.erb +++ b/app/views/sites/new.html.erb @@ -1,5 +1,26 @@ + +

New site

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

Listing Sites

+ + + <% @sites.each do |site| %> + + + + + + + + + <% end %> +
+ <%= link_to image_tag(site.image_url, :class => 'list_image'), site %> + +
+
<%= link_to site.name, site %>
+
<%= truncate(strip_tags(site.description), + :length => 80) %>
+
+
+ <%= link_to 'Show', site %>
+ <% if site.user == current_user %> + <%= link_to 'Edit', edit_site_path(site) %>
+ <%= link_to 'Destroy', site, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %> + <% if !site.comentarios.empty? %> + <%= link_to 'Comments', site_comentarios_path(params[:site_id] = site.id) if site.comentarios %> + <% 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 01a5417..70ab0d8 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -1,6 +1,62 @@ -
+ + + +
+

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

+ +
+
<%= image_tag(@site.image.url, :class => 'site_image') %> @@ -8,12 +64,35 @@

<%=sanitize @site.description %>

-

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

-
+

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

+ +

Comentarios: +<% @site.comentarios.each do |coment| %> +

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

+<% end %> +

Añada su comentario

+<%= render 'form2' %>
+ Sitio incluido en: <%= @site.trips.size%> viajes
Visitas: <%= @site.visitas %>

-<% 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 2d69c99..d7abf6c 100644 --- a/app/views/trips/_trip.html.erb +++ b/app/views/trips/_trip.html.erb @@ -19,7 +19,7 @@ <%= link_to 'Show', visit.site %>
<%= link_to 'Destroy', visit, :confirm => 'Are you sure?', - :method => :delete if trip.user == current_user %> + :method => :delete if @trip.user == current_user %> diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 8bced6a..544a6e8 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -1,28 +1 @@ -

Name: <%= @trip.name %>

Date: <%= @trip.date %>

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

-

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

-
- -

Sitios a visitar

- - <%= render(@trip) %> - - <% if @trip.user == current_user %> - <%= form_for(@visit, :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 %> - \ No newline at end of file +

Name: <%= @trip.name %>

Date: <%= @trip.date %>

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

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

Sitios a visitar

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

<% if @trip.user == current_user %> <%= link_to 'Edit', edit_trip_path(@trip) %> | <% end %> <%= link_to 'Back', trips_path %> \ No newline at end of file diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb index e761359..58b77d3 100644 --- a/app/views/types/index.html.erb +++ b/app/views/types/index.html.erb @@ -1,3 +1,4 @@ +

Listing Types

@@ -18,13 +19,17 @@ <%= link_to 'Edit', edit_type_path(type) %>
<%= link_to 'Destroy', type, :confirm => 'Are you sure?', - :method => :delete %> + :method => :delete %>
+ <%= type.updated_at%> <% end %>
+ +
<%= 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..d490ea9 --- /dev/null +++ b/app/views/types/ordered_index.html.erb @@ -0,0 +1,26 @@ +

Ordering types

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

- +<%= @type.updated_at%>
<%= link_to 'Edit', edit_type_path(@type) %> | <%= link_to 'Back', types_path %> diff --git a/config/application.rb b/config/application.rb index d40bd35..4e469b2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -56,8 +56,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 + # 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 29d3c86..13f4536 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,23 +1,47 @@ Planet::Application.routes.draw do + + + + get "types/ordered_index" + + get "comentarios/index" + resources :visits + + resources :types + + resources :comentarios resources :trips devise_for :users - - resources :sites + + resources :sites resources :types do # Rutas anidadas /types/id/sites..., resources :sites, :only => [ :index ] # Restringe a acción “index” end + resources :sites do + resources :comentarios + end + get "planet/index" get "planet/contact" get "planet/ejemplo" + get "planet/author" + + get "planet/search" + + get "doc/app" + + + + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/db/migrate/20120320100145_create_sites.rb b/db/migrate/20120320100145_create_sites.rb index 823209a..f2bebbe 100644 --- a/db/migrate/20120320100145_create_sites.rb +++ b/db/migrate/20120320100145_create_sites.rb @@ -5,7 +5,7 @@ def change t.text :description t.integer :type_id t.string :image_url - + t.timestamps end end diff --git a/db/migrate/20120411202857_create_comentarios.rb b/db/migrate/20120411202857_create_comentarios.rb new file mode 100644 index 0000000..1f46d24 --- /dev/null +++ b/db/migrate/20120411202857_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/20120417155420_site_gelocation.rb b/db/migrate/20120417155420_site_gelocation.rb new file mode 100644 index 0000000..3756717 --- /dev/null +++ b/db/migrate/20120417155420_site_gelocation.rb @@ -0,0 +1,18 @@ +class SiteGelocation < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :latitud, :decimal + t.column :longitud, :decimal + t.column :zoom, :decimal + end +end + + def down + change_table :sites do |t| + t.remove :latitud, :decimal + t.remove :longitud, :decimal + t.remove :zoom, :decimal + end + + end +end diff --git a/db/schema.rb b/db/schema.rb index e6aa66f..09dc13f 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 => 20120417155420) 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.decimal "latitud" + t.decimal "longitud" + t.decimal "zoom" end create_table "trips", :force => true do |t| diff --git a/db:migrate b/db:migrate new file mode 100644 index 0000000..e69de29 diff --git a/doc/app/ApplicationController.html b/doc/app/ApplicationController.html index 65ef712..494e2b0 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 @@ -128,6 +134,8 @@

    class ApplicationController

    +

    Controlador de la aplicacion.

    +
    diff --git a/doc/app/ApplicationHelper.html b/doc/app/ApplicationHelper.html index efcf78f..261fcb1 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 @@ -122,6 +128,8 @@

    module ApplicationHelper

    +

    Helper de la clase Application

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

    class Comentario

    + +
    + +

    Se definen las relaciones de la clase Comentario

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

    class ComentariosController

    + +
    + +

    Controlador de los comentarios donde se definen sus metodos

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

    Public Instance Methods

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

    POST /comentarios POST /comentarios.json

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

    DELETE /comentarios/1 DELETE /comentarios/1.json

    + + + +
    +
    # File app/controllers/comentarios_controller.rb, line 78
    +def destroy
    +  @comentario = Comentario.find(params[:id])
    +  @comentario.destroy
    +
    +  respond_to do |format|
    +    format.html { redirect_to comentarios_url }
    +    format.json { head :no_content }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + edit() + click to toggle source +
    + + +
    + +

    GET /comentarios/1/edit

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

    GET /comentarios GET /comentarios.json

    + + + +
    +
    # File app/controllers/comentarios_controller.rb, line 9
    +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 +
    + + +
    + +

    GET /comentarios/new GET /comentarios/new.json

    + + + +
    +
    # File app/controllers/comentarios_controller.rb, line 30
    +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 +
    + + +
    + +

    GET /comentarios/1 GET /comentarios/1.json

    + + + +
    +
    # File app/controllers/comentarios_controller.rb, line 20
    +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 +
    + + +
    + +

    PUT /comentarios/1 PUT /comentarios/1.json

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

    module ComentariosHelper

    + +
    + +

    Helper de la clase Comentarios

    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/PlanetController.html b/doc/app/PlanetController.html index e3bde99..7c6b29d 100644 --- a/doc/app/PlanetController.html +++ b/doc/app/PlanetController.html @@ -70,12 +70,18 @@

    Methods

    @@ -101,6 +107,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comentario + +
  • ComentariosController + +
  • ComentariosHelper +
  • PlanetController
  • PlanetHelper @@ -198,6 +210,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 +255,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 +284,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 +313,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 +326,75 @@

    Public Instance Methods

    + + + +
    + +
    + search2() + click to toggle source +
    + + +
    + +

    Método que realiza la busqueda de sitios y viajes

    + + + +
    +
    # File app/controllers/planet_controller.rb, line 45
    +  def search2
    +  if params[:query]
    +    @sites = Site.search(params[:query])
    +  else
    +    @products = []
    +  end
    +end
    +
    + +
    + + + + +
    + + diff --git a/doc/app/PlanetHelper.html b/doc/app/PlanetHelper.html index 578d307..73f7809 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 @@ -122,6 +128,8 @@

    module PlanetHelper

    +

    Helper de la clase Planet

    +
    diff --git a/doc/app/Site.html b/doc/app/Site.html index 3c8b96c..3e843e2 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,8 @@

    class Site

    +

    Se definen las relaciones de la clase Site

    +
    diff --git a/doc/app/SitesController.html b/doc/app/SitesController.html index c02b5c6..9c0fa11 100644 --- a/doc/app/SitesController.html +++ b/doc/app/SitesController.html @@ -76,6 +76,8 @@

    Methods

  • #edit +
  • #id +
  • #index
  • #new @@ -109,6 +111,12 @@

    Class and Module Index

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

    class SitesController

    +

    Controlador de los sitios donde se definen sus metodos

    +
    @@ -186,7 +196,7 @@

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

    -
    # File app/controllers/sites_controller.rb, line 44
    +            
    # File app/controllers/sites_controller.rb, line 55
     def edit
       @site = current_user.sites.find(params[:id])  # busca solo en sitios asociados a current_user
     end
    @@ -276,6 +286,40 @@

    Public Instance Methods

    +
    + +
    + id() + click to toggle source +
    + + +
    + +

    GET GET /sites.json

    + + + +
    +
    # File app/controllers/sites_controller.rb, line 24
    +def id
    +    @sites = Visit.find(params[:user_id]).sites  # path: /types/id/sites
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @sites }
    +  end
    +end
    +
    + +
    + + + + +
    + +
    @@ -292,7 +336,7 @@

    Public Instance Methods

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

    Public Instance Methods

    -
    # File app/controllers/sites_controller.rb, line 34
    +            
    # File app/controllers/sites_controller.rb, line 45
     def new
       @site = current_user.sites.build # crea sitio vacio asociado a current_user
       
    @@ -365,10 +409,10 @@ 

    Public Instance Methods

    -
    # File app/controllers/sites_controller.rb, line 23
    +            
    # File app/controllers/sites_controller.rb, line 34
     def show
       @site = Site.find(params[:id])
    -
    +  @comentarios = @site.comentarios
       respond_to do |format|
         format.html # show.html.erb
         format.json { render json: @site }
    @@ -400,7 +444,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/sites_controller.rb, line 66
    +            
    # File app/controllers/sites_controller.rb, line 77
     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..0103e79 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 @@ -122,6 +128,8 @@

    module SitesHelper

    +

    Helper de la clase Sites

    +
    diff --git a/doc/app/Trip.html b/doc/app/Trip.html index 9a51e94..44679cb 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,8 @@

    class Trip

    +

    Se definen las relaciones de la clase Trip

    +
    diff --git a/doc/app/TripsController.html b/doc/app/TripsController.html index abfde19..c295c9b 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,8 @@

    class TripsController

    +

    Controlador de los viajes donde se definen sus metodos

    +
    @@ -186,7 +194,7 @@

    Public Instance Methods

    -
    # File app/controllers/trips_controller.rb, line 47
    +            
    # File app/controllers/trips_controller.rb, line 49
     def create
       @trip = current_user.trips.build(params[:trip])
     
    @@ -226,7 +234,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/trips_controller.rb, line 79
    +            
    # File app/controllers/trips_controller.rb, line 81
     def destroy
       @trip = current_user.trips.find(params[:id])
       @trip.destroy
    @@ -262,7 +270,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/trips_controller.rb, line 41
    +            
    # File app/controllers/trips_controller.rb, line 43
     def edit
       @trip = current_user.trips.find(params[:id])
     end
    @@ -292,7 +300,7 @@

    Public Instance Methods

    -
    # File app/controllers/trips_controller.rb, line 8
    +            
    # File app/controllers/trips_controller.rb, line 10
     def index
       @trips = Trip.all
     
    @@ -327,7 +335,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/trips_controller.rb, line 31
    +            
    # File app/controllers/trips_controller.rb, line 33
     def new
       @trip = current_user.trips.build
       
    @@ -362,7 +370,7 @@ 

    Public Instance Methods

    -
    # 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
    @@ -398,7 +406,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/trips_controller.rb, line 63
    +            
    # File app/controllers/trips_controller.rb, line 65
     def update
       @trip = current_user.trips.find(params[:id])
       
    diff --git a/doc/app/TripsHelper.html b/doc/app/TripsHelper.html
    index 7d08398..a77cb56 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 @@ -122,6 +128,8 @@

    module TripsHelper

    +

    Helper de la clase Trips

    +
    diff --git a/doc/app/Type.html b/doc/app/Type.html index c9f3a24..f595aa9 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,8 @@

    class Type

    +

    Se definen las relaciones de la clase Type

    +
    diff --git a/doc/app/TypesController.html b/doc/app/TypesController.html index e69e052..c28714f 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,8 @@

    class TypesController

    +

    Controlador de los tipos donde se definen sus metodos

    +
    @@ -186,7 +196,7 @@

    Public Instance Methods

    -
    # File app/controllers/types_controller.rb, line 42
    +            
    # File app/controllers/types_controller.rb, line 55
     def create
       @type = Type.new(params[:type])
     
    @@ -226,7 +236,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/types_controller.rb, line 74
    +            
    # File app/controllers/types_controller.rb, line 87
     def destroy
       @type = Type.find(params[:id])
       @type.destroy
    @@ -262,7 +272,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/types_controller.rb, line 36
    +            
    # File app/controllers/types_controller.rb, line 49
     def edit
       @type = Type.find(params[:id])
     end
    @@ -292,7 +302,7 @@

    Public Instance Methods

    -
    # File app/controllers/types_controller.rb, line 4
    +            
    # File app/controllers/types_controller.rb, line 17
     def index
       @types = Type.all
     
    @@ -327,7 +337,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/types_controller.rb, line 26
    +            
    # File app/controllers/types_controller.rb, line 39
     def new
       @type = Type.new
     
    @@ -346,6 +356,40 @@ 

    Public Instance Methods

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

    GET /types/ordered_index GET /types.json

    + + + +
    +
    # File app/controllers/types_controller.rb, line 7
    +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
    +
    + +
    + + + + +
    + +
    @@ -362,7 +406,7 @@

    Public Instance Methods

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

    Public Instance Methods

    -
    # File app/controllers/types_controller.rb, line 58
    +            
    # File app/controllers/types_controller.rb, line 71
     def update
       @type = Type.find(params[:id])
     
    diff --git a/doc/app/TypesHelper.html b/doc/app/TypesHelper.html
    index d7e732d..051290a 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 @@ -122,6 +128,8 @@

    module TypesHelper

    +

    Helper de la clase Types

    +
    diff --git a/doc/app/User.html b/doc/app/User.html index 5fa3862..26f5b3c 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,8 @@

    class User

    +

    Se definen las relaciones de la clase User

    +
    diff --git a/doc/app/Visit.html b/doc/app/Visit.html index ad56b8f..89c3204 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,8 @@

    class Visit

    +

    Se definen las relaciones de la clase Visit

    +
    diff --git a/doc/app/VisitsController.html b/doc/app/VisitsController.html index 00709aa..1d69d9e 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,8 @@

    class VisitsController

    +

    Controlador de las visitas donde se definen sus metodos

    +
    @@ -186,14 +194,13 @@

    Public Instance Methods

    -
    # File app/controllers/visits_controller.rb, line 42
    +            
    # File app/controllers/visits_controller.rb, line 44
     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" }
    @@ -227,7 +234,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/visits_controller.rb, line 75
    +            
    # File app/controllers/visits_controller.rb, line 76
     def destroy
       @visit = Visit.find(params[:id])
       @visit.destroy
    @@ -263,7 +270,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/visits_controller.rb, line 36
    +            
    # File app/controllers/visits_controller.rb, line 38
     def edit
       @visit = Visit.find(params[:id])
     end
    @@ -293,7 +300,7 @@

    Public Instance Methods

    -
    # File app/controllers/visits_controller.rb, line 4
    +            
    # File app/controllers/visits_controller.rb, line 6
     def index
       @visits = Visit.all
     
    @@ -328,7 +335,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/visits_controller.rb, line 26
    +            
    # File app/controllers/visits_controller.rb, line 28
     def new
       @visit = Visit.new
     
    @@ -363,7 +370,7 @@ 

    Public Instance Methods

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

    Public Instance Methods

    -
    # File app/controllers/visits_controller.rb, line 59
    +            
    # File app/controllers/visits_controller.rb, line 60
     def update
       @visit = Visit.find(params[:id])
     
    diff --git a/doc/app/VisitsHelper.html b/doc/app/VisitsHelper.html
    index 4ff2034..ecfed7a 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 @@ -122,6 +128,8 @@

    module VisitsHelper

    +

    Helper de la clase Visit

    +
    diff --git a/doc/app/created.rid b/doc/app/created.rid index 2aaa3ea..235e973 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 +Sun, 22 Apr 2012 16:20:16 +0200 +doc/README_FOR_APP Sat, 24 Mar 2012 15:42:45 +0100 +app/models/user.rb Sun, 22 Apr 2012 15:23:49 +0200 +app/models/trip.rb Sun, 22 Apr 2012 15:23:26 +0200 +app/models/site.rb Sun, 22 Apr 2012 15:23:12 +0200 +app/models/type.rb Sun, 22 Apr 2012 15:23:38 +0200 +app/models/visit.rb Sun, 22 Apr 2012 15:23:57 +0200 +app/models/comentario.rb Sun, 22 Apr 2012 15:23:02 +0200 +app/controllers/planet_controller.rb Sun, 22 Apr 2012 16:20:11 +0200 +app/controllers/trips_controller.rb Sun, 22 Apr 2012 15:17:19 +0200 +app/controllers/sites_controller.rb Sun, 22 Apr 2012 16:18:37 +0200 +app/controllers/visits_controller.rb Sun, 22 Apr 2012 15:17:36 +0200 +app/controllers/application_controller.rb Sun, 22 Apr 2012 15:17:08 +0200 +app/controllers/types_controller.rb Sun, 22 Apr 2012 15:17:28 +0200 +app/controllers/comentarios_controller.rb Sun, 22 Apr 2012 15:17:07 +0200 +app/helpers/application_helper.rb Sun, 22 Apr 2012 15:53:53 +0200 +app/helpers/visits_helper.rb Sun, 22 Apr 2012 15:44:06 +0200 +app/helpers/planet_helper.rb Sun, 22 Apr 2012 15:51:26 +0200 +app/helpers/types_helper.rb Sun, 22 Apr 2012 15:53:33 +0200 +app/helpers/comentarios_helper.rb Sun, 22 Apr 2012 15:47:37 +0200 +app/helpers/trips_helper.rb Sun, 22 Apr 2012 15:51:45 +0200 +app/helpers/sites_helper.rb Sun, 22 Apr 2012 15:51:36 +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..d5809f5 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()","id()","index()","index()","index()","index()","index()","index()","new()","new()","new()","new()","new()","ordered_index()","search()","search2()","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()","sitescontroller#id()","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()","planetcontroller#search2()","comentarioscontroller#show()","sitescontroller#show()","tripscontroller#show()","typescontroller#show()","visitscontroller#show()","comentarioscontroller#update()","sitescontroller#update()","tripscontroller#update()","typescontroller#update()","visitscontroller#update()",""],"info":[["ApplicationController","","ApplicationController.html","","

    Controlador de la aplicacion.\n"],["ApplicationHelper","","ApplicationHelper.html","","

    Helper de la clase Application\n"],["Comentario","","Comentario.html","","

    Se definen las relaciones de la clase Comentario\n"],["ComentariosController","","ComentariosController.html","","

    Controlador de los comentarios donde se definen sus metodos\n"],["ComentariosHelper","","ComentariosHelper.html","","

    Helper de la clase Comentarios\n"],["PlanetController","","PlanetController.html","","

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

    Helper de la clase Planet\n"],["Site","","Site.html","","

    Se definen las relaciones de la clase Site\n"],["SitesController","","SitesController.html","","

    Controlador de los sitios donde se definen sus metodos\n"],["SitesHelper","","SitesHelper.html","","

    Helper de la clase Sites\n"],["Trip","","Trip.html","","

    Se definen las relaciones de la clase Trip\n"],["TripsController","","TripsController.html","","

    Controlador de los viajes donde se definen sus metodos\n"],["TripsHelper","","TripsHelper.html","","

    Helper de la clase Trips\n"],["Type","","Type.html","","

    Se definen las relaciones de la clase Type\n"],["TypesController","","TypesController.html","","

    Controlador de los tipos donde se definen sus metodos\n"],["TypesHelper","","TypesHelper.html","","

    Helper de la clase Types\n"],["User","","User.html","","

    Se definen las relaciones de la clase User\n"],["Visit","","Visit.html","","

    Se definen las relaciones de la clase Visit\n"],["VisitsController","","VisitsController.html","","

    Controlador de las visitas donde se definen sus metodos\n"],["VisitsHelper","","VisitsHelper.html","","

    Helper de la clase Visit\n"],["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","()","

    POST /comentarios POST /comentarios.json\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","ComentariosController","ComentariosController.html#method-i-destroy","()","

    DELETE /comentarios/1 DELETE /comentarios/1.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","ComentariosController","ComentariosController.html#method-i-edit","()","

    GET /comentarios/1/edit\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"],["id","SitesController","SitesController.html#method-i-id","()","

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

    GET /comentarios GET /comentarios.json\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","ComentariosController","ComentariosController.html#method-i-new","()","

    GET /comentarios/new GET /comentarios/new.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"],["ordered_index","TypesController","TypesController.html#method-i-ordered_index","()","

    GET /types/ordered_index GET /types.json\n"],["search","PlanetController","PlanetController.html#method-i-search","()","

    Método que realiza la busqueda de sitios y viajes\n"],["search2","PlanetController","PlanetController.html#method-i-search2","()","

    Método que realiza la busqueda de sitios y viajes\n"],["show","ComentariosController","ComentariosController.html#method-i-show","()","

    GET /comentarios/1 GET /comentarios/1.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","ComentariosController","ComentariosController.html#method-i-update","()","

    PUT /comentarios/1 PUT /comentarios/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 diff --git a/doc/app/table_of_contents.html b/doc/app/table_of_contents.html index cf87ce4..a8c62aa 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 @@ -95,68 +104,92 @@

    Classes/Modules

    Methods

    diff --git a/rails b/rails new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/comentarios.yml b/test/fixtures/comentarios.yml new file mode 100644 index 0000000..afe66ca --- /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: one + site_id: one + +two: + coment: MyString2 + user_id: two + site_id: two diff --git a/test/fixtures/sites.yml b/test/fixtures/sites.yml index cb608cb..ba01a5e 100644 --- a/test/fixtures/sites.yml +++ b/test/fixtures/sites.yml @@ -8,9 +8,11 @@ one: user: one two: - name: MyString - description: MyText - type: one - image_url: MyString - user: one + name: YourString + description: YourText + type: two + image_url: YourString + user: two + + diff --git a/test/fixtures/trips.yml b/test/fixtures/trips.yml index 90f5513..c9c445d 100644 --- a/test/fixtures/trips.yml +++ b/test/fixtures/trips.yml @@ -7,7 +7,8 @@ one: user: one two: - name: MyString - description: MyText + name: YourString + description: YourText date: 2012-04-09 - user: one + user: two + diff --git a/test/fixtures/types.yml b/test/fixtures/types.yml index 8683ea9..bf3a571 100644 --- a/test/fixtures/types.yml +++ b/test/fixtures/types.yml @@ -5,8 +5,17 @@ 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” -# 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 +naturaleza: + name: Naturaleza + description: “Lugar al aire libre de interés natural” diff --git a/test/fixtures/visits.yml b/test/fixtures/visits.yml index 16afbe6..22d3657 100644 --- a/test/fixtures/visits.yml +++ b/test/fixtures/visits.yml @@ -6,6 +6,6 @@ one: hour: 9 two: - trip: one - site: one + trip: two + site: two hour: 9 diff --git a/test/functional/comentarios_controller_test.rb b/test/functional/comentarios_controller_test.rb new file mode 100644 index 0000000..1f09bae --- /dev/null +++ b/test/functional/comentarios_controller_test.rb @@ -0,0 +1,54 @@ +require 'test_helper' + +class ComentariosControllerTest < ActionController::TestCase + setup do + @comentario = comentarios(:one) + @update = { # @update: parametros diferentes + :coment => 'AnotherComent' + } + @user = users(:one) + sign_in @user + 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..f0b1054 100644 --- a/test/functional/planet_controller_test.rb +++ b/test/functional/planet_controller_test.rb @@ -12,4 +12,14 @@ class PlanetControllerTest < ActionController::TestCase 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 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