diff --git a/.gitignore b/.gitignore index 28a4c21..0103038 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ # ignore al .DS_store files of MAC OSX .DS_Store +#ignore paperclip installation files +public/system +.project \ No newline at end of file diff --git a/Gemfile b/Gemfile index 7764763..8362f86 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,13 @@ gem 'rails', '3.2.2' gem 'sqlite3' +gem 'paperclip' + +gem 'devise' + +gem 'jquery-rails' + +gem 'cleditor_rails' # Gems used only for assets and not required # in production environments by default. diff --git a/Gemfile.lock b/Gemfile.lock index 81a3ba7..00d598c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,10 @@ GEM i18n (~> 0.6) multi_json (~> 1.0) arel (3.0.2) + bcrypt-ruby (3.0.1) builder (3.0.0) + cleditor_rails (0.0.3) + cocaine (0.2.1) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) @@ -37,6 +40,11 @@ GEM coffee-script-source execjs coffee-script-source (1.2.0) + devise (2.0.4) + bcrypt-ruby (~> 3.0) + orm_adapter (~> 0.0.3) + railties (~> 3.1) + warden (~> 1.1.1) erubis (2.7.0) execjs (1.3.0) multi_json (~> 1.0) @@ -53,6 +61,12 @@ GEM treetop (~> 1.4.8) mime-types (1.17.2) multi_json (1.1.0) + orm_adapter (0.0.7) + paperclip (2.4.5) + activerecord (>= 2.3.0) + activesupport (>= 2.3.2) + cocaine (>= 0.0.2) + mime-types polyglot (0.3.3) rack (1.4.1) rack-cache (1.2) @@ -98,13 +112,18 @@ GEM uglifier (1.2.3) execjs (>= 0.3.0) multi_json (>= 1.0.2) + warden (1.1.1) + rack (>= 1.0) PLATFORMS ruby DEPENDENCIES + cleditor_rails coffee-rails (~> 3.2.1) + devise jquery-rails + paperclip rails (= 3.2.2) sass-rails (~> 3.2.3) sqlite3 diff --git a/app/assets/images/fotocarnet.jpg b/app/assets/images/fotocarnet.jpg new file mode 100644 index 0000000..7424162 Binary files /dev/null and b/app/assets/images/fotocarnet.jpg differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 9097d83..84d87a2 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,5 +11,6 @@ // GO AFTER THE REQUIRES BELOW. // //= require jquery +//= require cleditor //= require jquery_ujs //= require_tree . diff --git a/app/assets/javascripts/comentarios.js.coffee b/app/assets/javascripts/comentarios.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/comentarios.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/trips.js.coffee b/app/assets/javascripts/trips.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/trips.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/visits.js.coffee b/app/assets/javascripts/visits.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/visits.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 3b5cc66..50d53e3 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -9,5 +9,6 @@ * compiled file, but it's generally better to create a new file per style scope. * *= require_self + *= require cleditor *= require_tree . */ diff --git a/app/assets/stylesheets/comentarios.css.scss b/app/assets/stylesheets/comentarios.css.scss new file mode 100644 index 0000000..494c101 --- /dev/null +++ b/app/assets/stylesheets/comentarios.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the comentarios controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/planet.css b/app/assets/stylesheets/planet.css index 28c4fcc..71561d8 100644 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -9,6 +9,56 @@ font: bold smaller sans-serif; } +#comentarios a {font-weight:bold; + color:black; + font: 105% sans-serif; + } +#links a { color : #555;} + + +#search { + + position: relative; + width: 310px; + top: 5px; + left: 5px; + + + + +} + +#search .notice { + + color : red; + +} + +#links { + +text-align:center; +margin-top: 10px; +margin-bottom: 10px; +word-spacing:25pt; + +} +#map_canvas { + height: 300pt; + width: 300pt; + } + + + +#cv {font:sans-serif;} + +#personal-data {font:sans-serif;} + +#personal-data img { + padding-bottom:60px; + padding-right:30px; + float:left; +} + #planet h1 { font: 150% sans-serif; @@ -71,6 +121,7 @@ #banner { background: #668; padding-top: 10px; + padding-bottom: 10px; border-bottom: 2px solid; font: small-caps 40px/40px "Times New Roman", serif; @@ -83,6 +134,19 @@ padding-left: 10px; } +#banner .user { + margin-top: 50px; + margin-right:20px; + float: right; + color: #bfb; + font-size: small; + +} + +#banner .user a { + color:#555; +} + #columns { background: #446; } diff --git a/app/assets/stylesheets/trips.css.scss b/app/assets/stylesheets/trips.css.scss new file mode 100644 index 0000000..473cbc3 --- /dev/null +++ b/app/assets/stylesheets/trips.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the trips controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/visits.css.scss b/app/assets/stylesheets/visits.css.scss new file mode 100644 index 0000000..99b00b9 --- /dev/null +++ b/app/assets/stylesheets/visits.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the visits controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/comentarios_controller.rb b/app/controllers/comentarios_controller.rb new file mode 100644 index 0000000..63b96ce --- /dev/null +++ b/app/controllers/comentarios_controller.rb @@ -0,0 +1,99 @@ +class ComentariosController < ApplicationController + # GET /comentarios + # GET /comentarios.json + before_filter :authenticate_user!, :except => [:index,:show] + def index + + + + + @comentarios = Site.find(params[:site_id]).comentarios # path: /types/id/sites + + + + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @sites } + + end + end + + # GET /comentarios/1 + # GET /comentarios/1.json + def show + @comentario = Comentario.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comentario } + end + end + + # GET /comentarios/new + # GET /comentarios/new.json + def new + + @comentario = current_user.comentarios.build + + + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @comentario } + end + end + + # GET /comentarios/1/edit + def edit + @comentario = current_user.comentarios.find(params[:id]) + + end + + # POST /comentarios + # POST /comentarios.json + def create + + @comentario = current_user.comentarios.build(params[:comentario])#creamos un comentario con lo que nos pasa el formulario + @comentario.site_id = params[:site_id] + + respond_to do |format| + if @comentario.save + format.html { redirect_to site_comentarios_url, notice: 'Comentario was successfully created.' } + format.json { render json: site_comentarios_url, status: :created, location: site_comentarios_url } + else + format.html { render action: "new" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # PUT /comentarios/1 + # PUT /comentarios/1.json + def update + @comentario = current_user.comentarios.find(params[:id]) #cogemos el comentario a actualizar + + + respond_to do |format| + if @comentario.update_attributes(params[:comentario])#intentamos actualizar el comentario con el pasado por el formulario + format.html { redirect_to site_comentarios_path(@comentario.site) , notice: 'Comentario was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comentarios/1 + # DELETE /comentarios/1.json + def destroy + @comentario = current_user.comentarios.find(params[:id]) + @comentario.destroy + + respond_to do |format| + format.html { redirect_to site_comentarios_path(@comentario.site) } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/planet_controller.rb b/app/controllers/planet_controller.rb index be7ac0a..7f0dde4 100644 --- a/app/controllers/planet_controller.rb +++ b/app/controllers/planet_controller.rb @@ -1,11 +1,31 @@ class PlanetController < ApplicationController + # GET /planet/index + def index end +def search + busqueda = params[:busqueda] + if busqueda.length < 3 + flash[:notice] = "Debe introducir al menos 3 caracteres" + redirect_to planet_index_path + end + @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 +# GET /planet/contact + def contact end +# GET /planet/ejemplo + def ejemplo end + + # GET /planet/author + + def author + end end diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index f3ae9ad..4ec57e7 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -1,4 +1,11 @@ class SitesController < ApplicationController + +after_filter :count_visit, :only => :show + +def count_visit + @site.increment!(:visitas) +end + before_filter :authenticate_user!, :except => [:index,:show] # GET /sites # GET /sites.json def index @@ -27,7 +34,7 @@ def show # GET /sites/new # GET /sites/new.json def new - @site = Site.new + @site = current_user.sites.build #crea sitio vacio asociado a current user respond_to do |format| format.html # new.html.erb @@ -37,13 +44,13 @@ def new # GET /sites/1/edit def edit - @site = Site.find(params[:id]) + @site = current_user.sites.find(params[:id]) end # POST /sites # POST /sites.json def create - @site = Site.new(params[:site]) + @site = current_user.sites.build(params[:site]) respond_to do |format| if @site.save @@ -59,7 +66,7 @@ def create # PUT /sites/1 # PUT /sites/1.json def update - @site = Site.find(params[:id]) + @site = current_user.sites.find(params[:id]) respond_to do |format| if @site.update_attributes(params[:site]) @@ -75,7 +82,7 @@ def update # DELETE /sites/1 # DELETE /sites/1.json def destroy - @site = Site.find(params[:id]) + @site = current_user.sites.find(params[:id]) @site.destroy respond_to do |format| diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb new file mode 100644 index 0000000..56cc227 --- /dev/null +++ b/app/controllers/trips_controller.rb @@ -0,0 +1,86 @@ +class TripsController < ApplicationController + + before_filter :authenticate_user!, :except => [:index, :show] + # GET /trips + # GET /trips.json + def index + @trips = Trip.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @trips } + end + end + + # GET /trips/1 + # GET /trips/1.json + def show + @trip = Trip.find(params[:id]) + @visit= @trip.visits.build + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @trip } + end + end + + # GET /trips/new + # GET /trips/new.json + def new + @trip = current_user.trips.build #crea viaje vacio + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @trip } + end + end + + # GET /trips/1/edit + def edit + @trip = current_user.trips.find(params[:id]) + end + + # POST /trips + # POST /trips.json + def create + @trip = current_user.trips.build(params[:trip]) + + respond_to do |format| + if @trip.save + format.html { redirect_to @trip, notice: 'Trip was successfully created.' } + format.json { render json: @trip, status: :created, location: @trip } + else + format.html { render action: "new" } + format.json { render json: @trip.errors, status: :unprocessable_entity } + end + end + end + + # PUT /trips/1 + # PUT /trips/1.json + def update + @trip = current_user.trips.find(params[:id]) + + respond_to do |format| + if @trip.update_attributes(params[:trip]) + format.html { redirect_to @trip, notice: 'Trip was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @trip.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /trips/1 + # DELETE /trips/1.json + def destroy + @trip = current_user.trips.find(params[:id]) + @trip.destroy + + respond_to do |format| + format.html { redirect_to trips_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb index da826f4..68bc419 100644 --- a/app/controllers/types_controller.rb +++ b/app/controllers/types_controller.rb @@ -53,6 +53,8 @@ def create end end + + # PUT /types/1 # PUT /types/1.json def update @@ -80,4 +82,13 @@ def destroy format.json { head :no_content } end end + + def ordered_index + @types = Type.find(:all, :order => :name) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @type } + end + end end diff --git a/app/controllers/visits_controller.rb b/app/controllers/visits_controller.rb new file mode 100644 index 0000000..e10dbcf --- /dev/null +++ b/app/controllers/visits_controller.rb @@ -0,0 +1,87 @@ +class VisitsController < ApplicationController + # GET /visits + # GET /visits.json + def index + @visits = Visit.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @visits } + end + end + + # GET /visits/1 + # GET /visits/1.json + def show + @visit = Visit.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @visit } + end + end + + # GET /visits/new + # GET /visits/new.json + def new + @visit = Visit.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @visit } + end + end + + # GET /visits/1/edit + def edit + @visit = Visit.find(params[:id]) + end + + # POST /visits + # POST /visits.json + def create + @visit = Visit.new(params[:visit]) + + respond_to do |format| + if @visit.save + + format.html { redirect_to @visit.trip, notice: 'Visit was successfully created.' } + format.js + format.json { render json: @visit, status: :created, location: @visit } + else + format.html { render action: "new" } + format.json { render json: @visit.errors, status: :unprocessable_entity } + end + end + end + + # PUT /visits/1 + # PUT /visits/1.json + def update + @visit = Visit.find(params[:id]) + + respond_to do |format| + if @visit.update_attributes(params[:visit]) + + format.html { redirect_to @visit.trip, notice: 'Visit was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @visit.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /visits/1 + # DELETE /visits/1.json + def destroy + @visit = Visit.find(params[:id]) + @visit.destroy + + respond_to do |format| + + format.html { redirect_to @visit.trip } + format.json { head :no_content } + end + end +end diff --git a/app/helpers/comentarios_helper.rb b/app/helpers/comentarios_helper.rb new file mode 100644 index 0000000..a8f928b --- /dev/null +++ b/app/helpers/comentarios_helper.rb @@ -0,0 +1,2 @@ +module ComentariosHelper +end diff --git a/app/helpers/trips_helper.rb b/app/helpers/trips_helper.rb new file mode 100644 index 0000000..04f333d --- /dev/null +++ b/app/helpers/trips_helper.rb @@ -0,0 +1,2 @@ +module TripsHelper +end diff --git a/app/helpers/visits_helper.rb b/app/helpers/visits_helper.rb new file mode 100644 index 0000000..8ce5f83 --- /dev/null +++ b/app/helpers/visits_helper.rb @@ -0,0 +1,2 @@ +module VisitsHelper +end diff --git a/app/models/comentario.rb b/app/models/comentario.rb new file mode 100644 index 0000000..fe49b14 --- /dev/null +++ b/app/models/comentario.rb @@ -0,0 +1,8 @@ +class Comentario < ActiveRecord::Base + belongs_to :site + belongs_to :user + + validates :site_id,:user_id, :presence => true #El comentario debe tener un contenido y pertenecer a un sitio y usuario + validates :coment, :presence => true, + :length => { :maximum => 240 } +end diff --git a/app/models/site.rb b/app/models/site.rb index 3eb288d..c0f1300 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -1,3 +1,14 @@ class Site < ActiveRecord::Base belongs_to :type + belongs_to :user + has_many :comentarios + 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 new file mode 100644 index 0000000..a175941 --- /dev/null +++ b/app/models/trip.rb @@ -0,0 +1,7 @@ +class Trip < ActiveRecord::Base + belongs_to :user + has_many :visits + has_many :sites, :through => :visits + + attr_protected :user_id #Por Seguridad +end diff --git a/app/models/type.rb b/app/models/type.rb index 7c3d2ac..2284d1f 100644 --- a/app/models/type.rb +++ b/app/models/type.rb @@ -1,3 +1,8 @@ class Type < ActiveRecord::Base has_many :sites + + + # Se añade esta definición de recurso + validates :name, :description, :presence => true # campo obligatorio + validates :name, :uniqueness => true # Campo único (no repetido) end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..f4fa6f7 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,14 @@ +class User < ActiveRecord::Base + has_many :sites + has_many :comentarios + has_many :trips + # Include default devise modules. Others available are: + # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable + + validates_presence_of :name + + # Setup accessible (or protected) attributes for your model + attr_accessible :name, :email, :password, :password_confirmation, :remember_me +end diff --git a/app/models/visit.rb b/app/models/visit.rb new file mode 100644 index 0000000..ca23b73 --- /dev/null +++ b/app/models/visit.rb @@ -0,0 +1,4 @@ +class Visit < ActiveRecord::Base + belongs_to :trip + belongs_to :site +end diff --git a/app/views/comentarios/_form.html.erb b/app/views/comentarios/_form.html.erb new file mode 100644 index 0000000..d4c98a1 --- /dev/null +++ b/app/views/comentarios/_form.html.erb @@ -0,0 +1,27 @@ +<%= form_for([:site, @comentario]) do |f| %> + <% if @comentario.errors.any? %> +
+

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

+ + +
+ <% end %> + +

Introduzca Texto del Comentario:

+ + + +
+ + <%= f.text_area :coment %> +
+ +
+ <%= f.submit %> +
+ +<% end %> diff --git a/app/views/comentarios/edit.html.erb b/app/views/comentarios/edit.html.erb new file mode 100644 index 0000000..04d725d --- /dev/null +++ b/app/views/comentarios/edit.html.erb @@ -0,0 +1,10 @@ +

Editing comentario

+ +Comentario Actual:
+ +<%= strip_tags(@comentario.coment) %> + +<%= render 'form' %> + + + diff --git a/app/views/comentarios/index.html.erb b/app/views/comentarios/index.html.erb new file mode 100644 index 0000000..d3dd34b --- /dev/null +++ b/app/views/comentarios/index.html.erb @@ -0,0 +1,50 @@ + +
+

Listing Comentarios

+ + + <% @comentarios.each do |comentario| %> + + + + + + + + + <% end %> +
+
+ +
<%= comentario.user.name if comentario.user %> : <%= strip_tags(comentario.coment) + %>
+ +
+
+ + + + <% if comentario.user == current_user %> +

+ <%= link_to 'Eliminar', [comentario.site, comentario], + :confirm => 'Are you sure?', + :method => :delete %> + + <%= link_to 'Editar', edit_site_comentario_path(comentario.site,comentario) %> + + + +

+ + <% end %> +
+
+ +
+ + + + + + + diff --git a/app/views/comentarios/new.html.erb b/app/views/comentarios/new.html.erb new file mode 100644 index 0000000..fc76740 --- /dev/null +++ b/app/views/comentarios/new.html.erb @@ -0,0 +1,5 @@ +

New comentario

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

<%= notice %>

+ +

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

+ +

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

+ +

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

+ + +<%= link_to 'Edit', edit_comentario_path(@comentario) %> | +<%= link_to 'Back', comentarios_path %> diff --git a/app/views/devise/_links.erb b/app/views/devise/_links.erb new file mode 100644 index 0000000..eab783a --- /dev/null +++ b/app/views/devise/_links.erb @@ -0,0 +1,25 @@ +<%- if controller_name != 'sessions' %> + <%= link_to "Sign in", new_session_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to "Sign up", new_registration_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> + <%= link_to "Forgot your password?", new_password_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
+ <% end -%> +<% end -%> \ No newline at end of file diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100644 index 0000000..18d81b1 --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,12 @@ +

Resend confirmation instructions

+ +<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %> + <%= devise_error_messages! %> + +
<%= f.label :email %>
+ <%= f.email_field :email %>
+ +
<%= f.submit "Resend confirmation instructions" %>
+<% end %> + +<%= render "links" %> \ No newline at end of file diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100644 index 0000000..a5c4585 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @resource.email %>!

+ +

You can confirm your account email through the link below:

+ +

<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..ae9e888 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

Someone has requested a link to change your password, and you can do this through the link below.

+ +

<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>

+ +

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..2263c21 --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

Your account has been locked due to an excessive amount of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

+ +

<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 0000000..5f7bcf8 --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,16 @@ +

Change your password

+ +<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %> + <%= devise_error_messages! %> + <%= f.hidden_field :reset_password_token %> + +
<%= f.label :password, "New password" %>
+ <%= f.password_field :password %>
+ +
<%= f.label :password_confirmation, "Confirm new password" %>
+ <%= f.password_field :password_confirmation %>
+ +
<%= f.submit "Change my password" %>
+<% end %> + +<%= render "links" %> \ No newline at end of file diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100644 index 0000000..b0b5690 --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,12 @@ +

Forgot your password?

+ +<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %> + <%= devise_error_messages! %> + +
<%= f.label :email %>
+ <%= f.email_field :email %>
+ +
<%= f.submit "Send me reset password instructions" %>
+<% end %> + +<%= render "links" %> \ No newline at end of file diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100644 index 0000000..5d4a937 --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,28 @@ +

Edit <%= resource_name.to_s.humanize %>

+ +<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %> + <%= devise_error_messages! %> + +
<%= f.label :name %>
+<%= f.text_field :name %>
+ +
<%= f.label :email %>
+ <%= f.email_field :email %>
+ +
<%= f.label :password %> (leave blank if you don't want to change it)
+ <%= f.password_field :password, :autocomplete => "off" %>
+ +
<%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation %>
+ +
<%= f.label :current_password %> (we need your current password to confirm your changes)
+ <%= f.password_field :current_password %>
+ +
<%= f.submit "Update" %>
+<% end %> + +

Cancel my account

+ +

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

+ +<%= link_to "Back", :back %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100644 index 0000000..06911fd --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,21 @@ +

Sign up

+ +<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> + <%= devise_error_messages! %> + +
<%= f.label :name %>
+ <%= f.text_field :name %>
+ +
<%= f.label :email %>
+ <%= f.email_field :email %>
+ +
<%= f.label :password %>
+ <%= f.password_field :password %>
+ +
<%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation %>
+ +
<%= f.submit "Sign up" %>
+<% end %> + +<%= render "links" %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 0000000..f12116b --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,17 @@ +

Sign in

+ +<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %> +
<%= f.label :email %>
+ <%= f.email_field :email %>
+ +
<%= f.label :password %>
+ <%= f.password_field :password %>
+ + <% if devise_mapping.rememberable? -%> +
<%= f.check_box :remember_me %> <%= f.label :remember_me %>
+ <% end -%> + +
<%= f.submit "Sign in" %>
+<% end %> + +<%= render "links" %> \ No newline at end of file diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb new file mode 100644 index 0000000..0dc79ac --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb @@ -0,0 +1,12 @@ +

Resend unlock instructions

+ +<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %> + <%= devise_error_messages! %> + +
<%= f.label :email %>
+ <%= f.email_field :email %>
+ +
<%= f.submit "Resend unlock instructions" %>
+<% end %> + +<%= render "links" %> \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1ed9716..0fbff6b 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,28 +6,212 @@ <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> - + + + }); + + +// Success callback function + +function writePosition(pos) { + + var mylat = pos.coords.latitude; + var mylong = pos.coords.longitude; + +$('#site_latitud').val(mylat); //escribo la latitud en el formulario para crear sitio + +$('#site_longitud').val(mylong); + + + + +} + + + +function displayPosition(latitud , longitud , zom, images) { + + + + if(latitud.length == null) { + var mylat = latitud; + var mylong = longitud; + var image_url = images; + + var thediv = document.getElementById('locationinfo'); + thediv.innerHTML = '

La localización exacta es longitud: ' + + mylong + ' y latitud: ' + mylat + '

'; + + var latlng = new google.maps.LatLng(mylat, mylong); + + } else { + + var thediv = document.getElementById('locationinfo'); + thediv.innerHTML = '

La localización exacta es longitud: ' + + longitud[0] + ' y latitud: ' + latitud[0] + '

'; + +var latlng = new google.maps.LatLng(latitud[0], longitud[0]); + + + } + + var myOptions = { + zoom: zom, + center: latlng, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + + var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); + +//Add marker +if(latitud.length != null) { +for(var i=0; i + + + + + + + + + + + + + + + -
+ +
+
- <%= link_to "Home", planet_index_path %>
- <%= link_to "Tipos", types_path %>
- <%= link_to "Sitios", sites_path %>
- <%= link_to "Contact", planet_contact_path %> + + + + + + + <%= 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 %> + +
+ + <%= yield %> +
-
+
+ + + \ No newline at end of file diff --git a/app/views/planet/author.html.erb b/app/views/planet/author.html.erb new file mode 100644 index 0000000..c3f3a34 --- /dev/null +++ b/app/views/planet/author.html.erb @@ -0,0 +1,36 @@ +

Datos Personales Del Autor

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

Curriculum Vitae

+ +

Formación

+ + +

Idiomas

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

Sitios encontrados en la busqueda:

+ + + <% @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) %>
+
Nº de viajes que lo incluyen: <%= site.visits.size %>
+
+
+ <%= link_to 'Show', site %>
+ <% if not(site.comentarios.empty?) %> + + <%= link_to 'Comentarios', site_comentarios_path(site) %> + + <% end %> + + <% if site.user == current_user %> + <%= link_to 'Edit', edit_site_path(site) %>
+ <%= link_to 'Destroy', site, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %> +
+
+ +
+ +
+

Viajes encontrados en la busqueda:

+ + + <% @trips.each do |trip| %> + + + + + + + <% end %> +
+
+
<%= link_to trip.name, trip_path(trip) %>
+
<%= truncate(strip_tags(trip.description), + :length => 80) + ', ' + trip.date.to_s %>
+
Fecha última actualización : <%= trip.updated_at %>
+
+
+ <%= link_to 'Show', trip %>
+ <% if trip.user == current_user %> + <%= link_to 'Edit', edit_trip_path(trip) %>
+ <%= link_to 'Destroy', trip, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %> +
+
+ +
+ +<%= link_to 'New site', new_site_path %> \ No newline at end of file diff --git a/app/views/sites/_form.html.erb b/app/views/sites/_form.html.erb index abc9fec..1abf3e1 100644 --- a/app/views/sites/_form.html.erb +++ b/app/views/sites/_form.html.erb @@ -24,9 +24,23 @@ <%= f.collection_select(:type_id, Type.find(:all, :order => :name), :id, :name) %>
- <%= f.label :image_url %>
- <%= f.text_field :image_url %> + <%= f.label :image %>
+ <%= f.file_field :image %>
+ +
+ <%= f.label :latitud %>
+ <%= f.text_field :latitud %> +
+ +
+ <%= f.label :longitud %>
+ <%= f.text_field :longitud %> +
+
+ <%= f.hidden_field :zoom, :value => 15%> +
+
<%= f.submit %>
diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index f1034b8..d8d737d 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -6,7 +6,7 @@ - <%= link_to image_tag(site.image_url, :class => 'list_image'), site %> + <%= link_to image_tag(site.image.url, :class => 'list_image'), site %> @@ -14,15 +14,25 @@
<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
+
Nº de viajes que lo incluyen: <%= site.visits.size %>
<%= link_to 'Show', site %>
+ <% if not(site.comentarios.empty?) %> + + <%= link_to 'Comentarios', site_comentarios_path(site) %> + + <% end %> + + <% if (site.user == current_user) && current_user %> <%= link_to 'Edit', edit_site_path(site) %>
<%= link_to 'Destroy', site, :confirm => 'Are you sure?', :method => :delete %> + <% end %> + <% end %> diff --git a/app/views/sites/new.html.erb b/app/views/sites/new.html.erb index 2988bdc..84889d5 100644 --- a/app/views/sites/new.html.erb +++ b/app/views/sites/new.html.erb @@ -1,5 +1,14 @@

New site

<%= render 'form' %> + <%= link_to 'Back', sites_path %> diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb index 94dc17a..23553f9 100644 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -2,14 +2,67 @@

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

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

<%= @site.name %>

<%=sanitize @site.description %>

+<% if not(@site.comentarios.empty?) %> +
+ +<%= link_to 'Comentarios', site_comentarios_path(@site) %> +
+<%end %> + +

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

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

+ +<% if (@site.user == current_user) && current_user %> <%= link_to 'Edit', edit_site_path(@site) %> | +<% end %> + <%= link_to 'Back', sites_path %> + +
+Nº de viajes que lo incluyen : <%= @site.visits.size %> +
+
+<% if (@site.longitud != nil) and (@site.latitud != nil) and (@site.zoom!=nil) %> +

+ +
+ +<%end%> + + +
+

Añadir Un Comentario:

+<%= form_for([@site, @site.comentarios.build]) do |f| %> + +
+ <%= f.label :coment %>
+ <%= f.text_area :coment %> +
+
+ <%= f.submit %> +
+<% end %> + + diff --git a/app/views/trips/_form.html.erb b/app/views/trips/_form.html.erb new file mode 100644 index 0000000..94c5a4e --- /dev/null +++ b/app/views/trips/_form.html.erb @@ -0,0 +1,30 @@ +<%= form_for(@trip) do |f| %> + <% if @trip.errors.any? %> +
+

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

+ + +
+ <% end %> + +
+ <%= f.label :name %>
+ <%= f.text_field :name %> +
+
+ <%= f.label :description %>
+ <%= f.text_area :description %> +
+
+ <%= f.label :date %>
+ <%= f.date_select :date %> +
+ +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb new file mode 100644 index 0000000..aa9da33 --- /dev/null +++ b/app/views/trips/_trip.html.erb @@ -0,0 +1,34 @@ +
+ + <% trip.visits.order(:hour).each do |visit| %> + + <% if visit.site %> + + + + + + + + + <% else %> + <% trip.visits.delete(visit) %> + <% end %> + <% end %> +
+ <%= link_to image_tag(visit.site.image.url, :class => 'list_image'), visit.site %> + +
+
<%= visit.hour.to_s + 'h: ' %> + <%=link_to(visit.site.name, visit.site) %>
+
<%= truncate(strip_tags(visit.site.description), + :length => 80) %>
+
+
+ <%= link_to 'Show', visit.site %>
+ <%= link_to 'Destroy', visit, + :confirm => 'Are you sure?', + :method => :delete if trip.user == current_user %> + +
+
\ No newline at end of file diff --git a/app/views/trips/create.js.erb b/app/views/trips/create.js.erb new file mode 100644 index 0000000..b41cad6 --- /dev/null +++ b/app/views/trips/create.js.erb @@ -0,0 +1 @@ +$('#visit').html("<%= j render @visit.trip %>"); \ No newline at end of file diff --git a/app/views/trips/edit.html.erb b/app/views/trips/edit.html.erb new file mode 100644 index 0000000..71287a4 --- /dev/null +++ b/app/views/trips/edit.html.erb @@ -0,0 +1,6 @@ +

Editing trip

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

Viajes

+ + + <% @trips.each do |trip| %> + + + + + + + <% end %> +
+
+
<%= link_to trip.name, trip_path(trip) %>
+
<%= truncate(strip_tags(trip.description), + :length => 80) + ', ' + trip.date.to_s %>
+
Fecha última actualización : <%= trip.updated_at %>
+
+
+ <%= link_to 'Show', trip %>
+ <% if trip.user == current_user %> + <%= link_to 'Edit', edit_trip_path(trip) %>
+ <%= link_to 'Destroy', trip, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %> +
+
+ +
+ +<%= link_to 'New Trip', new_trip_path %> diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb new file mode 100644 index 0000000..dd3e49d --- /dev/null +++ b/app/views/trips/new.html.erb @@ -0,0 +1,5 @@ +

New trip

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

<%= notice %>

+ +

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) && current_user %> + <%=form_for(@visit, :remote => true) do |f| %> + + <%= f.hidden_field :trip_id, :value => @trip.id%> + + <%= 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) && current_user %> +<%= link_to 'Edit', edit_trip_path(@trip) %> | +<% end %> +<%= link_to 'Back', trips_path %> diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb index e761359..31f503a 100644 --- a/app/views/types/index.html.erb +++ b/app/views/types/index.html.erb @@ -10,6 +10,7 @@
<%= link_to type.name, type_sites_path(type) %>
<%= truncate(strip_tags(type.description), :length => 80) %>
+
Fecha última actualización : <%= type.updated_at %>
diff --git a/app/views/types/ordered_index.html.erb b/app/views/types/ordered_index.html.erb new file mode 100644 index 0000000..31f503a --- /dev/null +++ b/app/views/types/ordered_index.html.erb @@ -0,0 +1,31 @@ +
+

Listing Types

+ + + <% @types.each do |type| %> + + + + + + + <% end %> +
+
+
<%= link_to type.name, type_sites_path(type) %>
+
<%= truncate(strip_tags(type.description), + :length => 80) %>
+
Fecha última actualización : <%= type.updated_at %>
+
+
+ <%= link_to 'Show', type %>
+ <%= link_to 'Edit', edit_type_path(type) %>
+ <%= link_to 'Destroy', type, + :confirm => 'Are you sure?', + :method => :delete %> +
+
+ +
+ +<%= link_to 'New Type', new_type_path %> diff --git a/app/views/types/show.html.erb b/app/views/types/show.html.erb index 98b32e7..b159302 100644 --- a/app/views/types/show.html.erb +++ b/app/views/types/show.html.erb @@ -2,7 +2,8 @@

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

@@ -10,6 +11,11 @@ <%= @type.description %>

+

+Fecha última actualización : +<%= @type.updated_at %> +

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

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

+ + +
+ <% end %> + +
+ <%= f.label :trip_id %>
+ <%= f.number_field :trip_id %> +
+
+ <%= f.label :site_id %>
+ <%= f.number_field :site_id %> +
+
+ <%= f.label :hour %>
+ <%= f.number_field :hour %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/visits/create.js.erb b/app/views/visits/create.js.erb new file mode 100644 index 0000000..b41cad6 --- /dev/null +++ b/app/views/visits/create.js.erb @@ -0,0 +1 @@ +$('#visit').html("<%= j render @visit.trip %>"); \ No newline at end of file diff --git a/app/views/visits/edit.html.erb b/app/views/visits/edit.html.erb new file mode 100644 index 0000000..66d34d9 --- /dev/null +++ b/app/views/visits/edit.html.erb @@ -0,0 +1,6 @@ +

Editing visit

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

Listing visits

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

New visit

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

<%= notice %>

+ +

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

+ +

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

+ +

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

+ + +<%= link_to 'Edit', edit_visit_path(@visit) %> | +<%= link_to 'Back', visits_path %> diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb new file mode 100644 index 0000000..6e922dc --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,223 @@ +# Use this hook to configure devise mailer, warden hooks and so forth. +# Many of these configuration options can be set straight in your model. +Devise.setup do |config| + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in Devise::Mailer, + # note that it will be overwritten if you use your own mailer class with default "from" parameter. + config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com" + + # Configure the class responsible to send e-mails. + # config.mailer = "Devise::Mailer" + + # Automatically apply schema changes in tableless databases + config.apply_schema = false + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating a user. The default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating a user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + # You can also supply a hash where the value is a boolean determining whether + # or not authentication should be aborted when the value is not present. + # config.authentication_keys = [ :email ] + + # Configure parameters from the request object used for authentication. Each entry + # given should be a request method and it will automatically be passed to the + # find_for_authentication method and considered in your model lookup. For instance, + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. + # The same considerations mentioned for authentication_keys also apply to request_keys. + # config.request_keys = [] + + # Configure which authentication keys should be case-insensitive. + # These keys will be downcased upon creating or modifying a user and when used + # to authenticate or find a user. Default is :email. + config.case_insensitive_keys = [ :email ] + + # Configure which authentication keys should have whitespace stripped. + # These keys will have whitespace before and after removed upon creating or + # modifying a user and when used to authenticate or find a user. Default is :email. + config.strip_whitespace_keys = [ :email ] + + # Tell if authentication through request.params is enabled. True by default. + # It can be set to an array that will enable params authentication only for the + # given strategies, for example, `config.params_authenticatable = [:database]` will + # enable it only for database (email + password) authentication. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Basic Auth is enabled. False by default. + # It can be set to an array that will enable http authentication only for the + # given strategies, for example, `config.http_authenticatable = [:token]` will + # enable it only for token authentication. + # config.http_authenticatable = false + + # If http headers should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication. "Application" by default. + # config.http_authentication_realm = "Application" + + # It will change confirmation, password recovery and other workflows + # to behave the same regardless if the e-mail provided was right or wrong. + # Does not affect registerable. + # config.paranoid = true + + # By default Devise will store the user in session. You can skip storage for + # :http_auth and :token_auth by adding those symbols to the array below. + # Notice that if you are skipping storage for all authentication paths, you + # may want to disable generating routes to Devise's sessions controller by + # passing :skip => :sessions to `devise_for` in your config/routes.rb + config.skip_session_storage = [:http_auth] + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 10. If + # using other encryptors, it sets how many times you want the password re-encrypted. + # + # Limiting the stretches to just one in testing will increase the performance of + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use + # a value less than 10 in other environments. + config.stretches = Rails.env.test? ? 1 : 10 + + # Setup a pepper to generate the encrypted password. + # config.pepper = "b4579c0728e03479c7b2b897815e87ea0ef4117fe5961c19d54c9976d8ddca660a803eb982c351e72665b32ff46d8774a51727467205df158ced37817db4faae" + + # ==> Configuration for :confirmable + # A period that the user is allowed to access the website even without + # confirming his account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming his account, + # access will be blocked just in the third day. Default is 0.days, meaning + # the user cannot access the website without confirming his account. + # config.allow_unconfirmed_access_for = 2.days + + # If true, requires any email changes to be confirmed (exctly the same way as + # initial account confirmation) to be applied. Requires additional unconfirmed_email + # db field (see migrations). Until confirmed new email is stored in + # unconfirmed email column, and copied to email column on successful confirmation. + config.reconfirmable = true + + # Defines which key will be used when confirming an account + # config.confirmation_keys = [ :email ] + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # If true, uses the password salt as remember token. This should be turned + # to false if you are not using database authenticatable. + config.use_salt_as_remember_token = true + + # Options to be passed to the created cookie. For instance, you can set + # :secure => true in order to force SSL only cookies. + # config.cookie_options = {} + + # ==> Configuration for :validatable + # Range for password length. Default is 6..128. + # config.password_length = 6..128 + + # Email regex used to validate email formats. It simply asserts that + # an one (and only one) @ exists in the given string. This is mainly + # to give user feedback and not to assert the e-mail validity. + # config.email_regexp = /\A[^@]+@[^@]+\z/ + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. Default is 30 minutes. + # config.timeout_in = 30.minutes + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which key will be used when locking and unlocking an account + # config.unlock_keys = [ :email ] + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # ==> Configuration for :recoverable + # + # Defines which key will be used when recovering the password for an account + # config.reset_password_keys = [ :email ] + + # Time interval you can reset your password with a reset password key. + # Don't put a too small interval or your users won't have the time to + # change their passwords. + config.reset_password_within = 6.hours + + # ==> Configuration for :encryptable + # Allow you to use another encryption algorithm besides bcrypt (default). You can use + # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, + # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) + # and :restful_authentication_sha1 (then you should set stretches to 10, and copy + # REST_AUTH_SITE_KEY to pepper) + # config.encryptor = :sha512 + + # ==> Configuration for :token_authenticatable + # Defines name of the authentication token params key + # config.token_authentication_key = :auth_token + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = false + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). + # config.default_scope = :user + + # Configure sign_out behavior. + # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope). + # The default is true, which means any logout action will sign out all active scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The "*/*" below is required to match Internet Explorer requests. + # config.navigational_formats = ["*/*", :html] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = :delete + + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. + # + # config.warden do |manager| + # manager.intercept_401 = false + # manager.default_strategies(:scope => :user).unshift :some_external_strategy + # end +end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml new file mode 100644 index 0000000..73df488 --- /dev/null +++ b/config/locales/devise.en.yml @@ -0,0 +1,57 @@ +# Additional translations at https://github.com/plataformatec/devise/wiki/I18n + +en: + errors: + messages: + expired: "has expired, please request a new one" + not_found: "not found" + already_confirmed: "was already confirmed, please try signing in" + not_locked: "was not locked" + not_saved: + one: "1 error prohibited this %{resource} from being saved:" + other: "%{count} errors prohibited this %{resource} from being saved:" + + devise: + failure: + already_authenticated: 'You are already signed in.' + unauthenticated: 'You need to sign in or sign up before continuing.' + unconfirmed: 'You have to confirm your account before continuing.' + locked: 'Your account is locked.' + invalid: 'Invalid email or password.' + invalid_token: 'Invalid authentication token.' + timeout: 'Your session expired, please sign in again to continue.' + inactive: 'Your account was not activated yet.' + sessions: + signed_in: 'Signed in successfully.' + signed_out: 'Signed out successfully.' + passwords: + send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.' + updated: 'Your password was changed successfully. You are now signed in.' + updated_not_active: 'Your password was changed successfully.' + send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail" + confirmations: + send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' + send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.' + confirmed: 'Your account was successfully confirmed. You are now signed in.' + registrations: + signed_up: 'Welcome! You have signed up successfully.' + signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.' + signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.' + signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.' + updated: 'You updated your account successfully.' + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." + destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' + unlocks: + send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' + unlocked: 'Your account has been unlocked successfully. Please sign in to continue.' + send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.' + omniauth_callbacks: + success: 'Successfully authorized from %{kind} account.' + failure: 'Could not authorize you from %{kind} because "%{reason}".' + mailer: + confirmation_instructions: + subject: 'Confirmation instructions' + reset_password_instructions: + subject: 'Reset password instructions' + unlock_instructions: + subject: 'Unlock Instructions' diff --git a/config/routes.rb b/config/routes.rb index 716dc7e..68bbd1f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,16 +1,45 @@ Planet::Application.routes.draw do - resources :sites + + + + + resources :visits + + resources :trips + + devise_for :users - resources :types do # Rutas anidadas /types/id/sites..., + get "types/ordered_index" + + + + +resources :types do # Rutas anidadas /types/id/sites..., resources :sites, :only => [ :index ] # Restringe a acción “index” end + + + resources :sites do + resources :comentarios + + end + + + + + get "planet/search" + get "planet/index" get "planet/contact" get "planet/ejemplo" + get "planet/author" + + + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/db/migrate/20120415155937_devise_create_users.rb b/db/migrate/20120415155937_devise_create_users.rb new file mode 100644 index 0000000..540333c --- /dev/null +++ b/db/migrate/20120415155937_devise_create_users.rb @@ -0,0 +1,49 @@ +class DeviseCreateUsers < ActiveRecord::Migration + def change + create_table(:users) do |t| + ## Database authenticatable + t.string :email, :null => false, :default => "" + t.string :encrypted_password, :null => false, :default => "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + t.integer :sign_in_count, :default => 0 + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + + ## Encryptable + # t.string :password_salt + + ## Confirmable + # t.string :confirmation_token + # t.datetime :confirmed_at + # t.datetime :confirmation_sent_at + # t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts + # t.string :unlock_token # Only if unlock strategy is :email or :both + # t.datetime :locked_at + + ## Token authenticatable + # t.string :authentication_token + + + t.timestamps + end + + add_index :users, :email, :unique => true + add_index :users, :reset_password_token, :unique => true + # add_index :users, :confirmation_token, :unique => true + # add_index :users, :unlock_token, :unique => true + # add_index :users, :authentication_token, :unique => true + end +end diff --git a/db/migrate/20120415160149_user_name.rb b/db/migrate/20120415160149_user_name.rb new file mode 100644 index 0000000..85b4110 --- /dev/null +++ b/db/migrate/20120415160149_user_name.rb @@ -0,0 +1,13 @@ +class UserName < ActiveRecord::Migration + def up + change_table :users do |t| + t.column :name, :string + end + end + + def down + change_table :users do |t| + t.remove :name + end + end +end diff --git a/db/migrate/20120415172636_user_sites.rb b/db/migrate/20120415172636_user_sites.rb new file mode 100644 index 0000000..097cfbf --- /dev/null +++ b/db/migrate/20120415172636_user_sites.rb @@ -0,0 +1,15 @@ +class UserSites < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :user_id, :integer + + end + end + + def down + change_table :sites do |t| + t.remove :user_id + + end + end +end diff --git a/db/migrate/20120415175613_create_comentarios.rb b/db/migrate/20120415175613_create_comentarios.rb new file mode 100644 index 0000000..1f46d24 --- /dev/null +++ b/db/migrate/20120415175613_create_comentarios.rb @@ -0,0 +1,11 @@ +class CreateComentarios < ActiveRecord::Migration + def change + create_table :comentarios do |t| + t.string :coment + t.integer :user_id + t.integer :site_id + + t.timestamps + end + end +end diff --git a/db/migrate/20120417103003_create_trips.rb b/db/migrate/20120417103003_create_trips.rb new file mode 100644 index 0000000..9acf33c --- /dev/null +++ b/db/migrate/20120417103003_create_trips.rb @@ -0,0 +1,12 @@ +class CreateTrips < ActiveRecord::Migration + def change + create_table :trips do |t| + t.string :name + t.text :description + t.date :date + t.integer :user_id + + t.timestamps + end + end +end diff --git a/db/migrate/20120417143006_create_visits.rb b/db/migrate/20120417143006_create_visits.rb new file mode 100644 index 0000000..248b6be --- /dev/null +++ b/db/migrate/20120417143006_create_visits.rb @@ -0,0 +1,11 @@ +class CreateVisits < ActiveRecord::Migration + def change + create_table :visits do |t| + t.integer :trip_id + t.integer :site_id + t.integer :hour + + t.timestamps + end + end +end diff --git a/db/migrate/20120418174404_geo_loc.rb b/db/migrate/20120418174404_geo_loc.rb new file mode 100644 index 0000000..cb2f62b --- /dev/null +++ b/db/migrate/20120418174404_geo_loc.rb @@ -0,0 +1,17 @@ +class GeoLoc < ActiveRecord::Migration +def up + change_table :sites do |t| + t.column :latitud,:double + t.column :longitud,:double + t.column :zoom,:double + end + end + + def down + change_table :sites do |t| + t.remove :latitud + t.remove :longitud + t.remove :zoom + end + end +end diff --git a/db/migrate/20120427152344_add_paperclip_to_sites.rb b/db/migrate/20120427152344_add_paperclip_to_sites.rb new file mode 100644 index 0000000..b9bbcbc --- /dev/null +++ b/db/migrate/20120427152344_add_paperclip_to_sites.rb @@ -0,0 +1,19 @@ +class AddPaperclipToSites < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :image_file_name, :string + t.column :image_content_type, :string + t.column :image_file_size, :string + t.column :image_updated_at, :datetime + end + end + + def down + change_table :sites do |t| + t.remove :image_file_name, :string + t.remove :image_content_type, :string + t.remove :image_file_size, :string + t.remove :image_updated_at, :datetime + end + end +end diff --git a/db/migrate/20120427161139_site_visitas.rb b/db/migrate/20120427161139_site_visitas.rb new file mode 100644 index 0000000..6978e14 --- /dev/null +++ b/db/migrate/20120427161139_site_visitas.rb @@ -0,0 +1,13 @@ +class SiteVisitas < ActiveRecord::Migration + def self.up + change_table :sites do |t| + t.column :visitas , :integer, :default => 0 + end + end + + def self.down + change_table :sites do |t| + t.remove :visitas + end + end +end diff --git a/db/schema.rb b/db/schema.rb index de057ba..efcf717 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,13 +11,39 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120320100145) do +ActiveRecord::Schema.define(:version => 20120427161139) do + + create_table "comentarios", :force => true do |t| + t.string "coment" + t.integer "user_id" + t.integer "site_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end create_table "sites", :force => true do |t| t.string "name" t.text "description" t.integer "type_id" t.string "image_url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + t.float "latitud" + t.float "longitud" + t.float "zoom" + t.string "image_file_name" + t.string "image_content_type" + t.string "image_file_size" + t.datetime "image_updated_at" + t.integer "visitas", :default => 0 + end + + create_table "trips", :force => true do |t| + t.string "name" + t.text "description" + t.date "date" + t.integer "user_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end @@ -29,4 +55,31 @@ t.datetime "updated_at", :null => false end + create_table "users", :force => true do |t| + t.string "email", :default => "", :null => false + t.string "encrypted_password", :default => "", :null => false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "name" + end + + add_index "users", ["email"], :name => "index_users_on_email", :unique => true + add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + + create_table "visits", :force => true do |t| + t.integer "trip_id" + t.integer "site_id" + t.integer "hour" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + end diff --git a/doc/app/ApplicationController.html b/doc/app/ApplicationController.html new file mode 100644 index 0000000..04bd7c9 --- /dev/null +++ b/doc/app/ApplicationController.html @@ -0,0 +1,163 @@ + + + + + + +class ApplicationController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ApplicationController

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

module ApplicationHelper

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

class Comentario

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

class ComentariosController

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

Public Instance Methods

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

POST /comentarios POST /comentarios.json

+ + + +
+
# File app/controllers/comentarios_controller.rb, line 55
+def create
+
+  @comentario = current_user.comentarios.build(params[:comentario])#creamos un comentario con lo que nos pasa el formulario
+  @comentario.site_id = params[:site_id]
+
+  respond_to do |format|
+    if @comentario.save
+      format.html { redirect_to site_comentarios_url, notice: 'Comentario was successfully created.' }
+      format.json { render json: site_comentarios_url, status: :created, location: site_comentarios_url }
+    else
+      format.html { render action: "new" }
+      format.json { render json: @comentario.errors, status: :unprocessable_entity }
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ +

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

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

GET /comentarios/1/edit

+ + + +
+
# File app/controllers/comentarios_controller.rb, line 48
+def edit
+  @comentario = current_user.comentarios.find(params[:id])
+  
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/comentarios_controller.rb, line 5
+ def index
+  
+
+
+
+    @comentarios = Site.find(params[:site_id]).comentarios  # path: /types/id/sites
+   
+ 
+
+    
+  respond_to do |format|
+    format.html # index.html.erb
+    format.json { render json: @sites }
+ 
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ +

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

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

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

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

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

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

module ComentariosHelper

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

class PlanetController

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

Public Instance Methods

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

GET /planet/author

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

GET /planet/contact

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

GET /planet/ejemplo

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

GET /planet/index

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

module PlanetHelper

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

class Site

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

class SitesController

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

Public Instance Methods

+ + +
+ +
+ count_visit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/sites_controller.rb, line 5
+def count_visit
+  @site.increment!(:visitas)
+end
+
+ +
+ + + + +
+ + +
+ +
+ create() + click to toggle source +
+ + +
+ +

POST /sites POST /sites.json

+ + + +
+
# File app/controllers/sites_controller.rb, line 52
+def create
+  @site = current_user.sites.build(params[:site])
+
+  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 84
+def destroy
+  @site = current_user.sites.find(params[:id])
+  @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 46
+def edit
+  @site = current_user.sites.find(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ +

GET /sites GET /sites.json

+ + + +
+
# File app/controllers/sites_controller.rb, line 11
+def index
+  if params[:type_id].nil? or params[:type_id].empty?
+    @sites = Site.all            # path: /types
+    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 36
+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 25
+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 68
+def update
+  @site = current_user.sites.find(params[:id])
+
+  respond_to do |format|
+    if @site.update_attributes(params[:site])
+      format.html { redirect_to @site, notice: 'Site was successfully updated.' }
+      format.json { head :no_content }
+    else
+      format.html { render action: "edit" }
+      format.json { render json: @site.errors, status: :unprocessable_entity }
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/SitesHelper.html b/doc/app/SitesHelper.html new file mode 100644 index 0000000..146bf3e --- /dev/null +++ b/doc/app/SitesHelper.html @@ -0,0 +1,157 @@ + + + + + + +module SitesHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module SitesHelper

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

class Trip

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

class TripsController

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

Public Instance Methods

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

POST /trips POST /trips.json

+ + + +
+
# File app/controllers/trips_controller.rb, line 45
+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 77
+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 39
+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 6
+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 29
+def new
+  @trip = current_user.trips.build #crea viaje vacio
+
+  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 17
+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 61
+def update
+  @trip = current_user.trips.find(params[:id])
+
+  respond_to do |format|
+    if @trip.update_attributes(params[:trip])
+      format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }
+      format.json { head :no_content }
+    else
+      format.html { render action: "edit" }
+      format.json { render json: @trip.errors, status: :unprocessable_entity }
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/TripsHelper.html b/doc/app/TripsHelper.html new file mode 100644 index 0000000..b79e648 --- /dev/null +++ b/doc/app/TripsHelper.html @@ -0,0 +1,157 @@ + + + + + + +module TripsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module TripsHelper

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

class Type

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

class TypesController

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

Public Instance Methods

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

POST /types POST /types.json

+ + + +
+
# File app/controllers/types_controller.rb, line 42
+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 76
+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 36
+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 4
+def index
+  @types = Type.all
+
+  respond_to do |format|
+    format.html # index.html.erb
+    format.json { render json: @types }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ +

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

+ + + +
+
# File app/controllers/types_controller.rb, line 26
+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 +
+ + +
+ + + + + +
+
# File app/controllers/types_controller.rb, line 86
+def ordered_index
+  @types = Type.find(:all, :order => :name) 
+
+  respond_to do |format|
+    format.html # show.html.erb
+    format.json { render json: @type }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ +

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

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

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

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

module TypesHelper

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

class User

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

class Visit

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

class VisitsController

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

Public Instance Methods

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

POST /visits POST /visits.json

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

module VisitsHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/created.rid b/doc/app/created.rid new file mode 100644 index 0000000..27801df --- /dev/null +++ b/doc/app/created.rid @@ -0,0 +1,22 @@ +Sat, 28 Apr 2012 13:04:54 +0200 +doc/README_FOR_APP Sun, 15 Apr 2012 17:14:47 +0200 +app/controllers/application_controller.rb Sun, 15 Apr 2012 17:14:47 +0200 +app/controllers/comentarios_controller.rb Sun, 22 Apr 2012 15:17:23 +0200 +app/controllers/planet_controller.rb Wed, 25 Apr 2012 14:06:42 +0200 +app/controllers/sites_controller.rb Fri, 27 Apr 2012 18:16:38 +0200 +app/controllers/trips_controller.rb Tue, 17 Apr 2012 17:16:18 +0200 +app/controllers/types_controller.rb Thu, 19 Apr 2012 20:18:54 +0200 +app/controllers/visits_controller.rb Wed, 25 Apr 2012 13:32:25 +0200 +app/helpers/application_helper.rb Sun, 15 Apr 2012 17:14:47 +0200 +app/helpers/comentarios_helper.rb Sun, 15 Apr 2012 19:56:13 +0200 +app/helpers/planet_helper.rb Sun, 15 Apr 2012 17:14:47 +0200 +app/helpers/sites_helper.rb Sun, 15 Apr 2012 17:14:47 +0200 +app/helpers/trips_helper.rb Tue, 17 Apr 2012 12:30:04 +0200 +app/helpers/types_helper.rb Sun, 15 Apr 2012 17:14:47 +0200 +app/helpers/visits_helper.rb Tue, 17 Apr 2012 16:30:06 +0200 +app/models/comentario.rb Sun, 15 Apr 2012 20:08:19 +0200 +app/models/site.rb Fri, 27 Apr 2012 17:27:02 +0200 +app/models/trip.rb Tue, 17 Apr 2012 16:41:27 +0200 +app/models/type.rb Sun, 15 Apr 2012 17:54:35 +0200 +app/models/user.rb Tue, 17 Apr 2012 12:36:10 +0200 +app/models/visit.rb Tue, 17 Apr 2012 16:42:02 +0200 diff --git a/doc/app/doc/README_FOR_APP.html b/doc/app/doc/README_FOR_APP.html new file mode 100644 index 0000000..577df8f --- /dev/null +++ b/doc/app/doc/README_FOR_APP.html @@ -0,0 +1,123 @@ + + + + + + +README_FOR_APP - Rails Application Documentation + + + + + + + + + + + + + + + + +
+ +

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

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

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

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

Table of Contents - Rails Application Documentation

+ +

Pages

+ + +

Classes/Modules

+ + +

Methods

+ + + + + diff --git a/public/doc/ApplicationController.html b/public/doc/ApplicationController.html new file mode 100644 index 0000000..04bd7c9 --- /dev/null +++ b/public/doc/ApplicationController.html @@ -0,0 +1,163 @@ + + + + + + +class ApplicationController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ApplicationController

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

module ApplicationHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/public/doc/Comentario.html b/public/doc/Comentario.html new file mode 100644 index 0000000..cd5851e --- /dev/null +++ b/public/doc/Comentario.html @@ -0,0 +1,163 @@ + + + + + + +class Comentario - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Comentario

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

class ComentariosController

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

Public Instance Methods

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

POST /comentarios POST /comentarios.json

+ + + +
+
# File app/controllers/comentarios_controller.rb, line 55
+def create
+
+  @comentario = current_user.comentarios.build(params[:comentario])#creamos un comentario con lo que nos pasa el formulario
+  @comentario.site_id = params[:site_id]
+
+  respond_to do |format|
+    if @comentario.save
+      format.html { redirect_to site_comentarios_url, notice: 'Comentario was successfully created.' }
+      format.json { render json: site_comentarios_url, status: :created, location: site_comentarios_url }
+    else
+      format.html { render action: "new" }
+      format.json { render json: @comentario.errors, status: :unprocessable_entity }
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ +

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

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

GET /comentarios/1/edit

+ + + +
+
# File app/controllers/comentarios_controller.rb, line 48
+def edit
+  @comentario = current_user.comentarios.find(params[:id])
+  
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/comentarios_controller.rb, line 5
+ def index
+  
+
+
+
+    @comentarios = Site.find(params[:site_id]).comentarios  # path: /types/id/sites
+   
+ 
+
+    
+  respond_to do |format|
+    format.html # index.html.erb
+    format.json { render json: @sites }
+ 
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ +

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

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

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

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

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

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

module ComentariosHelper

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

class PlanetController

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

Public Instance Methods

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

GET /planet/author

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

GET /planet/contact

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

GET /planet/ejemplo

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

GET /planet/index

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

module PlanetHelper

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

class Site

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

class SitesController

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

Public Instance Methods

+ + +
+ +
+ count_visit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/sites_controller.rb, line 5
+def count_visit
+  @site.increment!(:visitas)
+end
+
+ +
+ + + + +
+ + +
+ +
+ create() + click to toggle source +
+ + +
+ +

POST /sites POST /sites.json

+ + + +
+
# File app/controllers/sites_controller.rb, line 52
+def create
+  @site = current_user.sites.build(params[:site])
+
+  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 84
+def destroy
+  @site = current_user.sites.find(params[:id])
+  @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 46
+def edit
+  @site = current_user.sites.find(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ +

GET /sites GET /sites.json

+ + + +
+
# File app/controllers/sites_controller.rb, line 11
+def index
+  if params[:type_id].nil? or params[:type_id].empty?
+    @sites = Site.all            # path: /types
+    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 36
+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 25
+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 68
+def update
+  @site = current_user.sites.find(params[:id])
+
+  respond_to do |format|
+    if @site.update_attributes(params[:site])
+      format.html { redirect_to @site, notice: 'Site was successfully updated.' }
+      format.json { head :no_content }
+    else
+      format.html { render action: "edit" }
+      format.json { render json: @site.errors, status: :unprocessable_entity }
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/public/doc/SitesHelper.html b/public/doc/SitesHelper.html new file mode 100644 index 0000000..146bf3e --- /dev/null +++ b/public/doc/SitesHelper.html @@ -0,0 +1,157 @@ + + + + + + +module SitesHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module SitesHelper

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

class Trip

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

class TripsController

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

Public Instance Methods

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

POST /trips POST /trips.json

+ + + +
+
# File app/controllers/trips_controller.rb, line 45
+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 77
+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 39
+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 6
+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 29
+def new
+  @trip = current_user.trips.build #crea viaje vacio
+
+  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 17
+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 61
+def update
+  @trip = current_user.trips.find(params[:id])
+
+  respond_to do |format|
+    if @trip.update_attributes(params[:trip])
+      format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }
+      format.json { head :no_content }
+    else
+      format.html { render action: "edit" }
+      format.json { render json: @trip.errors, status: :unprocessable_entity }
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/public/doc/TripsHelper.html b/public/doc/TripsHelper.html new file mode 100644 index 0000000..b79e648 --- /dev/null +++ b/public/doc/TripsHelper.html @@ -0,0 +1,157 @@ + + + + + + +module TripsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module TripsHelper

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

class Type

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

class TypesController

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

Public Instance Methods

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

POST /types POST /types.json

+ + + +
+
# File app/controllers/types_controller.rb, line 42
+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 76
+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 36
+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 4
+def index
+  @types = Type.all
+
+  respond_to do |format|
+    format.html # index.html.erb
+    format.json { render json: @types }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ +

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

+ + + +
+
# File app/controllers/types_controller.rb, line 26
+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 +
+ + +
+ + + + + +
+
# File app/controllers/types_controller.rb, line 86
+def ordered_index
+  @types = Type.find(:all, :order => :name) 
+
+  respond_to do |format|
+    format.html # show.html.erb
+    format.json { render json: @type }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ +

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

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

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

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

module TypesHelper

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

class User

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

class Visit

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

class VisitsController

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

Public Instance Methods

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

POST /visits POST /visits.json

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

module VisitsHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/public/doc/created.rid b/public/doc/created.rid new file mode 100644 index 0000000..27801df --- /dev/null +++ b/public/doc/created.rid @@ -0,0 +1,22 @@ +Sat, 28 Apr 2012 13:04:54 +0200 +doc/README_FOR_APP Sun, 15 Apr 2012 17:14:47 +0200 +app/controllers/application_controller.rb Sun, 15 Apr 2012 17:14:47 +0200 +app/controllers/comentarios_controller.rb Sun, 22 Apr 2012 15:17:23 +0200 +app/controllers/planet_controller.rb Wed, 25 Apr 2012 14:06:42 +0200 +app/controllers/sites_controller.rb Fri, 27 Apr 2012 18:16:38 +0200 +app/controllers/trips_controller.rb Tue, 17 Apr 2012 17:16:18 +0200 +app/controllers/types_controller.rb Thu, 19 Apr 2012 20:18:54 +0200 +app/controllers/visits_controller.rb Wed, 25 Apr 2012 13:32:25 +0200 +app/helpers/application_helper.rb Sun, 15 Apr 2012 17:14:47 +0200 +app/helpers/comentarios_helper.rb Sun, 15 Apr 2012 19:56:13 +0200 +app/helpers/planet_helper.rb Sun, 15 Apr 2012 17:14:47 +0200 +app/helpers/sites_helper.rb Sun, 15 Apr 2012 17:14:47 +0200 +app/helpers/trips_helper.rb Tue, 17 Apr 2012 12:30:04 +0200 +app/helpers/types_helper.rb Sun, 15 Apr 2012 17:14:47 +0200 +app/helpers/visits_helper.rb Tue, 17 Apr 2012 16:30:06 +0200 +app/models/comentario.rb Sun, 15 Apr 2012 20:08:19 +0200 +app/models/site.rb Fri, 27 Apr 2012 17:27:02 +0200 +app/models/trip.rb Tue, 17 Apr 2012 16:41:27 +0200 +app/models/type.rb Sun, 15 Apr 2012 17:54:35 +0200 +app/models/user.rb Tue, 17 Apr 2012 12:36:10 +0200 +app/models/visit.rb Tue, 17 Apr 2012 16:42:02 +0200 diff --git a/public/doc/doc/README_FOR_APP.html b/public/doc/doc/README_FOR_APP.html new file mode 100644 index 0000000..577df8f --- /dev/null +++ b/public/doc/doc/README_FOR_APP.html @@ -0,0 +1,123 @@ + + + + + + +README_FOR_APP - Rails Application Documentation + + + + + + + + + + + + + + + + +
+ +

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

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

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

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

Table of Contents - Rails Application Documentation

+ +

Pages

+ + +

Classes/Modules

+ + +

Methods

+ + + + + diff --git a/test/fixtures/comentarios.yml b/test/fixtures/comentarios.yml new file mode 100644 index 0000000..cf5a574 --- /dev/null +++ b/test/fixtures/comentarios.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + coment: MyString + user: one + site: one + +two: + coment: MyString + user: one + site: one diff --git a/test/fixtures/sites.yml b/test/fixtures/sites.yml index 0b20b0a..a326b0f 100644 --- a/test/fixtures/sites.yml +++ b/test/fixtures/sites.yml @@ -1,13 +1,13 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html - one: name: MyString description: MyText - type_id: 1 + type: one image_url: MyString + user: one two: - name: MyString - description: MyText - type_id: 1 - image_url: MyString + name: YourString + description: YourText + type: two + image_url: YourString + user: two \ No newline at end of file diff --git a/test/fixtures/trips.yml b/test/fixtures/trips.yml new file mode 100644 index 0000000..65db0f0 --- /dev/null +++ b/test/fixtures/trips.yml @@ -0,0 +1,11 @@ +one: + name: MyString + description: MyText + date: 2012-04-09 + user: one + +two: + name: YourString + description: YourText + date: 2012-04-09 + user: two diff --git a/test/fixtures/types.yml b/test/fixtures/types.yml index 53b2c6a..8683ea9 100644 --- a/test/fixtures/types.yml +++ b/test/fixtures/types.yml @@ -7,3 +7,6 @@ one: two: name: MyString description: MyText + + +# Podriamos añadir nuevos datos de inicialización, que se referencian como # -> types(:monumento) types(:naturaleza) monumento: name: Monumento description: “Edificio o construcción de valor historico” naturaleza: name: Naturaleza description: “Lugar al aire libre de interés natural” \ No newline at end of file diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..7ab5964 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,17 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: + name: Jose Perez + email: jose.perez@gmail.com + encrypted_password: perez22222 +# column: value +# +two: + name: Jose Perez + email: jose.perez@me.com + encrypted_password: perez33333 +# column: value \ No newline at end of file diff --git a/test/fixtures/visits.yml b/test/fixtures/visits.yml new file mode 100644 index 0000000..adbb64d --- /dev/null +++ b/test/fixtures/visits.yml @@ -0,0 +1,9 @@ +one: + trip: one + site: one + hour: 9 + +two: + trip: two + site: two + hour: 9 \ No newline at end of file diff --git a/test/functional/comentarios_controller_test.rb b/test/functional/comentarios_controller_test.rb new file mode 100644 index 0000000..ce99c25 --- /dev/null +++ b/test/functional/comentarios_controller_test.rb @@ -0,0 +1,43 @@ +require 'test_helper' + +class ComentariosControllerTest < ActionController::TestCase + setup do + @comentario = comentarios(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:comentarios) + end + + + + test "should create comentario" do + assert_difference('Comentario.count') do + post :create, comentario: @comentario.attributes + end + + assert_redirected_to comentarios_path(assigns(:comentario)) + end + + + + test "should get edit" do + get :edit, id: @comentario + assert_response :success + end + + test "should update comentario" do + put :update, id: @comentario, comentario: @comentario.attributes + assert_redirected_to comentarios_path(assigns(:comentario)) + end + + test "should destroy comentario" do + assert_difference('Comentario.count', -1) do + delete :destroy, id: @comentario + end + + assert_redirected_to comentarios_path + end +end diff --git a/test/functional/sites_controller_test.rb b/test/functional/sites_controller_test.rb index beac6d1..3702e5b 100644 --- a/test/functional/sites_controller_test.rb +++ b/test/functional/sites_controller_test.rb @@ -1,8 +1,15 @@ require 'test_helper' class SitesControllerTest < ActionController::TestCase - setup do + setup do @site = sites(:one) + @update = { # @update: parametros diferentes + :name => 'AnotherType', + :description => 'AnotherText', + :type_id => types(:one).id + } + @user = @site.user + sign_in @user end test "should get index" do @@ -17,8 +24,10 @@ class SitesControllerTest < ActionController::TestCase end test "should create site" do + #Comprueba que tabla crece (+1) + assert_difference('Site.count') do - post :create, site: @site.attributes + post :create, site: @update end assert_redirected_to site_path(assigns(:site)) @@ -35,7 +44,7 @@ class SitesControllerTest < ActionController::TestCase end test "should update site" do - put :update, id: @site, site: @site.attributes + put :update, id: @site, site: @update assert_redirected_to site_path(assigns(:site)) end diff --git a/test/functional/trips_controller_test.rb b/test/functional/trips_controller_test.rb new file mode 100644 index 0000000..b09dce2 --- /dev/null +++ b/test/functional/trips_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class TripsControllerTest < ActionController::TestCase + setup do + @trip = trips(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:trips) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create trip" do + assert_difference('Trip.count') do + post :create, trip: @trip.attributes + end + + assert_redirected_to trip_path(assigns(:trip)) + end + + test "should show trip" do + get :show, id: @trip + assert_response :success + end + + test "should get edit" do + get :edit, id: @trip + assert_response :success + end + + test "should update trip" do + put :update, id: @trip, trip: @trip.attributes + assert_redirected_to trip_path(assigns(:trip)) + end + + test "should destroy trip" do + assert_difference('Trip.count', -1) do + delete :destroy, id: @trip + end + + assert_redirected_to trips_path + end +end diff --git a/test/functional/types_controller_test.rb b/test/functional/types_controller_test.rb index 2e1931b..d8b0dc1 100644 --- a/test/functional/types_controller_test.rb +++ b/test/functional/types_controller_test.rb @@ -3,6 +3,10 @@ class TypesControllerTest < ActionController::TestCase setup do @type = types(:one) + @update = { # @update: parametros diferentes + :name => 'AnotherType', + :description => 'AnotherText', + } end test "should get index" do @@ -18,7 +22,7 @@ class TypesControllerTest < ActionController::TestCase test "should create type" do assert_difference('Type.count') do - post :create, type: @type.attributes + post :create, type: @update end assert_redirected_to type_path(assigns(:type)) @@ -35,7 +39,7 @@ class TypesControllerTest < ActionController::TestCase end test "should update type" do - put :update, id: @type, type: @type.attributes + put :update, id: @type, type: @update assert_redirected_to type_path(assigns(:type)) end diff --git a/test/functional/visits_controller_test.rb b/test/functional/visits_controller_test.rb new file mode 100644 index 0000000..45397e3 --- /dev/null +++ b/test/functional/visits_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class VisitsControllerTest < ActionController::TestCase + setup do + @visit = visits(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:visits) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create visit" do + assert_difference('Visit.count') do + post :create, visit: @visit.attributes + end + + assert_redirected_to visit_path(assigns(:visit)) + end + + test "should show visit" do + get :show, id: @visit + assert_response :success + end + + test "should get edit" do + get :edit, id: @visit + assert_response :success + end + + test "should update visit" do + put :update, id: @visit, visit: @visit.attributes + assert_redirected_to visit_path(assigns(:visit)) + end + + test "should destroy visit" do + assert_difference('Visit.count', -1) do + delete :destroy, id: @visit + end + + assert_redirected_to visits_path + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 8bf1192..4518953 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -9,5 +9,10 @@ class ActiveSupport::TestCase # -- they do not yet inherit this setting fixtures :all + # Add more helper methods to be used by all tests here... end + +ActionController::TestCase.class_eval do + include Devise::TestHelpers +end \ No newline at end of file diff --git a/test/unit/comentario_test.rb b/test/unit/comentario_test.rb new file mode 100644 index 0000000..02f982d --- /dev/null +++ b/test/unit/comentario_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ComentarioTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/comentarios_helper_test.rb b/test/unit/helpers/comentarios_helper_test.rb new file mode 100644 index 0000000..d553eef --- /dev/null +++ b/test/unit/helpers/comentarios_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ComentariosHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/trips_helper_test.rb b/test/unit/helpers/trips_helper_test.rb new file mode 100644 index 0000000..dcfddff --- /dev/null +++ b/test/unit/helpers/trips_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class TripsHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/visits_helper_test.rb b/test/unit/helpers/visits_helper_test.rb new file mode 100644 index 0000000..6f1596c --- /dev/null +++ b/test/unit/helpers/visits_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class VisitsHelperTest < ActionView::TestCase +end diff --git a/test/unit/site_test.rb b/test/unit/site_test.rb index 38c8dd0..57a31a6 100644 --- a/test/unit/site_test.rb +++ b/test/unit/site_test.rb @@ -4,4 +4,14 @@ class SiteTest < ActiveSupport::TestCase # test "the truth" do # assert true # end + + # site creado sin atributos es invalido y genera errores + test "Site attributes must not be empty" do + site = Site.new + assert site.invalid? # Test pasa si validación no pasa + assert site.errors[:name].any? + assert not(site.errors[:description].any?) + assert site.errors[:type_id].any? + + end end diff --git a/test/unit/trip_test.rb b/test/unit/trip_test.rb new file mode 100644 index 0000000..1ed8ca6 --- /dev/null +++ b/test/unit/trip_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TripTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/type_test.rb b/test/unit/type_test.rb index 0ce1172..7c92595 100644 --- a/test/unit/type_test.rb +++ b/test/unit/type_test.rb @@ -4,4 +4,12 @@ class TypeTest < ActiveSupport::TestCase # test "the truth" do # assert true # end + + # type creado sin atributos es invalido y genera errores + test "Type attributes must not be empty" do + type = Type.new + assert type.invalid? # Test pasa si validación no pasa + assert type.errors[:name].any? + assert type.errors[:description].any? + end end diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/unit/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/visit_test.rb b/test/unit/visit_test.rb new file mode 100644 index 0000000..a34aa33 --- /dev/null +++ b/test/unit/visit_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class VisitTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end