diff --git a/Gemfile b/Gemfile index ec2ba7b..6c09448 100644 --- a/Gemfile +++ b/Gemfile @@ -2,16 +2,19 @@ source 'https://rubygems.org' gem 'rails', '3.2.2' + gem 'execjs' + gem 'therubyracer' + # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' +gem 'sqlite3' +#group :development, :test do +# gem 'sqlite3' +#end -group :development, :test do - gem 'sqlite3' -end - -group :production do - gem 'pg' -end +#group :production do +# gem 'pg' +#end gem 'devise' @@ -47,5 +50,5 @@ gem 'paperclip' # To use debugger # gem 'ruby-debug19', :require => 'ruby-debug' -gem 'json', '1.6.5' +# gem 'json', '1.6.5' diff --git a/Gemfile.lock b/Gemfile.lock index fd905dc..f11e3d2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,13 +54,14 @@ GEM jquery-rails (2.0.2) railties (>= 3.2.0, < 5.0) thor (~> 0.14) - json (1.6.5) + json (1.6.6) + libv8 (3.3.10.4) mail (2.4.4) i18n (>= 0.4.0) 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) @@ -68,7 +69,6 @@ GEM 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) @@ -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,9 @@ GEM hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.5) + sqlite3 (1.3.6) + therubyracer (0.10.1) + libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) @@ -124,11 +126,11 @@ DEPENDENCIES cleditor_rails coffee-rails (~> 3.2.1) devise + execjs jquery-rails - json (= 1.6.5) paperclip - pg rails (= 3.2.2) sass-rails (~> 3.2.3) sqlite3 + therubyracer uglifier (>= 1.0.3) diff --git a/app/assets/images/antonio.jpg b/app/assets/images/antonio.jpg new file mode 100644 index 0000000..ee737ce Binary files /dev/null and b/app/assets/images/antonio.jpg differ diff --git a/app/assets/images/favicon.ico b/app/assets/images/favicon.ico new file mode 100644 index 0000000..2536afa Binary files /dev/null and b/app/assets/images/favicon.ico differ diff --git a/app/assets/images/fer.jpg b/app/assets/images/fer.jpg new file mode 100644 index 0000000..137c3fb Binary files /dev/null and b/app/assets/images/fer.jpg differ diff --git a/app/assets/javascripts/comments.js.coffee b/app/assets/javascripts/comments.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/comments.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/comments.css.scss b/app/assets/stylesheets/comments.css.scss new file mode 100644 index 0000000..3722c12 --- /dev/null +++ b/app/assets/stylesheets/comments.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the comments controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/planet.css b/app/assets/stylesheets/planet.css index ead053a..5eec4d0 100644 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -93,6 +93,15 @@ background: #446; } +#subirArriba { + float: right; +} + +#bs{ +margin-top: 2em; +width: 86px; +} + #main { margin-left: 9em; /* Ajuste de borde izquierdo */ padding-top: 4ex; diff --git a/app/assets/stylesheets/planet.css~ b/app/assets/stylesheets/planet.css~ new file mode 100644 index 0000000..ead053a --- /dev/null +++ b/app/assets/stylesheets/planet.css~ @@ -0,0 +1,169 @@ +/* Global styles (no utilizados de momento) */ + +#planet #notice { + color: #000; + border: 2px solid red; + padding: 1em; + margin-bottom: 2em; + background-color: #f0f0f0; + font: bold smaller sans-serif; +} + + +#planet h1 { + font: 150% sans-serif; + color: #226; + border-bottom: 3px dotted #77d; +} + +/* Styles for products/index */ + +#site_list table { + border-collapse: collapse; +} + +#site_list table tr td { + padding: 5px; + vertical-align: top; +} + +#site_list .list_image { + width: 60px; + height: 70px; +} + +#site_list .list_description { + width: 60%; +} + +#site_list .list_description dl { + margin: 0; +} + +#site_list .list_description dt { + color: #244; + font-weight: bold; + font-size: larger; +} + +#site_list .list_description dd { + margin: 0; +} + +#site_list .list_actions { + font-size: x-small; + text-align: right; + padding-left: 1em; +} + +#site_list .list_line_even { + background: #a8b8f8; +} + +#site_list .list_line_odd { + background: #88b0f8; +} + + +/* START:mainlayout */ +/* Styles for main page */ + +#banner { + background: #668; + padding-top: 10px; + padding-bottom: 10px; + border-bottom: 2px solid; + font: small-caps 40px/40px "Times New Roman", serif; + color: #bfb; + text-align: center; +} + +#banner img { + float: left; + padding-left: 10px; +} + +#banner .user { + float: right; + color: #bfb; + font-size: small; +} + +#columns { + background: #446; +} + +#main { + margin-left: 9em; /* Ajuste de borde izquierdo */ + padding-top: 4ex; + padding-left: 2em; + background: white; +} + +#side { + float: left; + padding-top: 1em; + padding-left: 1em; + padding-bottom: 1em; + width: 8em; /* Ajuste de borde izquierdo */ + background: #446; +} + +#side a { + color: #bfb; + font-size: small; +} +/* END:mainlayout */ + +/* An entry in the store catalog (no utilizados de momento) */ + +#planet .entry { + overflow: auto; + margin-top: 1em; + border-bottom: 1px dotted #77d; +} + +#planet .name { + font-size: 120%; + font-family: sans-serif; +} + +#store .entry img { + width: 80px; + margin-right: 5px; + margin-bottom: 5px; + float: left; +} + + +#store .entry h3 { + margin-top: 0; + margin-bottom: 2px; + color: #227; +} + +#store .entry p { + margin-top: 0.5em; + margin-bottom: 0.8em; +} + +#store .entry .price_line { + clear: both; + margin-bottom: 0.5em; +} + +#store .entry .add_to_cart { + position: relative; +} + +#store .entry .price { + color: #44a; + font-weight: bold; + margin-right: 2em; +} + + +#main .visitas { + text-indent: 70%; +} + diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e8065d9..ac9622a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,6 @@ +# == En esta clase +# [clase ApplicationController] Definimos instrucción para posibles ataques al servidor. class ApplicationController < ActionController::Base + protect_from_forgery end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb new file mode 100644 index 0000000..6cde408 --- /dev/null +++ b/app/controllers/comments_controller.rb @@ -0,0 +1,97 @@ +# Clase Ruby que hereda de +ApplicationController+. +# Cuando la aplicación reciba una petición referente a comentarios, la ruta determina qué controlador y acción realizar. +# == Métodos para controlador comentarios +# * index +# * show +# * new +# * edit +# * create +# * update +# * destroy +class CommentsController < ApplicationController + # GET /comments + # GET /comments.json + def index #gestiona las rutas anidadas + if params[:site_id].nil? or params[:site_id].empty? + @comments = Comment.all # path: /comment + else + @comments = Site.find(params[:site_id]).comments # path: /sites/id/comments + end + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @comments } + end + end + + # GET /comments/1 + # GET /comments/1.json + def show + @comment = Comment.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comment } + end + end + + # GET /comments/new + # GET /comments/new.json + def new + @comment = current_user.comments.build # crea comentario vacío asociado a current_user + respond_to do |format| + format.html # new.html.erb + format.json { render json: @comment } + end + end + + # GET /comments/1/edit + def edit + @comment = current_user.comments.find(params[:id]) + @site = @comment.site + end + + # POST /comments + # POST /comments.json + def create + @comment = current_user.comments.build(params[:comment]) + + respond_to do |format| + if @comment.save + format.html { redirect_to @comment, notice: 'Comment was successfully created.' } + format.json { render json: @comment, status: :created, location: @comment } + else + format.html { render action: "new" } + format.json { render json: @comment.errors, status: :unprocessable_entity } + end + end + end + + # PUT /comments/1 + # PUT /comments/1.json + def update + @comment = current_user.comments.find(params[:id]) + + respond_to do |format| + if @comment.update_attributes(params[:comment]) + format.html { redirect_to @comment, notice: 'Comment was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comment.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comments/1 + # DELETE /comments/1.json + def destroy + @comment = Comment.find(params[:id]) + @comment.destroy + + respond_to do |format| + format.html { redirect_to comments_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/comments_controller.rb~ b/app/controllers/comments_controller.rb~ new file mode 100644 index 0000000..2d0f2f0 --- /dev/null +++ b/app/controllers/comments_controller.rb~ @@ -0,0 +1,97 @@ +# Clase Ruby que hereda de +ApplicationController+. +# Cuando la aplicación reciba una petición referente a comentarios, la ruta determina qué controlador y acción realizar. +# == Métodos para controlador comentarios +# * index +# * show +# * new +# * edit +# * create +# * update +# * destroy +class CommentsController < ApplicationController + # GET /comments + # GET /comments.json + def index #gestiona las rutas anidadas + if params[:site_id].nil? or params[:site_id].empty? + @comments = Comment.all # path: /comment + else + @comments = Site.find(params[:site_id]).comments # path: /sites/id/comments + end + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @comments } + end + end + + # GET /comments/1 + # GET /comments/1.json + def show + @comment = Comment.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comment } + end + end + + # GET /comments/new + # GET /comments/new.json + def new + @comment = current_user.comments.build # crea comentario vacío asociado a current_user + respond_to do |format| + format.html # new.html.erb + format.json { render json: @comment } + end + end + + # GET /comments/1/edit + def edit + @comment = current_user.comments.find(params[:id]) + @site = @comment.site + end + + # POST /comments + # POST /comments.json + def create + @comment = current_user.comments.build(params[:comment]) + + respond_to do |format| + if @comment.save + format.html { redirect_to @comment, notice: 'Comment was successfully created.' } + format.json { render json: @comment, status: :created, location: @comment } + else + format.html { render action: "new" } + format.json { render json: @comment.errors, status: :unprocessable_entity } + end + end + end + + # PUT /comments/1 + # PUT /comments/1.json + def update + @comment = current_user.comments.find(params[:id]) + + respond_to do |format| + if @comment.update_attributes(params[:comment]) + format.html { redirect_to @comment, notice: 'Comment was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comment.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comments/1 + # DELETE /comments/1.json + def destroy + @comment = Comment.find(params[:id]) + @comment.destroy + + respond_to do |format| + format.html { redirect_to sites_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..3af0790 100644 --- a/app/controllers/planet_controller.rb +++ b/app/controllers/planet_controller.rb @@ -29,5 +29,21 @@ def contact # Método que define una acción vacía del controlador def ejemplo end - + # Acción author + def author + end + # Método que define la búsqueda de palabras a encontrar en la aplicación + def search + if params[:busqueda].empty? or params[:busqueda].length < 3 + @sites = [] + @trips = [] + else + @sites = Site.where("name like ? or description like ?", "%"+params[:busqueda]+"%", "%"+params[:busqueda]+"%") + @trips = Trip.where("name like ? or description like ?", "%"+params[:busqueda]+"%", "%"+params[:busqueda]+"%") + end + end + + def table_of_contents + end + end diff --git a/app/controllers/planet_controller.rb~ b/app/controllers/planet_controller.rb~ new file mode 100644 index 0000000..9eb2fe9 --- /dev/null +++ b/app/controllers/planet_controller.rb~ @@ -0,0 +1,36 @@ +# PlanetController ilustra el uso de *RDoc*. La documentación de un proyecto en +# genera en el directorio *proy/doc* en formato Web con +# $proy> rake doc:app +# +# == Algunos comandos de formateo +# +# Tal y como muestra el subitulo anterior, este se define empezando la +# línea con ==. En los títulos debe empezar por =. +# +# Un [ ... ] seguido de texto define una lista titulada, como aquí +# [Clases, Módulos o Métodos] Se documentan con comentarios justo encima de sus definición, como aquí. +# +# Un * o - definen las entradas de una lista itemizada +# * Un URL se define así email[mailto:pepe@ejemplo.com] +# * o así {Pepe Rubio}[mailto:pepe@ejemplo.com] +# +# Un número o letra seguido de punto genera una lista númerada +# 1. + permite generar *negrita*, igual que con HTML +# 2. _ permite generar _cursiva_, igual que con HTML +# 3. * permite generar letra de +teletipo+, igual que con HTML +# +class PlanetController < ApplicationController + # Método que define una acción vacía del controlador + def index + end + # Método que define una acción vacía del controlador + def contact + end + # Método que define una acción vacía del controlador + def ejemplo + end + # Acción author + def author + end + +end diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 57e0611..509af0b 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -1,3 +1,14 @@ +# Clase Ruby que hereda de +ApplicationController+. +# Cuando la aplicación reciba una petición referente a sitios, la ruta determina qué controlador y acción realizar. +# == Métodos para controlador sitios +# * index +# * show +# * new +# * edit +# * create +# * update +# * destroy +# * count_visita class SitesController < ApplicationController # authenticate_user! ejecuta acción solo si sesión existe @@ -22,6 +33,7 @@ def index # GET /sites/1.json def show @site = Site.find(params[:id]) + @comment = @site.comments.build respond_to do |format| format.html # show.html.erb @@ -88,9 +100,10 @@ def destroy format.json { head :no_content } end end - - private - def count_visita + +private +# método cuenta visitas para gestionar el incremento de visitas a sitios +def count_visita @site.increment!(:visitas) end end diff --git a/app/controllers/sites_controller.rb~ b/app/controllers/sites_controller.rb~ new file mode 100644 index 0000000..509af0b --- /dev/null +++ b/app/controllers/sites_controller.rb~ @@ -0,0 +1,109 @@ +# Clase Ruby que hereda de +ApplicationController+. +# Cuando la aplicación reciba una petición referente a sitios, la ruta determina qué controlador y acción realizar. +# == Métodos para controlador sitios +# * index +# * show +# * new +# * edit +# * create +# * update +# * destroy +# * count_visita +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 + def index + if params[:type_id].nil? or params[:type_id].empty? + @sites = Site.all # path: /types + else + @sites = Type.find(params[:type_id]).sites # path: /types/id/sites + end + respond_to do |format| + format.html # index.html.erb + format.json { render json: @sites } + end + end + + # GET /sites/1 + # GET /sites/1.json + def show + @site = Site.find(params[:id]) + @comment = @site.comments.build + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @site } + end + end + + # GET /sites/new + # GET /sites/new.json + def new + @site = current_user.sites.build # crea sitio vacio asociado a current_user + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @site } + end + end + + # GET /sites/1/edit + def edit + @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user + end + + # POST /sites + # POST /sites.json + def create + @site = current_user.sites.build(params[:site]) # Asigna solo si sitio asociado a current_user + + respond_to do |format| + if @site.save + format.html { redirect_to @site, notice: 'Site was successfully created.' } + format.json { render json: @site, status: :created, location: @site } + else + format.html { render action: "new" } + format.json { render json: @site.errors, status: :unprocessable_entity } + end + end + end + + # PUT /sites/1 + # PUT /sites/1.json + def update + @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user + + respond_to do |format| + if @site.update_attributes(params[:site]) + format.html { redirect_to @site, notice: 'Site was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @site.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /sites/1 + # DELETE /sites/1.json + def destroy + @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user + @site.destroy + + respond_to do |format| + format.html { redirect_to sites_url } + format.json { head :no_content } + end + end + +private +# método cuenta visitas para gestionar el incremento de visitas a sitios +def count_visita + @site.increment!(:visitas) + end +end diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 321f6e3..25e21bf 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -1,3 +1,13 @@ +# Clase Ruby que hereda de +ApplicationController+. +# Cuando la aplicación reciba una petición referente a viajes, la ruta determina qué controlador y acción realizar. +# == Métodos para controlador viajes +# * index +# * show +# * new +# * edit +# * create +# * update +# * destroy 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..1a0545f 100644 --- a/app/controllers/types_controller.rb +++ b/app/controllers/types_controller.rb @@ -1,8 +1,18 @@ +# Clase Ruby que hereda de +ApplicationController+. +# Cuando la aplicación reciba una petición referente a tipos, la ruta determina qué controlador y acción realizar +# == Métodos para controlador tipos +# * index +# * show +# * new +# * edit +# * create +# * update +# * destroy class TypesController < ApplicationController # GET /types # GET /types.json - def index - @types = Type.all + def index + @types = Type.all #busca colección de recursos respond_to do |format| format.html # index.html.erb @@ -13,7 +23,7 @@ def index # GET /types/1 # GET /types/1.json def show - @type = Type.find(params[:id]) + @type = Type.find(params[:id]) #busca elemento en la tabla respond_to do |format| format.html # show.html.erb @@ -80,4 +90,13 @@ def destroy format.json { head :no_content } end end + + # ordered_index + def ordered_index + @types = Type.find(:all, :order => :name) + respond_to do |format| + format.html { render action: "index" } + format.json { render json: @types } + end + end end diff --git a/app/controllers/types_controller.rb~ b/app/controllers/types_controller.rb~ new file mode 100644 index 0000000..4aa7b77 --- /dev/null +++ b/app/controllers/types_controller.rb~ @@ -0,0 +1,93 @@ +class TypesController < ApplicationController + # GET /types + # GET /types.json + def index + @types = Type.all #busca colección de recursos + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @types } + end + end + + # GET /types/1 + # GET /types/1.json + def show + @type = Type.find(params[:id]) #busca elemento en la tabla + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @type } + end + end + + # GET /types/new + # GET /types/new.json + def new + @type = Type.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @type } + end + end + + # GET /types/1/edit + def edit + @type = Type.find(params[:id]) + end + + # POST /types + # POST /types.json + def create + @type = Type.new(params[:type]) + + respond_to do |format| + if @type.save + format.html { redirect_to @type, notice: 'Type was successfully created.' } + format.json { render json: @type, status: :created, location: @type } + else + format.html { render action: "new" } + format.json { render json: @type.errors, status: :unprocessable_entity } + end + end + end + + # PUT /types/1 + # PUT /types/1.json + def update + @type = Type.find(params[:id]) + + respond_to do |format| + if @type.update_attributes(params[:type]) + format.html { redirect_to @type, notice: 'Type was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @type.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /types/1 + # DELETE /types/1.json + def destroy + @type = Type.find(params[:id]) + @type.destroy + + respond_to do |format| + format.html { redirect_to types_url } + format.json { head :no_content } + end + end +end + + # ordered_index + def ordered_index + @types = Type.find(:all, :order => :name) + respond_to do |format| + format.html { render action: "index" } + format.json { render json: @types } + end + end +end diff --git a/app/controllers/visits_controller.rb b/app/controllers/visits_controller.rb index 5bd5366..6b4152c 100644 --- a/app/controllers/visits_controller.rb +++ b/app/controllers/visits_controller.rb @@ -1,3 +1,13 @@ +# Clase Ruby que hereda de +ApplicationController+. +# Cuando la aplicación reciba una petición referente a visitas, la ruta determina qué controlador y acción realizar +# == Métodos para controlador visitas +# * index +# * show +# * new +# * edit +# * create +# * update +# * destroy class VisitsController < ApplicationController # GET /visits # GET /visits.json diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..4ad0de1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,4 @@ +#Rails genera método helper para facilitar la programación de vistas y controladores. +# * En este caso para application. module ApplicationHelper end diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb new file mode 100644 index 0000000..9d80b98 --- /dev/null +++ b/app/helpers/comments_helper.rb @@ -0,0 +1,4 @@ +#Rails genera método helper para facilitar la programación de vistas y controladores. +# * En este caso para comments. +module CommentsHelper +end diff --git a/app/helpers/planet_helper.rb b/app/helpers/planet_helper.rb index 5bbc197..9171c64 100644 --- a/app/helpers/planet_helper.rb +++ b/app/helpers/planet_helper.rb @@ -1,2 +1,4 @@ +#Rails genera método helper para facilitar la programación de vistas y controladores. +# * En este caso para planet. module PlanetHelper end diff --git a/app/helpers/sites_helper.rb b/app/helpers/sites_helper.rb index 621069d..2a9d6af 100644 --- a/app/helpers/sites_helper.rb +++ b/app/helpers/sites_helper.rb @@ -1,2 +1,4 @@ +#Rails genera método helper para facilitar la programación de vistas y controladores. +# * En este caso para sites. module SitesHelper end diff --git a/app/helpers/trips_helper.rb b/app/helpers/trips_helper.rb index 04f333d..44e7264 100644 --- a/app/helpers/trips_helper.rb +++ b/app/helpers/trips_helper.rb @@ -1,2 +1,4 @@ +#Rails genera método helper para facilitar la programación de vistas y controladores. +# * En este caso para trips. module TripsHelper end diff --git a/app/helpers/types_helper.rb b/app/helpers/types_helper.rb index 40a2b9e..63024ea 100644 --- a/app/helpers/types_helper.rb +++ b/app/helpers/types_helper.rb @@ -1,2 +1,4 @@ +#Rails genera método helper para facilitar la programación de vistas y controladores. +# * En este caso para types. module TypesHelper end diff --git a/app/helpers/visits_helper.rb b/app/helpers/visits_helper.rb index 8ce5f83..50b5a33 100644 --- a/app/helpers/visits_helper.rb +++ b/app/helpers/visits_helper.rb @@ -1,2 +1,4 @@ +#Rails genera método helper para facilitar la programación de vistas y controladores. +# * En este caso para visits. module VisitsHelper end diff --git a/app/models/comment.rb b/app/models/comment.rb new file mode 100644 index 0000000..bb651ba --- /dev/null +++ b/app/models/comment.rb @@ -0,0 +1,14 @@ +# Hereda lógica ORM de ActiveRecord::Base +# +# ORB (Object-Relational Mapping): +# - patrón orientado a objetos de acceso a una BBDD donde los objetos son las filas de la BBDD +# +# == Modelo de Comment con relación uno-a-muchos: +# * belongs_to: Comment referencia un objeto Site +# * belongs_to: Comment referencia un objeto User +class Comment < ActiveRecord::Base + belongs_to :site + belongs_to :user + + validates :comment, :user_id, :site_id, :presence => true # campo obligatorio +end diff --git a/app/models/comment.rb~ b/app/models/comment.rb~ new file mode 100644 index 0000000..06aad18 --- /dev/null +++ b/app/models/comment.rb~ @@ -0,0 +1,12 @@ +# Hereda lógica ORM de ActiveRecord::Base +# +# ORB (Object-Relational Mapping): +# - patrón orientado a objetos de acceso a una BBDD donde los objetos son las filas de la BBDD +# +# == Modelo de Comment con relación uno-a-muchos: +# * belongs_to: Comment referencia un objeto Site +# * belongs_to: Comment referencia un objeto User +class Comment < ActiveRecord::Base + belongs_to :site + belongs_to :user +end diff --git a/app/models/site.rb b/app/models/site.rb index 2b2f99a..fadec12 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -1,8 +1,22 @@ +# Hereda lógica ORM de ActiveRecord::Base +# +# ORB (Object-Relational Mapping): +# - patrón orientado a objetos de acceso a una BBDD donde los objetos son las filas de la BBDD +# +# == Modelo de Site con relación uno-a-muchos: +# * belongs_to: Site referencia un objeto Type +# * belongs_to: Site referencia un objeto User +# * has_many: un Site referenciado por muchos Visit +# * has_many: un Site referenciado por muchos Trip +# * has_many: un Site referenciado por muchos Comment class Site < ActiveRecord::Base belongs_to :type belongs_to :user has_many :visits has_many :trips, :through => :visits + + has_many :comments + has_attached_file :image diff --git a/app/models/site.rb~ b/app/models/site.rb~ new file mode 100644 index 0000000..2b2f99a --- /dev/null +++ b/app/models/site.rb~ @@ -0,0 +1,14 @@ +class Site < ActiveRecord::Base + belongs_to :type + belongs_to :user + has_many :visits + has_many :trips, :through => :visits + has_attached_file :image + + + # Debe estar protegido para evitar accesos indeseados + attr_protected :user_id + + # Se añaden estas definiciones + validates :name, :type_id, :presence => true # campo obligatorio +end diff --git a/app/models/trip.rb b/app/models/trip.rb index 4ff6d83..d93d3ca 100644 --- a/app/models/trip.rb +++ b/app/models/trip.rb @@ -1,3 +1,12 @@ +# Hereda lógica ORM de ActiveRecord::Base +# +# ORB (Object-Relational Mapping): +# - patrón orientado a objetos de acceso a una BBDD donde los objetos son las filas de la BBDD +# +# == Modelo de Trip con relación uno-a-muchos: +# * belongs_to: Trip referencia un objeto User +# * has_many: un Trip referenciado por muchos Visit +# * has_many: un Trip referenciado por muchos Site class Trip < ActiveRecord::Base belongs_to :user has_many :visits diff --git a/app/models/type.rb b/app/models/type.rb index 2284d1f..15e57c4 100644 --- a/app/models/type.rb +++ b/app/models/type.rb @@ -1,3 +1,10 @@ +# Hereda lógica ORM de ActiveRecord::Base +# +# ORB (Object-Relational Mapping): +# - patrón orientado a objetos de acceso a una BBDD donde los objetos son las filas de la BBDD +# +# == Modelo de Type con relación uno-a-muchos: +# * has_many: un Type referenciado por muchos Site class Type < ActiveRecord::Base has_many :sites diff --git a/app/models/user.rb b/app/models/user.rb index 35b8159..8c02d53 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,18 @@ +# Hereda lógica ORM de ActiveRecord::Base +# +# ORB (Object-Relational Mapping): +# - patrón orientado a objetos de acceso a una BBDD donde los objetos son las filas de la BBDD +# +# == Modelo de Use con relación uno-a-muchos: +# * has_many: un Use referenciado por muchos Site +# * has_many: un Use referenciado por muchos Trip +# * has_many: un Use referenciado por muchos Comment class User < ActiveRecord::Base has_many :sites has_many :trips + + has_many :comments # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable diff --git a/app/models/user.rb~ b/app/models/user.rb~ new file mode 100644 index 0000000..35b8159 --- /dev/null +++ b/app/models/user.rb~ @@ -0,0 +1,15 @@ +class User < ActiveRecord::Base + + has_many :sites + has_many :trips + + # Include default devise modules. Others available are: + # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable + + validates_presence_of :name + + # Setup accessible (or protected) attributes for your model + attr_accessible :name, :email, :password, :password_confirmation, :remember_me +end diff --git a/app/models/visit.rb b/app/models/visit.rb index 57546da..e00a0dd 100644 --- a/app/models/visit.rb +++ b/app/models/visit.rb @@ -1,3 +1,11 @@ +# Hereda lógica ORM de ActiveRecord::Base +# +# ORB (Object-Relational Mapping): +# - patrón orientado a objetos de acceso a una BBDD donde los objetos son las filas de la BBDD +# +# == Modelo de Visit con relación uno-a-muchos: +# * belongs_to: Visit referencia un objeto Trip +# * belongs_to: Visit referencia un objeto Site class Visit < ActiveRecord::Base belongs_to :trip belongs_to :site diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb new file mode 100644 index 0000000..f962c3f --- /dev/null +++ b/app/views/comments/_form.html.erb @@ -0,0 +1,24 @@ +<%= form_for(@comment) do |f| %> + <% if @comment.errors.any? %> +
+

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

+ + +
+ <% end %> + +
+ <%= f.label :comment %>
+ <%= f.text_area :comment %> +
+ +<%= f.number_field :site_id, :value => @site.id, :hidden => true %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/comments/_form.html.erb~ b/app/views/comments/_form.html.erb~ new file mode 100644 index 0000000..cf483f7 --- /dev/null +++ b/app/views/comments/_form.html.erb~ @@ -0,0 +1,27 @@ +<%= form_for(@comment) do |f| %> + <% if @comment.errors.any? %> +
+

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

+ + +
+ <% end %> + +
+ <%= f.label :comment %>
+ <%= f.text_area :comment %> +
+ +
+ <%= f.label :site_id %>
+ <%= f.collection_select(:site_id, Site.find(:all, :order => :name), :id, :name) %> +
+ +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb new file mode 100644 index 0000000..12ea7f9 --- /dev/null +++ b/app/views/comments/edit.html.erb @@ -0,0 +1,6 @@ +

Editing comment

+ +<%= render 'form' %> + +<%= link_to 'Show', @comment %> | +<%= link_to 'Back', comments_path %> diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb new file mode 100644 index 0000000..774cbaf --- /dev/null +++ b/app/views/comments/index.html.erb @@ -0,0 +1,28 @@ +

Listing comments:

+ + + + + + + + + + + +<% @comments.each do |comment| %> + + + + + +<% if comment.user == current_user %> + + +<% end %> + +<% end %> +
CommentUserSite
<%= comment.comment %><%= comment.user.name if comment.user%><%= comment.site.name %><%= link_to 'Show', comment %><%= link_to 'Edit', edit_comment_path(comment) %><%= link_to 'Destroy', comment, confirm: 'Are you sure?', method: :delete %>
+ + + diff --git a/app/views/comments/index.html.erb~ b/app/views/comments/index.html.erb~ new file mode 100644 index 0000000..822b03a --- /dev/null +++ b/app/views/comments/index.html.erb~ @@ -0,0 +1,28 @@ +

Listing comments del sitio:

+ + + + + + + + + + + +<% @comments.each do |comment| %> + + + + + +<% if comment.user == current_user %> + + +<% end %> + +<% end %> +
CommentUserSite
<%= comment.comment %><%= comment.user.name if comment.user%><%= link_to 'Show', comment %><%= link_to 'Edit', edit_comment_path(comment) %><%= link_to 'Destroy', comment, confirm: 'Are you sure?', method: :delete %>
+ + + diff --git a/app/views/comments/new.html.erb b/app/views/comments/new.html.erb new file mode 100644 index 0000000..07a754a --- /dev/null +++ b/app/views/comments/new.html.erb @@ -0,0 +1,5 @@ +

New comment

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

<%= notice %>

+ +

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

+ +

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

+ +

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

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

<%= notice %>

+ +

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

+ +

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

+ +

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

+ +<% if @comment.user == current_user %> +<%= link_to 'Edit', edit_comment_path(@comment) %> +<% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e4c9e36..4d576c2 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,8 +5,13 @@ <%= stylesheet_link_tag "application" %> <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> - - + + + @@ -14,7 +19,14 @@ - \ No newline at end of file + diff --git a/app/views/layouts/application.html.erb~ b/app/views/layouts/application.html.erb~ new file mode 100644 index 0000000..fc9ed7d --- /dev/null +++ b/app/views/layouts/application.html.erb~ @@ -0,0 +1,56 @@ + + + + Planet + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + + + + + +
+
+ <%= link_to "Home", planet_index_path %>
+ <%= link_to "Tipos", types_path %>
+ <%= link_to "Sitios", sites_path %>
+ <%= link_to "Viajes", trips_path %>
+ <%= link_to "Contact", planet_contact_path %>
+ <%= link_to "Sign up", new_user_registration_path unless current_user %> + +
+ + +
+ +
+
+

<%= notice %>

<%= alert %>

+ +<%= link_to('Home', planet_index_path) + "|" + link_to('Contacts', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path) + "|" + link_to('Author', planet_author_path) + "|" + link_to('Tipos', types_path) + "|" + link_to('Sitios', sites_path) + "|" + link_to('Tipos_ordenados', types_ordered_index_path) %> + <%= yield %> +
+<%= link_to('Home', planet_index_path) + "|" + link_to('Contacts', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path) + "|" + link_to('Author', planet_author_path) + "|" + link_to('Tipos', types_path) + "|" + link_to('Sitios', sites_path) + "|" + link_to('Tipos_ordenados', types_ordered_index_path) %> +
+
+ + diff --git a/app/views/planet/author.html.erb b/app/views/planet/author.html.erb new file mode 100644 index 0000000..1194642 --- /dev/null +++ b/app/views/planet/author.html.erb @@ -0,0 +1,32 @@ +

Autores:

+ + + + + + +
+
    +
  • Nombre: Fernando Valdenebro González
    +
  • Dirección postal: C/Posadas Nº.1, San Ildefonso, SEGOVIA, ESPAÑA
    +
  • Email: fernandolg_upm@hotmail.com
    +
  • Fecha de nacimiento: 14/09/1989
    +
  • Estudios: Ingeniero de Telecomunicación (ETSIT-UPM)
    +
  • Especialidad: Telemática
    +
+
+ <%= image_tag('fer.jpg') %> + +
+
    +
  • Nombre: Antonio José Turel Rodríguez
    +
  • Dirección postal: (sin definir)
    +
  • Email: antonioturel@gmail.com
    +
  • Fecha de nacimiento: (sin definir)
    +
  • Estudios: Ingeniero de Telecomunicación (ETSIT-UPM)
    +
  • Especialidad: Telemática
    +
+ <%= image_tag('antonio.jpg') %> + +
+ diff --git a/app/views/planet/author.html.erb~ b/app/views/planet/author.html.erb~ new file mode 100644 index 0000000..2a42c8e --- /dev/null +++ b/app/views/planet/author.html.erb~ @@ -0,0 +1,2 @@ +

Planet#author

+

Find me in app/views/planet/author.html.erb

diff --git a/app/views/planet/search.html.erb b/app/views/planet/search.html.erb new file mode 100644 index 0000000..b33af5e --- /dev/null +++ b/app/views/planet/search.html.erb @@ -0,0 +1,26 @@ +

Sitios encontrados

+<% if @sites.empty? %> + No hay resultados

+ +<% else %> + <% @sites.each do |site| %> +
  • Name:<%= site.name %>, Descripción: <%= site.description %>
  • + + <% end %> + +<% end %> + +

    Viajes encontrados

    +<% if @trips.empty? %> + No hay resultados

    + +<% else %> + + <% @trips.each do |trip| %> +
    +
  • Name: <%= trip.name %>, Descriptión: <%= trip.description %>
  • +
    + + <% end %> + +<% end %> diff --git a/app/views/planet/search.html.erb~ b/app/views/planet/search.html.erb~ new file mode 100644 index 0000000..b3f8a1c --- /dev/null +++ b/app/views/planet/search.html.erb~ @@ -0,0 +1,27 @@ +

    Sitios encontrados

    +<% if @sites.empty? %> + No hay resultados

    + +<% else %> + <%= render @sites %> + <% @sites.each do |site| %> +
  • Name:<%= site.name %>, Descripción: <%= site.description %>
  • + + <% end %> + +<% end %> + +

    Viajes encontrados

    +<% if @trips.empty? %> + No hay resultados

    + +<% else %> + + <% @trips.each do |trip| %> +
    +
  • Name: <%= trip.name %>, Descriptión: <%= trip.description %>
  • +
    + + <% end %> + +<% end %> diff --git a/app/views/sites/_form.html.erb b/app/views/sites/_form.html.erb index f1fd754..46d9320 100644 --- a/app/views/sites/_form.html.erb +++ b/app/views/sites/_form.html.erb @@ -1,3 +1,29 @@ + + + <%= form_for(@site) do |f| %> <% if @site.errors.any? %>
    @@ -26,6 +52,18 @@
    <%= f.label :image %>
    <%= f.file_field :image %> +
    +
    + <%= f.label :longuitud %>
    + <%= f.text_field :longuitud %> +
    +
    + <%= f.label :latitud %>
    + <%= f.text_field :latitud %> +
    +
    + <%= f.label :zoom %>
    + <%= f.text_field :zoom %>
    <%= f.submit %> diff --git a/app/views/sites/_form.html.erb~ b/app/views/sites/_form.html.erb~ new file mode 100644 index 0000000..46d9320 --- /dev/null +++ b/app/views/sites/_form.html.erb~ @@ -0,0 +1,71 @@ + + + +<%= form_for(@site) do |f| %> + <% if @site.errors.any? %> +
    +

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

    + +
      + <% @site.errors.full_messages.each do |msg| %> +
    • <%= msg %>
    • + <% end %> +
    +
    + <% end %> + +
    + <%= f.label :name %>
    + <%= f.text_field :name %> +
    +
    + <%= f.label :description %>
    + <%= f.text_area :description , :rows => 4 %> +
    +
    + <%= f.label :type_id %>
    + <%= f.collection_select(:type_id, Type.find(:all, :order => :name), :id, :name) %> +
    +
    + <%= f.label :image %>
    + <%= f.file_field :image %> +
    +
    + <%= f.label :longuitud %>
    + <%= f.text_field :longuitud %> +
    +
    + <%= f.label :latitud %>
    + <%= f.text_field :latitud %> +
    +
    + <%= f.label :zoom %>
    + <%= f.text_field :zoom %> +
    +
    + <%= f.submit %> +
    +<% end %> diff --git a/app/views/sites/_formedit.html.erb b/app/views/sites/_formedit.html.erb new file mode 100644 index 0000000..d5a0845 --- /dev/null +++ b/app/views/sites/_formedit.html.erb @@ -0,0 +1,45 @@ +<%= form_for(@site) do |f| %> + <% if @site.errors.any? %> +
    +

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

    + +
      + <% @site.errors.full_messages.each do |msg| %> +
    • <%= msg %>
    • + <% end %> +
    +
    + <% end %> + +
    + <%= f.label :name %>
    + <%= f.text_field :name %> +
    +
    + <%= f.label :description %>
    + <%= f.text_area :description , :rows => 4 %> +
    +
    + <%= f.label :type_id %>
    + <%= f.collection_select(:type_id, Type.find(:all, :order => :name), :id, :name) %> +
    +
    + <%= f.label :image %>
    + <%= f.file_field :image %> +
    +
    + <%= f.label :longuitud %>
    + <%= f.text_field :longuitud %> +
    +
    + <%= f.label :latitud %>
    + <%= f.text_field :latitud %> +
    +
    + <%= f.label :zoom %>
    + <%= f.text_field :zoom %> +
    +
    + <%= f.submit %> +
    +<% end %> diff --git a/app/views/sites/_formedit.html.erb~ b/app/views/sites/_formedit.html.erb~ new file mode 100644 index 0000000..e69de29 diff --git a/app/views/sites/_geomapa.html.erb b/app/views/sites/_geomapa.html.erb new file mode 100644 index 0000000..caf6d2e --- /dev/null +++ b/app/views/sites/_geomapa.html.erb @@ -0,0 +1,51 @@ + + + + + +

    Buscando su localización...

    +
    + + diff --git a/app/views/sites/_geomapa~ b/app/views/sites/_geomapa~ new file mode 100644 index 0000000..e69de29 diff --git a/app/views/sites/edit.html.erb b/app/views/sites/edit.html.erb index d46384f..ae2792b 100644 --- a/app/views/sites/edit.html.erb +++ b/app/views/sites/edit.html.erb @@ -1,6 +1,6 @@

    Editing site

    -<%= render 'form' %> +<%= render 'formedit' %> <%= link_to 'Show', @site %> | <%= link_to 'Back', sites_path %> diff --git a/app/views/sites/edit.html.erb~ b/app/views/sites/edit.html.erb~ new file mode 100644 index 0000000..d46384f --- /dev/null +++ b/app/views/sites/edit.html.erb~ @@ -0,0 +1,6 @@ +

    Editing site

    + +<%= render 'form' %> + +<%= link_to 'Show', @site %> | +<%= link_to 'Back', sites_path %> diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index b8e4cae..99e93a2 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -14,16 +14,22 @@
    <%= link_to site.name, site %>
    <%= truncate(strip_tags(site.description), :length => 80) %>
    +
    Numero de viajes en los que aparece: <%= site.trips.size %>
    +<% if site.comments!=[] %> +
    <%= link_to 'Comentarios', site_comments_path(site) %>
    +<% 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 %> @@ -31,4 +37,4 @@
    -<%= link_to 'New site', new_site_path %> \ No newline at end of file +<%= link_to 'New site', new_site_path %> diff --git a/app/views/sites/index.html.erb~ b/app/views/sites/index.html.erb~ new file mode 100644 index 0000000..9052504 --- /dev/null +++ b/app/views/sites/index.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) %>
    +<% if site.comments!=[] %> +
    <%= link_to 'Comentarios', site_comments_path(site) %>
    +<% end %> +
    +
    + <%= link_to 'Show', site %>
    + <% if site.user == current_user %> + <%= link_to 'Edit', edit_site_path(site) %>
    + <%= link_to 'Destroy', site, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %> +
    +
    + +
    + +<%= 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..f4075aa 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -7,8 +7,29 @@

    <%= @site.name %>

    <%=sanitize @site.description %>

    +<% if @site.comments!=[] %> +

    Comentarios:

    + + <% @site.comments.each do |comment| %> + + + +<% if comment.user == current_user %> + + +<% end %> + + <% end %> +
    <%= comment.user.name if comment.user %>: <%= comment.comment %><%= link_to 'Show', comment %><%= link_to 'Edit', edit_comment_path(comment) %><%= link_to 'Destroy', comment, confirm: 'Are you sure?', method: :delete %>
    +<% end %> + + <%= render 'geomapa' %> +

    Numero de viajes en los que aparece: <%= @site.trips.size %>

    +

    Añada su comentario:

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

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

    -

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

    @@ -16,4 +37,7 @@

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

    + +

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

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

    <%= @site.name %>

    + +

    <%=sanitize @site.description %>

    +<% if @site.comments!=[] %> +

    Comentarios:

    + + <% @site.comments.each do |comment| %> + + + +<% if comment.user == current_user %> + + +<% end %> + + <% end %> +
    <%= comment.user.name if comment.user %>: <%= comment.comment %><%= link_to 'Show', comment %><%= link_to 'Edit', edit_comment_path() %><%= link_to 'Destroy', comment, confirm: 'Are you sure?', method: :delete %>
    +<% end %> + + <%= render 'geomapa' %> +

    Numero de viajes en los que aparece: <%= @site.trips.size %>

    +

    Añada su comentario:

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

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

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

    +<% if @site.user == current_user %> + <%= link_to 'Edit', edit_site_path(@site) %> | +<% end %> +<%= link_to 'Back', sites_path %> diff --git a/app/views/trips/_mapa.html.erb b/app/views/trips/_mapa.html.erb new file mode 100644 index 0000000..221d99c --- /dev/null +++ b/app/views/trips/_mapa.html.erb @@ -0,0 +1,62 @@ + + + + +

    Buscando su localización...

    +
    + diff --git a/app/views/trips/_mapa.html.erb~ b/app/views/trips/_mapa.html.erb~ new file mode 100644 index 0000000..139597f --- /dev/null +++ b/app/views/trips/_mapa.html.erb~ @@ -0,0 +1,2 @@ + + diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 8bced6a..4ceed5d 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, :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 %>

    Mapa del viaje:

    <%= render 'mapa' %>

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

    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 diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb index e761359..7627f62 100644 --- a/app/views/types/index.html.erb +++ b/app/views/types/index.html.erb @@ -9,7 +9,8 @@
    <%= link_to type.name, type_sites_path(type) %>
    <%= truncate(strip_tags(type.description), - :length => 80) %>
    + :length => 80) %> +
    Fecha de modificación: <%= (type.updated_at)%>
    diff --git a/app/views/types/index.html.erb~ b/app/views/types/index.html.erb~ new file mode 100644 index 0000000..e761359 --- /dev/null +++ b/app/views/types/index.html.erb~ @@ -0,0 +1,30 @@ +
    +

    Listing Types

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

    +

    + Fecha de modificación: + <%= (@type.updated_at)%> +

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

    <%= notice %>

    + +

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

    + +

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

    + + +<%= link_to 'Edit', edit_type_path(@type) %> | +<%= link_to 'Back', types_path %> diff --git a/config/routes.rb b/config/routes.rb index 29d3c86..df475dc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,10 @@ Planet::Application.routes.draw do + resources :comments + + get "planet/author" + get "types/ordered_index" + resources :visits resources :trips @@ -11,6 +16,10 @@ resources :types do # Rutas anidadas /types/id/sites..., resources :sites, :only => [ :index ] # Restringe a acción “index” end + + resources :sites do # Rutas anidadas /sites/id/comments..., + resources :comments, :only => [ :index ] # Restringe a acción “index” + end get "planet/index" @@ -18,6 +27,8 @@ get "planet/ejemplo" + get "planet/search" + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/config/routes.rb~ b/config/routes.rb~ new file mode 100644 index 0000000..acddb7d --- /dev/null +++ b/config/routes.rb~ @@ -0,0 +1,88 @@ +Planet::Application.routes.draw do + + resources :comments + + get "planet/author" + get "types/ordered_index" + + resources :visits + + resources :trips + + devise_for :users + + resources :sites + + resources :types do # Rutas anidadas /types/id/sites..., + resources :sites, :only => [ :index ] # Restringe a acción “index” + end + + resources :sites do # Rutas anidadas /sites/id/comments..., + resources :comments, :only => [ :index ] # Restringe a acción “index” + end + + get "planet/index" + + get "planet/contact" + + get "planet/ejemplo" + + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + # root :to => 'welcome#index' + + root :to => "planet#index" + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id(.:format)))' +end diff --git a/db/migrate/20120424164523_create_comments.rb b/db/migrate/20120424164523_create_comments.rb new file mode 100644 index 0000000..36d0b14 --- /dev/null +++ b/db/migrate/20120424164523_create_comments.rb @@ -0,0 +1,11 @@ +class CreateComments < ActiveRecord::Migration + def change + create_table :comments do |t| + t.string :comment + t.integer :user_id + t.integer :site_id + + t.timestamps + end + end +end diff --git a/db/migrate/20120425084533_site_geolocalizacion.rb b/db/migrate/20120425084533_site_geolocalizacion.rb new file mode 100644 index 0000000..57bfe3d --- /dev/null +++ b/db/migrate/20120425084533_site_geolocalizacion.rb @@ -0,0 +1,17 @@ +class SiteGeolocalizacion < ActiveRecord::Migration + def up + change_table :sites do |t| #añade las columnas de longuitud, latitud y zom a la tabla sites + t.column :longuitud, :float + t.column :latitud, :float + t.column :zoom, :integer + end + end + + def down + change_table :sites do |t| + t.remove :longuitud, :float + t.remove :latitud, :float + t.remove :zoom, :integer + end + end +end diff --git a/db/migrate/20120425084533_site_geolocalizacion.rb~ b/db/migrate/20120425084533_site_geolocalizacion.rb~ new file mode 100644 index 0000000..93beafd --- /dev/null +++ b/db/migrate/20120425084533_site_geolocalizacion.rb~ @@ -0,0 +1,7 @@ +class SiteGeolocalizacion < ActiveRecord::Migration + def up + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index e6aa66f..24ca973 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 => 20120425084533) do + + create_table "comments", :force => true do |t| + t.string "comment" + t.integer "user_id" + t.integer "site_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end create_table "sites", :force => true do |t| t.string "name" @@ -26,6 +34,9 @@ t.string "image_file_size" t.datetime "image_updated_at" t.integer "visitas", :default => 0 + t.float "longuitud" + t.float "latitud" + t.integer "zoom" end create_table "trips", :force => true do |t| diff --git a/db/seeds.rb b/db/seeds.rb index 2bda1ab..210fcd6 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -25,16 +25,16 @@ User.delete_all user1 = User.create!( - name: 'Jose Perez', - email: 'jose.perez@gmail.com', - password: 'perez22', - password_confirmation: 'perez22') + name: 'Fernando Valdenebro', + email: 'fer.kmk@gmail.com', + password: '123456', + password_confirmation: '123456') user2 = User.create!( - name: 'Javier Sedano', - email: 'javier.sedano@me.com', - password: 'sedano22', - password_confirmation: 'sedano22') + name: 'Antonio Turel', + email: 'toni@me.com', + password: '123456', + password_confirmation: '123456') Site.delete_all diff --git a/db/seeds.rb~ b/db/seeds.rb~ new file mode 100644 index 0000000..2bda1ab --- /dev/null +++ b/db/seeds.rb~ @@ -0,0 +1,117 @@ +# This file should contain all the record creation needed to seed the +# database with its default values. The data can then be loaded with +# the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) + +Type.delete_all + +type1 = Type.create!( + name: 'Monumento', + description: 'Edificio de interes turistico o artistico') + +type2 = Type.create!( + name: 'Naturaleza', + description: 'Lugar al aire libre de interes natural o de recreo') + +type3 = Type.create!( + name: 'Ruina', + description: 'Lugar o resto de interes arquelogico') + + +User.delete_all + +user1 = User.create!( + name: 'Jose Perez', + email: 'jose.perez@gmail.com', + password: 'perez22', + password_confirmation: 'perez22') + +user2 = User.create!( + name: 'Javier Sedano', + email: 'javier.sedano@me.com', + password: 'sedano22', + password_confirmation: 'sedano22') + + +Site.delete_all + +site1= Site.create!( + name: 'Pedriza', + description: 'Magnifico valle al norte de Madrid en el Macizo Central', + type_id: type2.id, + image_url: 'pedriza.png', + image: File.open(File.join(Rails.root, 'app', 'assets','images', 'pedriza.png'), "r")) +site1.user_id = user1.id ; site1.save + +site2 = Site.create!( + name: 'Catedral de Florencia', + description: 'Catedral de la ciudad de Florencia con la que se inicia el Renacimiento', + type_id: type1.id, + image_url: 'florencia.png', + image: File.open(File.join(Rails.root, 'app', 'assets','images', 'florencia.png'), "r")) +site2.user_id = user1.id ; site2.save + +site3 = Site.create!( + name: 'Jardin de Lineo', + description: 'Jardin de la ciudad sueca de Uppsala donde el famoso naturalista tenia su coleccion de plantas', + type_id: type1.id, + image_url: 'arbol1.png', + image: File.open(File.join(Rails.root, 'app', 'assets','images', 'arbol1.png'), "r")) +site3.user_id = user2.id ; site3.save + +site4 = Site.create!( + name: 'Reichstag', + description: 'Parlamento aleman en la ciudad de Berlin', + type_id: type2.id, + image_url: 'reichstag.png', + image: File.open(File.join(Rails.root, 'app', 'assets','images', 'reichstag.png'), "r")) +site4.user_id = user2.id ; site4.save + +site5 = Site.create!( + name: 'Pergamo', + description: 'Puerta del mercado de la antigua ciudad griega de Pergamo del museo arquelogico de Berlin', + type_id: type3.id, + image_url: 'pergamo.png', + image: File.open(File.join(Rails.root, 'app', 'assets','images', 'pergamo.png'), "r")) +site5.user_id = user1.id ; site5.save + + + +Trip.delete_all + +trip1 = Trip.create!( + name: 'Viaje por Europa', + description: 'Viaje por capitales europeas', + date: '2012-04-12') +trip1.user_id = user1.id ; trip1.save + +trip2 = Trip.create!( + name: 'Sierra de Madrid', + description: 'Sua al Yelmo en la Pedriza', + date: '2012-05-18') +trip2.user_id = user2.id ; trip2.save + + +Visit.delete_all + +visit1 = Visit.create!( + hour: '10') +visit1.trip_id = trip2.id +visit1.site_id = site1.id ; visit1.save + +visit2 = Visit.create!( + hour: '9') +visit2.trip_id = trip1.id +visit2.site_id = site5.id ; visit2.save + +visit3 = Visit.create!( + hour: '16') +visit3.trip_id = trip1.id +visit3.site_id = site4.id ; visit3.save + + + diff --git a/doc/app/ApplicationController.html b/doc/app/ApplicationController.html index 65ef712..fe8f8cd 100644 --- a/doc/app/ApplicationController.html +++ b/doc/app/ApplicationController.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,12 @@

    class ApplicationController

    +

    En esta clase

    +
    clase ApplicationController +
    +

    Definimos instrucción para posibles ataques al servidor.

    +
    +
    diff --git a/doc/app/ApplicationHelper.html b/doc/app/ApplicationHelper.html index efcf78f..0469e07 100644 --- a/doc/app/ApplicationHelper.html +++ b/doc/app/ApplicationHelper.html @@ -81,6 +81,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -122,6 +128,11 @@

    module ApplicationHelper

    +

    Rails genera método helper para facilitar la programación de vistas y +controladores.

    + +
    * En este caso para application.
    +
    diff --git a/doc/app/Comment.html b/doc/app/Comment.html new file mode 100644 index 0000000..3ea64a6 --- /dev/null +++ b/doc/app/Comment.html @@ -0,0 +1,180 @@ + + + + + + +class Comment - Rails Application Documentation + + + + + + + + + + + + + + + + +
    +

    class Comment

    + +
    + +

    Hereda lógica ORM de ActiveRecord::Base

    + +

    ORB (Object-Relational Mapping):

    +
    • +

      patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

      +
    + +

    Modelo de Comment con relación uno-a-muchos:

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

    class CommentsController

    + +
    + +

    Clase Ruby que hereda de ApplicationController. Cuando la +aplicación reciba una petición referente a comentarios, la ruta determina +qué controlador y acción realizar.

    + +

    Métodos para controlador comentarios

    +
    • +

      index

      +
    • +

      show

      +
    • +

      new

      +
    • +

      edit

      +
    • +

      create

      +
    • +

      update

      +
    • +

      destroy

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

    Public Instance Methods

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

    POST /comments POST /comments.json

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

    DELETE /comments/1 DELETE /comments/1.json

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

    GET /comments/1/edit

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

    GET /comments GET /comments.json

    + + + +
    +
    # File app/controllers/comments_controller.rb, line 14
    +def index  #gestiona las rutas anidadas
    +  if params[:site_id].nil? or params[:site_id].empty?
    +    @comments = Comment.all   # path: /comment
    +    else
    +    @comments = Site.find(params[:site_id]).comments  # path: /sites/id/comments
    +  end
    +  
    +  respond_to do |format|
    +    format.html # index.html.erb
    +    format.json { render json: @comments }
    +  end
    +end
    +
    + +
    + + + + +
    + + +
    + +
    + new() + click to toggle source +
    + + +
    + +

    GET /comments/new GET /comments/new.json

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

    GET /comments/1 GET /comments/1.json

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

    PUT /comments/1 PUT /comments/1.json

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

    module CommentsHelper

    + +
    + +

    Rails genera método helper para facilitar la programación de vistas y +controladores.

    + +
    * En este caso para comments.
    + +
    + + + + +
    + + + + + + + + + + +
    + +
    + + + + diff --git a/doc/app/PlanetController.html b/doc/app/PlanetController.html index e3bde99..10501fd 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 +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -198,6 +208,35 @@

    Algunos comandos de formateo

    Public Instance Methods

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

    Acción author

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

    Public Instance Methods

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

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -122,6 +128,11 @@

    module PlanetHelper

    +

    Rails genera método helper para facilitar la programación de vistas y +controladores.

    + +
    * En este caso para planet.
    +
    diff --git a/doc/app/Site.html b/doc/app/Site.html index 3c8b96c..04a398e 100644 --- a/doc/app/Site.html +++ b/doc/app/Site.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,32 @@

    class Site

    +

    Hereda lógica ORM de ActiveRecord::Base

    + +

    ORB (Object-Relational Mapping):

    +
    • +

      patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

      +
    + +

    Modelo de Site con relación uno-a-muchos:

    +
    • +

      belongs_to: Site referencia un objeto Type

      +
    • +

      belongs_to: Site referencia un objeto User

      +
    • +

      has_many: un Site referenciado por muchos Visit

      +
    • +

      has_many: un Site referenciado por muchos Trip

      +
    • +

      has_many: un Site referenciado por muchos Comment

      +
    +
    diff --git a/doc/app/SitesController.html b/doc/app/SitesController.html index c02b5c6..e10a2ca 100644 --- a/doc/app/SitesController.html +++ b/doc/app/SitesController.html @@ -109,6 +109,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -150,6 +156,29 @@

    class SitesController

    +

    Clase Ruby que hereda de ApplicationController. Cuando la +aplicación reciba una petición referente a sitios, la ruta determina qué +controlador y acción realizar.

    + +

    Métodos para controlador sitios

    +
    • +

      index

      +
    • +

      show

      +
    • +

      new

      +
    • +

      edit

      +
    • +

      create

      +
    • +

      update

      +
    • +

      destroy

      +
    • +

      count_visita

      +
    +
    @@ -186,7 +215,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 +255,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 +291,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
    @@ -292,7 +321,7 @@

    Public Instance Methods

    -
    # File app/controllers/sites_controller.rb, line 9
    +            
    # File app/controllers/sites_controller.rb, line 20
     def index
       if params[:type_id].nil? or params[:type_id].empty?
         @sites = Site.all            # path: /types
    @@ -330,7 +359,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,7 +394,7 @@ 

    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])
     
    @@ -400,7 +429,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..a0e0588 100644
    --- a/doc/app/SitesHelper.html
    +++ b/doc/app/SitesHelper.html
    @@ -81,6 +81,12 @@ 

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -122,6 +128,11 @@

    module SitesHelper

    +

    Rails genera método helper para facilitar la programación de vistas y +controladores.

    + +
    * En este caso para sites.
    +
    diff --git a/doc/app/Trip.html b/doc/app/Trip.html index 9a51e94..71d0701 100644 --- a/doc/app/Trip.html +++ b/doc/app/Trip.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,26 @@

    class Trip

    +

    Hereda lógica ORM de ActiveRecord::Base

    + +

    ORB (Object-Relational Mapping):

    +
    • +

      patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

      +
    + +

    Modelo de Trip con relación uno-a-muchos:

    +
    • +

      belongs_to: Trip referencia un objeto User

      +
    • +

      has_many: un Trip referenciado por muchos Visit

      +
    • +

      has_many: un Trip referenciado por muchos Site

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

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -150,6 +156,27 @@

    class TripsController

    +

    Clase Ruby que hereda de ApplicationController. Cuando la +aplicación reciba una petición referente a viajes, la ruta determina qué +controlador y acción realizar.

    + +

    Métodos para controlador viajes

    +
    • +

      index

      +
    • +

      show

      +
    • +

      new

      +
    • +

      edit

      +
    • +

      create

      +
    • +

      update

      +
    • +

      destroy

      +
    +
    @@ -186,7 +213,7 @@

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

    -
    # File app/controllers/trips_controller.rb, line 19
    +            
    # File app/controllers/trips_controller.rb, line 29
     def show
       @trip = Trip.find(params[:id])
       @visit = @trip.visits.build
    @@ -398,7 +425,7 @@ 

    Public Instance Methods

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

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -122,6 +128,11 @@

    module TripsHelper

    +

    Rails genera método helper para facilitar la programación de vistas y +controladores.

    + +
    * En este caso para trips.
    +
    diff --git a/doc/app/Type.html b/doc/app/Type.html index c9f3a24..7ff419b 100644 --- a/doc/app/Type.html +++ b/doc/app/Type.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,20 @@

    class Type

    +

    Hereda lógica ORM de ActiveRecord::Base

    + +

    ORB (Object-Relational Mapping):

    +
    • +

      patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

      +
    + +

    Modelo de Type con relación uno-a-muchos:

    +
    • +

      has_many: un Type referenciado por muchos Site

      +
    +
    diff --git a/doc/app/TypesController.html b/doc/app/TypesController.html index e69e052..fbedc5d 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 +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -150,6 +158,27 @@

    class TypesController

    +

    Clase Ruby que hereda de ApplicationController. Cuando la +aplicación reciba una petición referente a tipos, la ruta determina qué +controlador y acción realizar

    + +

    Métodos para controlador tipos

    +
    • +

      index

      +
    • +

      show

      +
    • +

      new

      +
    • +

      edit

      +
    • +

      create

      +
    • +

      update

      +
    • +

      destroy

      +
    +
    @@ -186,7 +215,7 @@

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

    -
    # File app/controllers/types_controller.rb, line 4
    -def index
    -  @types = Type.all
    +            
    # File app/controllers/types_controller.rb, line 14
    +def index  
    +  @types = Type.all  #busca colección de recursos
     
       respond_to do |format|
         format.html # index.html.erb
    @@ -327,7 +356,7 @@ 

    Public Instance Methods

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

    Public Instance Methods

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

    #ordered_index

    + + + +
    +
    # File app/controllers/types_controller.rb, line 95
    +def ordered_index
    +  @types = Type.find(:all, :order => :name)
    +  respond_to do |format|
    +    format.html { render action: "index" }
    +    format.json { render json: @types }
    +  end
    +end
    +
    + +
    + + + + +
    + +
    @@ -362,9 +425,9 @@

    Public Instance Methods

    -
    # File app/controllers/types_controller.rb, line 15
    +            
    # File app/controllers/types_controller.rb, line 25
     def show
    -  @type = Type.find(params[:id])
    +  @type = Type.find(params[:id])  #busca elemento en la tabla
     
       respond_to do |format|
         format.html # show.html.erb
    @@ -397,7 +460,7 @@ 

    Public Instance Methods

    -
    # File app/controllers/types_controller.rb, line 58
    +            
    # File app/controllers/types_controller.rb, line 68
     def update
       @type = Type.find(params[:id])
     
    diff --git a/doc/app/TypesHelper.html b/doc/app/TypesHelper.html
    index d7e732d..24710b7 100644
    --- a/doc/app/TypesHelper.html
    +++ b/doc/app/TypesHelper.html
    @@ -81,6 +81,12 @@ 

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -122,6 +128,11 @@

    module TypesHelper

    +

    Rails genera método helper para facilitar la programación de vistas y +controladores.

    + +
    * En este caso para types.
    +
    diff --git a/doc/app/User.html b/doc/app/User.html index 5fa3862..725bdca 100644 --- a/doc/app/User.html +++ b/doc/app/User.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,23 @@

    class User

    +

    Hereda lógica ORM de ActiveRecord::Base

    + +

    ORB (Object-Relational Mapping):

    +
    • +

      patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

      +
    + +

    Modelo de Use con relación uno-a-muchos:

    +
    • +

      has_many: un Use referenciado por muchos Site

      +
    • +

      has_many: un Use referenciado por muchos Trip

      +
    • +

      has_many: un Use referenciado por muchos Comment

      +
    +
    diff --git a/doc/app/Visit.html b/doc/app/Visit.html index ad56b8f..0b8ffa1 100644 --- a/doc/app/Visit.html +++ b/doc/app/Visit.html @@ -87,6 +87,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -128,6 +134,23 @@

    class Visit

    +

    Hereda lógica ORM de ActiveRecord::Base

    + +

    ORB (Object-Relational Mapping):

    +
    • +

      patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

      +
    + +

    Modelo de Visit con relación uno-a-muchos:

    +
    • +

      belongs_to: Visit referencia un objeto Trip

      +
    • +

      belongs_to: Visit referencia un objeto Site

      +
    +
    diff --git a/doc/app/VisitsController.html b/doc/app/VisitsController.html index 00709aa..f0e201c 100644 --- a/doc/app/VisitsController.html +++ b/doc/app/VisitsController.html @@ -109,6 +109,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -150,6 +156,27 @@

    class VisitsController

    +

    Clase Ruby que hereda de ApplicationController. Cuando la +aplicación reciba una petición referente a visitas, la ruta determina qué +controlador y acción realizar

    + +

    Métodos para controlador visitas

    +
    • +

      index

      +
    • +

      show

      +
    • +

      new

      +
    • +

      edit

      +
    • +

      create

      +
    • +

      update

      +
    • +

      destroy

      +
    +
    @@ -186,7 +213,7 @@

    Public Instance Methods

    -
    # File app/controllers/visits_controller.rb, line 42
    +            
    # File app/controllers/visits_controller.rb, line 52
     def create
       @visit = Visit.new(params[:visit])
     
    @@ -227,7 +254,7 @@ 

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

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

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper @@ -122,6 +128,11 @@

    module VisitsHelper

    +

    Rails genera método helper para facilitar la programación de vistas y +controladores.

    + +
    * En este caso para visits.
    +
    diff --git a/doc/app/created.rid b/doc/app/created.rid index 2aaa3ea..6ddaec3 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 +Thu, 26 Apr 2012 11:14:27 +0200 +doc/README_FOR_APP Tue, 24 Apr 2012 16:25:19 +0200 +app/models/site.rb Thu, 26 Apr 2012 02:00:23 +0200 +app/models/visit.rb Thu, 26 Apr 2012 02:00:23 +0200 +app/models/type.rb Thu, 26 Apr 2012 02:00:23 +0200 +app/models/comment.rb Thu, 26 Apr 2012 11:14:19 +0200 +app/models/trip.rb Thu, 26 Apr 2012 02:00:23 +0200 +app/models/user.rb Thu, 26 Apr 2012 02:00:23 +0200 +app/helpers/comments_helper.rb Thu, 26 Apr 2012 02:10:52 +0200 +app/helpers/types_helper.rb Thu, 26 Apr 2012 02:10:52 +0200 +app/helpers/application_helper.rb Thu, 26 Apr 2012 02:10:52 +0200 +app/helpers/planet_helper.rb Thu, 26 Apr 2012 02:08:18 +0200 +app/helpers/visits_helper.rb Thu, 26 Apr 2012 02:10:52 +0200 +app/helpers/sites_helper.rb Thu, 26 Apr 2012 02:08:18 +0200 +app/helpers/trips_helper.rb Thu, 26 Apr 2012 02:08:18 +0200 +app/controllers/sites_controller.rb Thu, 26 Apr 2012 01:28:15 +0200 +app/controllers/types_controller.rb Thu, 26 Apr 2012 01:25:25 +0200 +app/controllers/application_controller.rb Thu, 26 Apr 2012 01:07:58 +0200 +app/controllers/comments_controller.rb Thu, 26 Apr 2012 01:28:34 +0200 +app/controllers/visits_controller.rb Thu, 26 Apr 2012 01:29:04 +0200 +app/controllers/planet_controller.rb Thu, 26 Apr 2012 02:18:29 +0200 +app/controllers/trips_controller.rb Thu, 26 Apr 2012 01:25:15 +0200 diff --git a/doc/app/doc/README_FOR_APP.html b/doc/app/doc/README_FOR_APP.html index cfe337b..1255c65 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 +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • 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..e48336d 100644 --- a/doc/app/index.html +++ b/doc/app/index.html @@ -63,6 +63,12 @@

    Class and Module Index

  • ApplicationHelper +
  • Comment + +
  • CommentsController + +
  • CommentsHelper +
  • PlanetController
  • PlanetHelper diff --git a/doc/app/js/search_index.js b/doc/app/js/search_index.js index f5703f3..de58c28 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","comment","commentscontroller","commentshelper","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","comment","commentscontroller","commentshelper","planetcontroller","planethelper","site","sitescontroller","siteshelper","trip","tripscontroller","tripshelper","type","typescontroller","typeshelper","user","visit","visitscontroller","visitshelper","planetcontroller#author()","planetcontroller#contact()","commentscontroller#create()","sitescontroller#create()","tripscontroller#create()","typescontroller#create()","visitscontroller#create()","commentscontroller#destroy()","sitescontroller#destroy()","tripscontroller#destroy()","typescontroller#destroy()","visitscontroller#destroy()","commentscontroller#edit()","sitescontroller#edit()","tripscontroller#edit()","typescontroller#edit()","visitscontroller#edit()","planetcontroller#ejemplo()","commentscontroller#index()","planetcontroller#index()","sitescontroller#index()","tripscontroller#index()","typescontroller#index()","visitscontroller#index()","commentscontroller#new()","sitescontroller#new()","tripscontroller#new()","typescontroller#new()","visitscontroller#new()","typescontroller#ordered_index()","planetcontroller#search()","commentscontroller#show()","sitescontroller#show()","tripscontroller#show()","typescontroller#show()","visitscontroller#show()","commentscontroller#update()","sitescontroller#update()","tripscontroller#update()","typescontroller#update()","visitscontroller#update()",""],"info":[["ApplicationController","","ApplicationController.html","","

    En esta clase\n

    clase ApplicationController — Definimos instrucción para posibles ataques al servidor.\n\n"],["ApplicationHelper","","ApplicationHelper.html","","

    Rails genera método helper para facilitar la programación de vistas y\ncontroladores.\n\n

    * En este caso para ...
    \n"],["Comment","","Comment.html","","

    Hereda lógica ORM de ActiveRecord::Base\n

    ORB (Object-Relational Mapping):\n

    patrón orientado a objetos de …\n"],["CommentsController","","CommentsController.html","","

    Clase Ruby que hereda de ApplicationController. Cuando la\naplicación reciba una petición referente a …\n"],["CommentsHelper","","CommentsHelper.html","","

    Rails genera método helper para facilitar la programación de vistas y\ncontroladores.\n\n

    * En este caso para ...
    \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","","

    Rails genera método helper para facilitar la programación de vistas y\ncontroladores.\n\n

    * En este caso para ...
    \n"],["Site","","Site.html","","

    Hereda lógica ORM de ActiveRecord::Base\n

    ORB (Object-Relational Mapping):\n

    patrón orientado a objetos de …\n"],["SitesController","","SitesController.html","","

    Clase Ruby que hereda de ApplicationController. Cuando la\naplicación reciba una petición referente a …\n"],["SitesHelper","","SitesHelper.html","","

    Rails genera método helper para facilitar la programación de vistas y\ncontroladores.\n\n

    * En este caso para ...
    \n"],["Trip","","Trip.html","","

    Hereda lógica ORM de ActiveRecord::Base\n

    ORB (Object-Relational Mapping):\n

    patrón orientado a objetos de …\n"],["TripsController","","TripsController.html","","

    Clase Ruby que hereda de ApplicationController. Cuando la\naplicación reciba una petición referente a …\n"],["TripsHelper","","TripsHelper.html","","

    Rails genera método helper para facilitar la programación de vistas y\ncontroladores.\n\n

    * En este caso para ...
    \n"],["Type","","Type.html","","

    Hereda lógica ORM de ActiveRecord::Base\n

    ORB (Object-Relational Mapping):\n

    patrón orientado a objetos de …\n"],["TypesController","","TypesController.html","","

    Clase Ruby que hereda de ApplicationController. Cuando la\naplicación reciba una petición referente a …\n"],["TypesHelper","","TypesHelper.html","","

    Rails genera método helper para facilitar la programación de vistas y\ncontroladores.\n\n

    * En este caso para ...
    \n"],["User","","User.html","","

    Hereda lógica ORM de ActiveRecord::Base\n

    ORB (Object-Relational Mapping):\n

    patrón orientado a objetos de …\n"],["Visit","","Visit.html","","

    Hereda lógica ORM de ActiveRecord::Base\n

    ORB (Object-Relational Mapping):\n

    patrón orientado a objetos de …\n"],["VisitsController","","VisitsController.html","","

    Clase Ruby que hereda de ApplicationController. Cuando la\naplicación reciba una petición referente a …\n"],["VisitsHelper","","VisitsHelper.html","","

    Rails genera método helper para facilitar la programación de vistas y\ncontroladores.\n\n

    * En este caso para ...
    \n"],["author","PlanetController","PlanetController.html#method-i-author","()","

    Acción author\n"],["contact","PlanetController","PlanetController.html#method-i-contact","()","

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

    POST /comments POST /comments.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","CommentsController","CommentsController.html#method-i-destroy","()","

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

    GET /comments/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"],["index","CommentsController","CommentsController.html#method-i-index","()","

    GET /comments GET /comments.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","CommentsController","CommentsController.html#method-i-new","()","

    GET /comments/new GET /comments/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","()","

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

    Método que define la búsqueda de palabras a encontrar en la aplicación\n"],["show","CommentsController","CommentsController.html#method-i-show","()","

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

    PUT /comments/1 PUT /comments/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..bbe073f 100644 --- a/doc/app/table_of_contents.html +++ b/doc/app/table_of_contents.html @@ -35,9 +35,33 @@

    Classes/Modules

    • ApplicationController + + +
    • ApplicationHelper +
    • +
    • + Comment + + + +
    • +
    • + CommentsController + + + +
    • +
    • + CommentsHelper
    • PlanetController @@ -52,39 +76,84 @@

      Classes/Modules

    • Site + + +
    • SitesController + + +
    • SitesHelper
    • Trip + + +
    • TripsController + + +
    • TripsHelper
    • Type + + +
    • TypesController + + +
    • TypesHelper
    • User + + +
    • Visit + + +
    • VisitsController + + +
    • VisitsHelper @@ -95,59 +164,77 @@

      Classes/Modules

      Methods

      diff --git a/public/025/favicon.ico b/public/025/favicon.ico new file mode 100644 index 0000000..2536afa Binary files /dev/null and b/public/025/favicon.ico differ diff --git a/public/app/ApplicationController.html b/public/app/ApplicationController.html new file mode 100644 index 0000000..fe8f8cd --- /dev/null +++ b/public/app/ApplicationController.html @@ -0,0 +1,169 @@ + + + + + + +class ApplicationController - Rails Application Documentation + + + + + + + + + + + + + + + + +
      +

      class ApplicationController

      + +
      + +

      En esta clase

      +
      clase ApplicationController +
      +

      Definimos instrucción para posibles ataques al servidor.

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

      module ApplicationHelper

      + +
      + +

      Rails genera método helper para facilitar la programación de vistas y +controladores.

      + +
      * En este caso para application.
      + +
      + + + + +
      + + + + + + + + + + +
      + +
      + + + + diff --git a/public/app/Comment.html b/public/app/Comment.html new file mode 100644 index 0000000..3ea64a6 --- /dev/null +++ b/public/app/Comment.html @@ -0,0 +1,180 @@ + + + + + + +class Comment - Rails Application Documentation + + + + + + + + + + + + + + + + +
      +

      class Comment

      + +
      + +

      Hereda lógica ORM de ActiveRecord::Base

      + +

      ORB (Object-Relational Mapping):

      +
      • +

        patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

        +
      + +

      Modelo de Comment con relación uno-a-muchos:

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

      class CommentsController

      + +
      + +

      Clase Ruby que hereda de ApplicationController. Cuando la +aplicación reciba una petición referente a comentarios, la ruta determina +qué controlador y acción realizar.

      + +

      Métodos para controlador comentarios

      +
      • +

        index

        +
      • +

        show

        +
      • +

        new

        +
      • +

        edit

        +
      • +

        create

        +
      • +

        update

        +
      • +

        destroy

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

      Public Instance Methods

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

      POST /comments POST /comments.json

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

      DELETE /comments/1 DELETE /comments/1.json

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

      GET /comments/1/edit

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

      GET /comments GET /comments.json

      + + + +
      +
      # File app/controllers/comments_controller.rb, line 14
      +def index  #gestiona las rutas anidadas
      +  if params[:site_id].nil? or params[:site_id].empty?
      +    @comments = Comment.all   # path: /comment
      +    else
      +    @comments = Site.find(params[:site_id]).comments  # path: /sites/id/comments
      +  end
      +  
      +  respond_to do |format|
      +    format.html # index.html.erb
      +    format.json { render json: @comments }
      +  end
      +end
      +
      + +
      + + + + +
      + + +
      + +
      + new() + click to toggle source +
      + + +
      + +

      GET /comments/new GET /comments/new.json

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

      GET /comments/1 GET /comments/1.json

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

      PUT /comments/1 PUT /comments/1.json

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

      module CommentsHelper

      + +
      + +

      Rails genera método helper para facilitar la programación de vistas y +controladores.

      + +
      * En este caso para comments.
      + +
      + + + + +
      + + + + + + + + + + +
      + +
      + + + + diff --git a/public/app/PlanetController.html b/public/app/PlanetController.html new file mode 100644 index 0000000..10501fd --- /dev/null +++ b/public/app/PlanetController.html @@ -0,0 +1,375 @@ + + + + + + +class PlanetController - Rails Application Documentation + + + + + + + + + + + + + + + + +
      +

      class PlanetController

      + +
      + +

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

      + +
      $proy> rake doc:app
      + +

      Algunos comandos de formateo

      + +

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

      + +

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

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

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

      +
      + +

      Un * o - definen las entradas de una lista itemizada

      + + +

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

      +
      1. +

        + permite generar negrita, igual que con +HTML

        +
      2. +

        _ permite generar cursiva, igual que con HTML

        +
        • +

          permite generar letra de teletipo, igual que con +HTML

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

      Public Instance Methods

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

      Acción author

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

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

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

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

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

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

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

      module PlanetHelper

      + +
      + +

      Rails genera método helper para facilitar la programación de vistas y +controladores.

      + +
      * En este caso para planet.
      + +
      + + + + +
      + + + + + + + + + + +
      + +
      + + + + diff --git a/public/app/Site.html b/public/app/Site.html new file mode 100644 index 0000000..04a398e --- /dev/null +++ b/public/app/Site.html @@ -0,0 +1,189 @@ + + + + + + +class Site - Rails Application Documentation + + + + + + + + + + + + + + + + +
      +

      class Site

      + +
      + +

      Hereda lógica ORM de ActiveRecord::Base

      + +

      ORB (Object-Relational Mapping):

      +
      • +

        patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

        +
      + +

      Modelo de Site con relación uno-a-muchos:

      +
      • +

        belongs_to: Site referencia un objeto Type

        +
      • +

        belongs_to: Site referencia un objeto User

        +
      • +

        has_many: un Site referenciado por muchos Visit

        +
      • +

        has_many: un Site referenciado por muchos Trip

        +
      • +

        has_many: un Site referenciado por muchos Comment

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

      class SitesController

      + +
      + +

      Clase Ruby que hereda de ApplicationController. Cuando la +aplicación reciba una petición referente a sitios, la ruta determina qué +controlador y acción realizar.

      + +

      Métodos para controlador sitios

      +
      • +

        index

        +
      • +

        show

        +
      • +

        new

        +
      • +

        edit

        +
      • +

        create

        +
      • +

        update

        +
      • +

        destroy

        +
      • +

        count_visita

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

      Public Instance Methods

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

      POST /sites POST /sites.json

      + + + +
      +
      # 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
      +  
      +  respond_to do |format|
      +    if @site.save
      +      format.html { redirect_to @site, notice: 'Site was successfully created.' }
      +      format.json { render json: @site, status: :created, location: @site }
      +    else
      +      format.html { render action: "new" }
      +      format.json { render json: @site.errors, status: :unprocessable_entity }
      +    end
      +  end
      +end
      +
      + +
      + + + + +
      + + +
      + +
      + destroy() + click to toggle source +
      + + +
      + +

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

      + + + +
      +
      # 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
      +
      +  respond_to do |format|
      +    format.html { redirect_to sites_url }
      +    format.json { head :no_content }
      +  end
      +end
      +
      + +
      + + + + +
      + + +
      + +
      + edit() + click to toggle source +
      + + +
      + +

      GET /sites/1/edit

      + + + +
      +
      # 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
      +
      + +
      + + + + +
      + + +
      + +
      + index() + click to toggle source +
      + + +
      + +

      GET /sites GET /sites.json

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

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

      + + + +
      +
      # File app/controllers/sites_controller.rb, line 45
      +def new
      +  @site = current_user.sites.build # crea sitio vacio asociado a current_user
      +  
      +  respond_to do |format|
      +    format.html # new.html.erb
      +    format.json { render json: @site }
      +  end
      +end
      +
      + +
      + + + + +
      + + +
      + +
      + show() + click to toggle source +
      + + +
      + +

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

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

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

      + + + +
      +
      # 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 
      +  
      +  respond_to do |format|
      +    if @site.update_attributes(params[:site])
      +      format.html { redirect_to @site, notice: 'Site was successfully updated.' }
      +      format.json { head :no_content }
      +    else
      +      format.html { render action: "edit" }
      +      format.json { render json: @site.errors, status: :unprocessable_entity }
      +    end
      +  end
      +end
      +
      + +
      + + + + +
      + + +
      + +
      + +
      + + + + diff --git a/public/app/SitesHelper.html b/public/app/SitesHelper.html new file mode 100644 index 0000000..a0e0588 --- /dev/null +++ b/public/app/SitesHelper.html @@ -0,0 +1,162 @@ + + + + + + +module SitesHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
      +

      module SitesHelper

      + +
      + +

      Rails genera método helper para facilitar la programación de vistas y +controladores.

      + +
      * En este caso para sites.
      + +
      + + + + +
      + + + + + + + + + + +
      + +
      + + + + diff --git a/public/app/Trip.html b/public/app/Trip.html new file mode 100644 index 0000000..71d0701 --- /dev/null +++ b/public/app/Trip.html @@ -0,0 +1,183 @@ + + + + + + +class Trip - Rails Application Documentation + + + + + + + + + + + + + + + + +
      +

      class Trip

      + +
      + +

      Hereda lógica ORM de ActiveRecord::Base

      + +

      ORB (Object-Relational Mapping):

      +
      • +

        patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

        +
      + +

      Modelo de Trip con relación uno-a-muchos:

      +
      • +

        belongs_to: Trip referencia un objeto User

        +
      • +

        has_many: un Trip referenciado por muchos Visit

        +
      • +

        has_many: un Trip referenciado por muchos Site

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

      class TripsController

      + +
      + +

      Clase Ruby que hereda de ApplicationController. Cuando la +aplicación reciba una petición referente a viajes, la ruta determina qué +controlador y acción realizar.

      + +

      Métodos para controlador viajes

      +
      • +

        index

        +
      • +

        show

        +
      • +

        new

        +
      • +

        edit

        +
      • +

        create

        +
      • +

        update

        +
      • +

        destroy

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

      Public Instance Methods

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

      POST /trips POST /trips.json

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

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

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

      GET /trips/1/edit

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

      GET /trips GET /trips.json

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

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

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

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

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

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

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

      module TripsHelper

      + +
      + +

      Rails genera método helper para facilitar la programación de vistas y +controladores.

      + +
      * En este caso para trips.
      + +
      + + + + +
      + + + + + + + + + + +
      + +
      + + + + diff --git a/public/app/Type.html b/public/app/Type.html new file mode 100644 index 0000000..7ff419b --- /dev/null +++ b/public/app/Type.html @@ -0,0 +1,177 @@ + + + + + + +class Type - Rails Application Documentation + + + + + + + + + + + + + + + + +
      +

      class Type

      + +
      + +

      Hereda lógica ORM de ActiveRecord::Base

      + +

      ORB (Object-Relational Mapping):

      +
      • +

        patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

        +
      + +

      Modelo de Type con relación uno-a-muchos:

      +
      • +

        has_many: un Type referenciado por muchos Site

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

      class TypesController

      + +
      + +

      Clase Ruby que hereda de ApplicationController. Cuando la +aplicación reciba una petición referente a tipos, la ruta determina qué +controlador y acción realizar

      + +

      Métodos para controlador tipos

      +
      • +

        index

        +
      • +

        show

        +
      • +

        new

        +
      • +

        edit

        +
      • +

        create

        +
      • +

        update

        +
      • +

        destroy

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

      Public Instance Methods

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

      POST /types POST /types.json

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

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

      + + + +
      +
      # File app/controllers/types_controller.rb, line 84
      +def destroy
      +  @type = Type.find(params[:id])
      +  @type.destroy
      +
      +  respond_to do |format|
      +    format.html { redirect_to types_url }
      +    format.json { head :no_content }
      +  end
      +end
      +
      + +
      + + + + +
      + + +
      + +
      + edit() + click to toggle source +
      + + +
      + +

      GET /types/1/edit

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

      GET /types GET /types.json

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

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

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

      #ordered_index

      + + + +
      +
      # File app/controllers/types_controller.rb, line 95
      +def ordered_index
      +  @types = Type.find(:all, :order => :name)
      +  respond_to do |format|
      +    format.html { render action: "index" }
      +    format.json { render json: @types }
      +  end
      +end
      +
      + +
      + + + + +
      + + +
      + +
      + show() + click to toggle source +
      + + +
      + +

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

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

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

      + + + +
      +
      # File app/controllers/types_controller.rb, line 68
      +def update
      +  @type = Type.find(params[:id])
      +
      +  respond_to do |format|
      +    if @type.update_attributes(params[:type])
      +      format.html { redirect_to @type, notice: 'Type was successfully updated.' }
      +      format.json { head :no_content }
      +    else
      +      format.html { render action: "edit" }
      +      format.json { render json: @type.errors, status: :unprocessable_entity }
      +    end
      +  end
      +end
      +
      + +
      + + + + +
      + + +
      + +
      + +
      + + + + diff --git a/public/app/TypesHelper.html b/public/app/TypesHelper.html new file mode 100644 index 0000000..24710b7 --- /dev/null +++ b/public/app/TypesHelper.html @@ -0,0 +1,162 @@ + + + + + + +module TypesHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
      +

      module TypesHelper

      + +
      + +

      Rails genera método helper para facilitar la programación de vistas y +controladores.

      + +
      * En este caso para types.
      + +
      + + + + +
      + + + + + + + + + + +
      + +
      + + + + diff --git a/public/app/User.html b/public/app/User.html new file mode 100644 index 0000000..725bdca --- /dev/null +++ b/public/app/User.html @@ -0,0 +1,180 @@ + + + + + + +class User - Rails Application Documentation + + + + + + + + + + + + + + + + +
      +

      class User

      + +
      + +

      Hereda lógica ORM de ActiveRecord::Base

      + +

      ORB (Object-Relational Mapping):

      +
      • +

        patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

        +
      + +

      Modelo de Use con relación uno-a-muchos:

      +
      • +

        has_many: un Use referenciado por muchos Site

        +
      • +

        has_many: un Use referenciado por muchos Trip

        +
      • +

        has_many: un Use referenciado por muchos Comment

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

      class Visit

      + +
      + +

      Hereda lógica ORM de ActiveRecord::Base

      + +

      ORB (Object-Relational Mapping):

      +
      • +

        patrón orientado a objetos de acceso a una BBDD donde los objetos son las +filas de la BBDD

        +
      + +

      Modelo de Visit con relación uno-a-muchos:

      +
      • +

        belongs_to: Visit referencia un objeto Trip

        +
      • +

        belongs_to: Visit referencia un objeto Site

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

      class VisitsController

      + +
      + +

      Clase Ruby que hereda de ApplicationController. Cuando la +aplicación reciba una petición referente a visitas, la ruta determina qué +controlador y acción realizar

      + +

      Métodos para controlador visitas

      +
      • +

        index

        +
      • +

        show

        +
      • +

        new

        +
      • +

        edit

        +
      • +

        create

        +
      • +

        update

        +
      • +

        destroy

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

      Public Instance Methods

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

      POST /visits POST /visits.json

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

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

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

      GET /visits/1/edit

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

      GET /visits GET /visits.json

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

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

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

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

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

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

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

      module VisitsHelper

      + +
      + +

      Rails genera método helper para facilitar la programación de vistas y +controladores.

      + +
      * En este caso para visits.
      + +
      + + + + +
      + + + + + + + + + + +
      + +
      + + + + diff --git a/public/app/created.rid b/public/app/created.rid new file mode 100644 index 0000000..6ddaec3 --- /dev/null +++ b/public/app/created.rid @@ -0,0 +1,22 @@ +Thu, 26 Apr 2012 11:14:27 +0200 +doc/README_FOR_APP Tue, 24 Apr 2012 16:25:19 +0200 +app/models/site.rb Thu, 26 Apr 2012 02:00:23 +0200 +app/models/visit.rb Thu, 26 Apr 2012 02:00:23 +0200 +app/models/type.rb Thu, 26 Apr 2012 02:00:23 +0200 +app/models/comment.rb Thu, 26 Apr 2012 11:14:19 +0200 +app/models/trip.rb Thu, 26 Apr 2012 02:00:23 +0200 +app/models/user.rb Thu, 26 Apr 2012 02:00:23 +0200 +app/helpers/comments_helper.rb Thu, 26 Apr 2012 02:10:52 +0200 +app/helpers/types_helper.rb Thu, 26 Apr 2012 02:10:52 +0200 +app/helpers/application_helper.rb Thu, 26 Apr 2012 02:10:52 +0200 +app/helpers/planet_helper.rb Thu, 26 Apr 2012 02:08:18 +0200 +app/helpers/visits_helper.rb Thu, 26 Apr 2012 02:10:52 +0200 +app/helpers/sites_helper.rb Thu, 26 Apr 2012 02:08:18 +0200 +app/helpers/trips_helper.rb Thu, 26 Apr 2012 02:08:18 +0200 +app/controllers/sites_controller.rb Thu, 26 Apr 2012 01:28:15 +0200 +app/controllers/types_controller.rb Thu, 26 Apr 2012 01:25:25 +0200 +app/controllers/application_controller.rb Thu, 26 Apr 2012 01:07:58 +0200 +app/controllers/comments_controller.rb Thu, 26 Apr 2012 01:28:34 +0200 +app/controllers/visits_controller.rb Thu, 26 Apr 2012 01:29:04 +0200 +app/controllers/planet_controller.rb Thu, 26 Apr 2012 02:18:29 +0200 +app/controllers/trips_controller.rb Thu, 26 Apr 2012 01:25:15 +0200 diff --git a/public/app/doc/README_FOR_APP.html b/public/app/doc/README_FOR_APP.html new file mode 100644 index 0000000..1255c65 --- /dev/null +++ b/public/app/doc/README_FOR_APP.html @@ -0,0 +1,123 @@ + + + + + + +README_FOR_APP - Rails Application Documentation + + + + + + + + + + + + + + + + +
      + +

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

      + +
      + + + + + diff --git a/public/app/images/add.png b/public/app/images/add.png new file mode 100644 index 0000000..6332fef Binary files /dev/null and b/public/app/images/add.png differ diff --git a/public/app/images/brick.png b/public/app/images/brick.png new file mode 100644 index 0000000..7851cf3 Binary files /dev/null and b/public/app/images/brick.png differ diff --git a/public/app/images/brick_link.png b/public/app/images/brick_link.png new file mode 100644 index 0000000..9ebf013 Binary files /dev/null and b/public/app/images/brick_link.png differ diff --git a/public/app/images/bug.png b/public/app/images/bug.png new file mode 100644 index 0000000..2d5fb90 Binary files /dev/null and b/public/app/images/bug.png differ diff --git a/public/app/images/bullet_black.png b/public/app/images/bullet_black.png new file mode 100644 index 0000000..5761970 Binary files /dev/null and b/public/app/images/bullet_black.png differ diff --git a/public/app/images/bullet_toggle_minus.png b/public/app/images/bullet_toggle_minus.png new file mode 100644 index 0000000..b47ce55 Binary files /dev/null and b/public/app/images/bullet_toggle_minus.png differ diff --git a/public/app/images/bullet_toggle_plus.png b/public/app/images/bullet_toggle_plus.png new file mode 100644 index 0000000..9ab4a89 Binary files /dev/null and b/public/app/images/bullet_toggle_plus.png differ diff --git a/public/app/images/date.png b/public/app/images/date.png new file mode 100644 index 0000000..783c833 Binary files /dev/null and b/public/app/images/date.png differ diff --git a/public/app/images/delete.png b/public/app/images/delete.png new file mode 100644 index 0000000..08f2493 Binary files /dev/null and b/public/app/images/delete.png differ diff --git a/public/app/images/find.png b/public/app/images/find.png new file mode 100644 index 0000000..1547479 Binary files /dev/null and b/public/app/images/find.png differ diff --git a/public/app/images/loadingAnimation.gif b/public/app/images/loadingAnimation.gif new file mode 100644 index 0000000..82290f4 Binary files /dev/null and b/public/app/images/loadingAnimation.gif differ diff --git a/public/app/images/macFFBgHack.png b/public/app/images/macFFBgHack.png new file mode 100644 index 0000000..c6473b3 Binary files /dev/null and b/public/app/images/macFFBgHack.png differ diff --git a/public/app/images/package.png b/public/app/images/package.png new file mode 100644 index 0000000..da3c2a2 Binary files /dev/null and b/public/app/images/package.png differ diff --git a/public/app/images/page_green.png b/public/app/images/page_green.png new file mode 100644 index 0000000..de8e003 Binary files /dev/null and b/public/app/images/page_green.png differ diff --git a/public/app/images/page_white_text.png b/public/app/images/page_white_text.png new file mode 100644 index 0000000..813f712 Binary files /dev/null and b/public/app/images/page_white_text.png differ diff --git a/public/app/images/page_white_width.png b/public/app/images/page_white_width.png new file mode 100644 index 0000000..1eb8809 Binary files /dev/null and b/public/app/images/page_white_width.png differ diff --git a/public/app/images/plugin.png b/public/app/images/plugin.png new file mode 100644 index 0000000..6187b15 Binary files /dev/null and b/public/app/images/plugin.png differ diff --git a/public/app/images/ruby.png b/public/app/images/ruby.png new file mode 100644 index 0000000..f763a16 Binary files /dev/null and b/public/app/images/ruby.png differ diff --git a/public/app/images/tag_blue.png b/public/app/images/tag_blue.png new file mode 100644 index 0000000..3f02b5f Binary files /dev/null and b/public/app/images/tag_blue.png differ diff --git a/public/app/images/tag_green.png b/public/app/images/tag_green.png new file mode 100644 index 0000000..83ec984 Binary files /dev/null and b/public/app/images/tag_green.png differ diff --git a/public/app/images/transparent.png b/public/app/images/transparent.png new file mode 100644 index 0000000..d665e17 Binary files /dev/null and b/public/app/images/transparent.png differ diff --git a/public/app/images/wrench.png b/public/app/images/wrench.png new file mode 100644 index 0000000..5c8213f Binary files /dev/null and b/public/app/images/wrench.png differ diff --git a/public/app/images/wrench_orange.png b/public/app/images/wrench_orange.png new file mode 100644 index 0000000..565a933 Binary files /dev/null and b/public/app/images/wrench_orange.png differ diff --git a/public/app/images/zoom.png b/public/app/images/zoom.png new file mode 100644 index 0000000..908612e Binary files /dev/null and b/public/app/images/zoom.png differ diff --git a/public/app/index.html b/public/app/index.html new file mode 100644 index 0000000..e48336d --- /dev/null +++ b/public/app/index.html @@ -0,0 +1,116 @@ + + + + + + +Rails Application Documentation + + + + + + + + + + + + + + + + +

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

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

      Table of Contents - Rails Application Documentation

      + +

      Pages

      + + +

      Classes/Modules

      + + +

      Methods

      + + + + + diff --git a/script/rails b/script/rails old mode 100755 new mode 100644 diff --git a/test/fixtures/comments.yml b/test/fixtures/comments.yml new file mode 100644 index 0000000..29c9999 --- /dev/null +++ b/test/fixtures/comments.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + comment: MyString + user_id: 1 + site_id: 1 + +two: + comment: MyString + user_id: 1 + site_id: 1 diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb new file mode 100644 index 0000000..b2b500c --- /dev/null +++ b/test/functional/comments_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class CommentsControllerTest < ActionController::TestCase + setup do + @comment = comments(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:comments) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create comment" do + assert_difference('Comment.count') do + post :create, comment: @comment.attributes + end + + assert_redirected_to comment_path(assigns(:comment)) + end + + test "should show comment" do + get :show, id: @comment + assert_response :success + end + + test "should get edit" do + get :edit, id: @comment + assert_response :success + end + + test "should update comment" do + put :update, id: @comment, comment: @comment.attributes + assert_redirected_to comment_path(assigns(:comment)) + end + + test "should destroy comment" do + assert_difference('Comment.count', -1) do + delete :destroy, id: @comment + end + + assert_redirected_to comments_path + end +end diff --git a/test/functional/planet_controller_test.rb b/test/functional/planet_controller_test.rb index ce15d1b..9a68887 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 author" do + get :author + assert_response :success + end + + test "should get ejemplo" do + get :ejemplo + assert_response :success + end + end diff --git a/test/functional/planet_controller_test.rb~ b/test/functional/planet_controller_test.rb~ new file mode 100644 index 0000000..ce15d1b --- /dev/null +++ b/test/functional/planet_controller_test.rb~ @@ -0,0 +1,15 @@ +require 'test_helper' + +class PlanetControllerTest < ActionController::TestCase + + test "should get index" do + get :index + assert_response :success + end + + test "should get contact" do + get :contact + assert_response :success + end + +end diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb new file mode 100644 index 0000000..b6d6131 --- /dev/null +++ b/test/unit/comment_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class CommentTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/comments_helper_test.rb b/test/unit/helpers/comments_helper_test.rb new file mode 100644 index 0000000..2518c16 --- /dev/null +++ b/test/unit/helpers/comments_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class CommentsHelperTest < ActionView::TestCase +end