diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 28a4c21..e751592 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,7 @@ # ignore al .DS_store files of MAC OSX .DS_Store + +# ignore paperclip installation files +public/system +.project diff --git a/Gemfile b/Gemfile old mode 100644 new mode 100755 index ca448a6..e8051e0 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,8 @@ gem 'sqlite3' gem 'devise' +gem 'paperclip' + # Gems used only for assets and not required # in production environments by default. group :assets do diff --git a/Gemfile.lock b/Gemfile.lock old mode 100644 new mode 100755 index 36f623e..6247569 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,6 +32,7 @@ GEM 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) @@ -61,6 +62,12 @@ GEM mime-types (1.17.2) multi_json (1.1.0) orm_adapter (0.0.7) + paperclip (3.0.2) + activemodel (>= 3.0.0) + activerecord (>= 3.0.0) + activesupport (>= 3.0.0) + cocaine (>= 0.0.2) + mime-types polyglot (0.3.3) rack (1.4.1) rack-cache (1.2) @@ -117,6 +124,7 @@ DEPENDENCIES coffee-rails (~> 3.2.1) devise jquery-rails + paperclip rails (= 3.2.2) sass-rails (~> 3.2.3) sqlite3 diff --git a/README.rdoc b/README.rdoc old mode 100644 new mode 100755 diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 diff --git a/app/assets/images/arbol1.png b/app/assets/images/arbol1.png old mode 100644 new mode 100755 diff --git a/app/assets/images/florencia.png b/app/assets/images/florencia.png old mode 100644 new mode 100755 diff --git a/app/assets/images/foto.png b/app/assets/images/foto.png new file mode 100755 index 0000000..b3d8db1 Binary files /dev/null and b/app/assets/images/foto.png differ diff --git a/app/assets/images/logo3.png b/app/assets/images/logo3.png old mode 100644 new mode 100755 diff --git a/app/assets/images/pedriza.png b/app/assets/images/pedriza.png old mode 100644 new mode 100755 diff --git a/app/assets/images/pedriza2-m.png b/app/assets/images/pedriza2-m.png old mode 100644 new mode 100755 diff --git a/app/assets/images/pergamo.png b/app/assets/images/pergamo.png old mode 100644 new mode 100755 diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png old mode 100644 new mode 100755 diff --git a/app/assets/images/reichstag.png b/app/assets/images/reichstag.png old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/comentarios.js.coffee b/app/assets/javascripts/comentarios.js.coffee new file mode 100755 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/planet.js.coffee b/app/assets/javascripts/planet.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/sites.js.coffee b/app/assets/javascripts/sites.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/trips.js.coffee b/app/assets/javascripts/trips.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/types.js.coffee b/app/assets/javascripts/types.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/visits.js.coffee b/app/assets/javascripts/visits.js.coffee old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/comentarios.css.scss b/app/assets/stylesheets/comentarios.css.scss new file mode 100755 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 old mode 100644 new mode 100755 index c6334b0..c0b7953 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -97,6 +97,7 @@ margin-left: 9em; /* Ajuste de borde izquierdo */ padding-top: 4ex; padding-left: 2em; + padding-bottom: 1em; background: white; } @@ -113,6 +114,16 @@ color: #bfb; font-size: small; } + +#bottom { + padding: 1em; + text-align: center; +} + +#bottom a { + color: #bfb; + font-size: small; +} /* END:mainlayout */ /* An entry in the store catalog (no utilizados de momento) */ @@ -161,3 +172,15 @@ font-weight: bold; margin-right: 2em; } + +#map_canvas { + width: 300px; + height: 300px; + float: right; + margin-right: 100px; +} + +#author-photo { + float: right; + margin-right: 100px; +} diff --git a/app/assets/stylesheets/planet.css.scss b/app/assets/stylesheets/planet.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/planet.css~ b/app/assets/stylesheets/planet.css~ new file mode 100755 index 0000000..464074a --- /dev/null +++ b/app/assets/stylesheets/planet.css~ @@ -0,0 +1,187 @@ +/* Global styles (no utilizados de momento) */ + +#planet #notice { + color: #000; + border: 2px solid red; + padding: 1em; + margin-bottom: 2em; + background-color: #f0f0f0; + font: bold smaller sans-serif; +} + + +#planet h1 { + font: 150% sans-serif; + color: #226; + border-bottom: 3px dotted #77d; +} + +/* Styles for products/index */ + +#site_list table { + border-collapse: collapse; +} + +#site_list table tr td { + padding: 5px; + vertical-align: top; +} + +#site_list .list_image { + width: 60px; + height: 70px; +} + +#site_list .list_description { + width: 60%; +} + +#site_list .list_description dl { + margin: 0; +} + +#site_list .list_description dt { + color: #244; + font-weight: bold; + font-size: larger; +} + +#site_list .list_description dd { + margin: 0; +} + +#site_list .list_actions { + font-size: x-small; + text-align: right; + padding-left: 1em; +} + +#site_list .list_line_even { + background: #a8b8f8; +} + +#site_list .list_line_odd { + background: #88b0f8; +} + + +/* START:mainlayout */ +/* Styles for main page */ + +#banner { + background: #668; + padding-top: 10px; + padding-bottom: 10px; + border-bottom: 2px solid; + font: small-caps 40px/40px "Times New Roman", serif; + color: #bfb; + text-align: center; +} + +#banner img { + float: left; + padding-left: 10px; +} + +#banner .user { + float: right; + color: #bfb; + font-size: small; +} + +#columns { + background: #446; +} + +#main { + margin-left: 9em; /* Ajuste de borde izquierdo */ + padding-top: 4ex; + padding-left: 2em; + padding-bottom: 1em; + background: white; +} + +#side { + float: left; + padding-top: 1em; + padding-left: 1em; + padding-bottom: 1em; + width: 8em; /* Ajuste de borde izquierdo */ + background: #446; +} + +#side a { + color: #bfb; + font-size: small; +} + +#bottom { + padding: 1em; + text-align: center; +} + +#bottom a { + color: #bfb; + font-size: small; +} +/* END:mainlayout */ + +/* An entry in the store catalog (no utilizados de momento) */ + +#planet .entry { + overflow: auto; + margin-top: 1em; + border-bottom: 1px dotted #77d; +} + +#planet .name { + font-size: 120%; + font-family: sans-serif; +} + +#store .entry img { + width: 80px; + margin-right: 5px; + margin-bottom: 5px; + float: left; +} + + +#store .entry h3 { + margin-top: 0; + margin-bottom: 2px; + color: #227; +} + +#store .entry p { + margin-top: 0.5em; + margin-bottom: 0.8em; +} + +#store .entry .price_line { + clear: both; + margin-bottom: 0.5em; +} + +#store .entry .add_to_cart { + position: relative; +} + +#store .entry .price { + color: #44a; + font-weight: bold; + margin-right: 2em; +} + +#map_canvas { + width: 300px; + height: 300px; + float: right; + margin-right: 100px; +} + +#author-photo { + float: left; + position: absolute; + margin-left: 500px; +} diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/sites.css.scss b/app/assets/stylesheets/sites.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/trips.css.scss b/app/assets/stylesheets/trips.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/types.css.scss b/app/assets/stylesheets/types.css.scss old mode 100644 new mode 100755 diff --git a/app/assets/stylesheets/visits.css.scss b/app/assets/stylesheets/visits.css.scss old mode 100644 new mode 100755 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/comentarios_controller.rb b/app/controllers/comentarios_controller.rb new file mode 100755 index 0000000..8282b9f --- /dev/null +++ b/app/controllers/comentarios_controller.rb @@ -0,0 +1,181 @@ +class ComentariosController < ApplicationController + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] + + # GET /comentarios + # GET /comentarios.json + def index + if params[:site_id].nil? or params[:site_id].empty? + @comentarios = Comentario.all # path: /sites + else + @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios + end + respond_to do |format| + format.html # index.html.erb + format.json { render json: @comentarios } + end + end + + # GET /comentarios/1 + # GET /comentarios/1.json + def show + @comentario = Comentario.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comentario } + end + end + + # GET /comentarios/new + # GET /comentarios/new.json + def new + @comentario = current_user.comentarios.build # crea sitio vacio asociado a current_user + + 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]) # busca solo en sitios asociados a current_user + end + + # POST /comentarios + # POST /comentarios.json + def create + @comentario = current_user.comentarios.build(params[:comentario]) # Asigna solo si sitio asociado a current_user + + respond_to do |format| + if @comentario.save + format.html { redirect_to @comentario, notice: 'Comentario was successfully created.' } + format.json { render json: @comentario, status: :created, location: @comentario } + else + format.html { render action: "new" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # PUT /comentarios/1 + # PUT /comentarios/1.json + def update + @comentario = current_user.comentarios.find(params[:id]) # busca solo en sitios asociados a current_user + + respond_to do |format| + if @comentario.update_attributes(params[:comentario]) + format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comentarios/1 + # DELETE /comentarios/1.json + def destroy + @comentario = current_user.comentarios.find(params[:id]) # busca solo en sitios asociados a current_user + @comentario.destroy + + respond_to do |format| + format.html { redirect_to comentarios_url } + format.json { head :no_content } + end + end +end + + +#class ComentariosController < ApplicationController +# +# # authenticate_user! ejecuta acción solo si sesión existe +# before_filter :authenticate_user!, :except => [ :index, :show ] +# +# # GET /comentarios +# # GET /comentarios.json +# def index +# @comentarios = Comentario.all +# +# respond_to do |format| +# format.html # index.html.erb +# format.json { render json: @comentarios } +# end +# end +# +# # GET /comentarios/1 +# # GET /comentarios/1.json +# def show +# @comentario = Comentario.find(params[:id]) +# +# respond_to do |format| +# format.html # show.html.erb +# format.json { render json: @comentario } +# end +# end +# +# # GET /comentarios/new +# # GET /comentarios/new.json +# def new +# @comentario = Comentario.new +# +# respond_to do |format| +# format.html # new.html.erb +# format.json { render json: @comentario } +# end +# end +# +# # GET /comentarios/1/edit +# def edit +# @comentario = Comentario.find(params[:id]) +# end +# +# # POST /comentarios +# # POST /comentarios.json +# def create +# @comentario = Comentario.new(params[:comentario]) +# +# respond_to do |format| +# if @comentario.save +# format.html { redirect_to @comentario, notice: 'Comentario was successfully #created.' } +# format.json { render json: @comentario, status: :created, location: @comentario } +# else +# format.html { render action: "new" } +# format.json { render json: @comentario.errors, status: :unprocessable_entity } +# end +# end +# end +# +# # PUT /comentarios/1 +# # PUT /comentarios/1.json +# def update +# @comentario = Comentario.find(params[:id]) +# +# respond_to do |format| +# if @comentario.update_attributes(params[:comentario]) +# format.html { redirect_to @comentario, notice: 'Comentario was successfully #updated.' } +# format.json { head :no_content } +# else +# format.html { render action: "edit" } +# format.json { render json: @comentario.errors, status: :unprocessable_entity } +# end +# end +# end +# +# # DELETE /comentarios/1 +# # DELETE /comentarios/1.json +# def destroy +# @comentario = Comentario.find(params[:id]) +# @comentario.destroy +# +# respond_to do |format| +# format.html { redirect_to comentarios_url } +# format.json { head :no_content } +# end +# end +#end + + diff --git a/app/controllers/comentarios_controller.rb~ b/app/controllers/comentarios_controller.rb~ new file mode 100755 index 0000000..8282b9f --- /dev/null +++ b/app/controllers/comentarios_controller.rb~ @@ -0,0 +1,181 @@ +class ComentariosController < ApplicationController + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] + + # GET /comentarios + # GET /comentarios.json + def index + if params[:site_id].nil? or params[:site_id].empty? + @comentarios = Comentario.all # path: /sites + else + @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios + end + respond_to do |format| + format.html # index.html.erb + format.json { render json: @comentarios } + end + end + + # GET /comentarios/1 + # GET /comentarios/1.json + def show + @comentario = Comentario.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @comentario } + end + end + + # GET /comentarios/new + # GET /comentarios/new.json + def new + @comentario = current_user.comentarios.build # crea sitio vacio asociado a current_user + + 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]) # busca solo en sitios asociados a current_user + end + + # POST /comentarios + # POST /comentarios.json + def create + @comentario = current_user.comentarios.build(params[:comentario]) # Asigna solo si sitio asociado a current_user + + respond_to do |format| + if @comentario.save + format.html { redirect_to @comentario, notice: 'Comentario was successfully created.' } + format.json { render json: @comentario, status: :created, location: @comentario } + else + format.html { render action: "new" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # PUT /comentarios/1 + # PUT /comentarios/1.json + def update + @comentario = current_user.comentarios.find(params[:id]) # busca solo en sitios asociados a current_user + + respond_to do |format| + if @comentario.update_attributes(params[:comentario]) + format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comentarios/1 + # DELETE /comentarios/1.json + def destroy + @comentario = current_user.comentarios.find(params[:id]) # busca solo en sitios asociados a current_user + @comentario.destroy + + respond_to do |format| + format.html { redirect_to comentarios_url } + format.json { head :no_content } + end + end +end + + +#class ComentariosController < ApplicationController +# +# # authenticate_user! ejecuta acción solo si sesión existe +# before_filter :authenticate_user!, :except => [ :index, :show ] +# +# # GET /comentarios +# # GET /comentarios.json +# def index +# @comentarios = Comentario.all +# +# respond_to do |format| +# format.html # index.html.erb +# format.json { render json: @comentarios } +# end +# end +# +# # GET /comentarios/1 +# # GET /comentarios/1.json +# def show +# @comentario = Comentario.find(params[:id]) +# +# respond_to do |format| +# format.html # show.html.erb +# format.json { render json: @comentario } +# end +# end +# +# # GET /comentarios/new +# # GET /comentarios/new.json +# def new +# @comentario = Comentario.new +# +# respond_to do |format| +# format.html # new.html.erb +# format.json { render json: @comentario } +# end +# end +# +# # GET /comentarios/1/edit +# def edit +# @comentario = Comentario.find(params[:id]) +# end +# +# # POST /comentarios +# # POST /comentarios.json +# def create +# @comentario = Comentario.new(params[:comentario]) +# +# respond_to do |format| +# if @comentario.save +# format.html { redirect_to @comentario, notice: 'Comentario was successfully #created.' } +# format.json { render json: @comentario, status: :created, location: @comentario } +# else +# format.html { render action: "new" } +# format.json { render json: @comentario.errors, status: :unprocessable_entity } +# end +# end +# end +# +# # PUT /comentarios/1 +# # PUT /comentarios/1.json +# def update +# @comentario = Comentario.find(params[:id]) +# +# respond_to do |format| +# if @comentario.update_attributes(params[:comentario]) +# format.html { redirect_to @comentario, notice: 'Comentario was successfully #updated.' } +# format.json { head :no_content } +# else +# format.html { render action: "edit" } +# format.json { render json: @comentario.errors, status: :unprocessable_entity } +# end +# end +# end +# +# # DELETE /comentarios/1 +# # DELETE /comentarios/1.json +# def destroy +# @comentario = Comentario.find(params[:id]) +# @comentario.destroy +# +# respond_to do |format| +# format.html { redirect_to comentarios_url } +# format.json { head :no_content } +# end +# end +#end + + diff --git a/app/controllers/planet_controller.rb b/app/controllers/planet_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb old mode 100644 new mode 100755 index ed3047d..886db23 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -2,6 +2,8 @@ class SitesController < ApplicationController # authenticate_user! ejecuta acción solo si sesión existe before_filter :authenticate_user!, :except => [ :index, :show ] + # Definimos un filtro que activa “count_visit” al finalizar la acción show. + after_filter :count_visita, :only => :show # GET /sites # GET /sites.json @@ -87,4 +89,10 @@ def destroy format.json { head :no_content } end end + + private + def count_visita + @site.increment!(:visitas) + end + end diff --git a/app/controllers/sites_controller.rb~ b/app/controllers/sites_controller.rb~ new file mode 100755 index 0000000..886db23 --- /dev/null +++ b/app/controllers/sites_controller.rb~ @@ -0,0 +1,98 @@ +class SitesController < ApplicationController + + # authenticate_user! ejecuta acción solo si sesión existe + before_filter :authenticate_user!, :except => [ :index, :show ] + # Definimos un filtro que activa “count_visit” al finalizar la acción show. + after_filter :count_visita, :only => :show + + # GET /sites + # GET /sites.json + def index + if params[:type_id].nil? or params[:type_id].empty? + @sites = Site.all # path: /types + else + @sites = Type.find(params[:type_id]).sites # path: /types/id/sites + end + respond_to do |format| + format.html # index.html.erb + format.json { render json: @sites } + end + end + + # GET /sites/1 + # GET /sites/1.json + def show + @site = Site.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @site } + end + end + + # GET /sites/new + # GET /sites/new.json + def new + @site = current_user.sites.build # crea sitio vacio asociado a current_user + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @site } + end + end + + # GET /sites/1/edit + def edit + @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user + end + + # POST /sites + # POST /sites.json + def create + @site = current_user.sites.build(params[:site]) # Asigna solo si sitio asociado a current_user + + respond_to do |format| + if @site.save + format.html { redirect_to @site, notice: 'Site was successfully created.' } + format.json { render json: @site, status: :created, location: @site } + else + format.html { render action: "new" } + format.json { render json: @site.errors, status: :unprocessable_entity } + end + end + end + + # PUT /sites/1 + # PUT /sites/1.json + def update + @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user + + respond_to do |format| + if @site.update_attributes(params[:site]) + format.html { redirect_to @site, notice: 'Site was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @site.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /sites/1 + # DELETE /sites/1.json + def destroy + @site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user + @site.destroy + + respond_to do |format| + format.html { redirect_to sites_url } + format.json { head :no_content } + end + end + + private + def count_visita + @site.increment!(:visitas) + end + +end diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb old mode 100644 new mode 100755 index da826f4..0b0457c --- a/app/controllers/types_controller.rb +++ b/app/controllers/types_controller.rb @@ -10,6 +10,18 @@ def index end end + # GET /types + # GET /types.json + def ordered_index + @types = Type.find(:all,:order=>:name) + + respond_to do |format| + format.html # ordered_index.html.erb + format.json { render json: @types } + end + end + + # GET /types/1 # GET /types/1.json def show diff --git a/app/controllers/types_controller.rb~ b/app/controllers/types_controller.rb~ new file mode 100755 index 0000000..da826f4 --- /dev/null +++ b/app/controllers/types_controller.rb~ @@ -0,0 +1,83 @@ +class TypesController < ApplicationController + # GET /types + # GET /types.json + def index + @types = Type.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @types } + end + end + + # GET /types/1 + # GET /types/1.json + def show + @type = Type.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @type } + end + end + + # GET /types/new + # GET /types/new.json + def new + @type = Type.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @type } + end + end + + # GET /types/1/edit + def edit + @type = Type.find(params[:id]) + end + + # POST /types + # POST /types.json + def create + @type = Type.new(params[:type]) + + respond_to do |format| + if @type.save + format.html { redirect_to @type, notice: 'Type was successfully created.' } + format.json { render json: @type, status: :created, location: @type } + else + format.html { render action: "new" } + format.json { render json: @type.errors, status: :unprocessable_entity } + end + end + end + + # PUT /types/1 + # PUT /types/1.json + def update + @type = Type.find(params[:id]) + + respond_to do |format| + if @type.update_attributes(params[:type]) + format.html { redirect_to @type, notice: 'Type was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @type.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /types/1 + # DELETE /types/1.json + def destroy + @type = Type.find(params[:id]) + @type.destroy + + respond_to do |format| + format.html { redirect_to types_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/visits_controller.rb b/app/controllers/visits_controller.rb old mode 100644 new mode 100755 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/comentarios_helper.rb b/app/helpers/comentarios_helper.rb new file mode 100755 index 0000000..a8f928b --- /dev/null +++ b/app/helpers/comentarios_helper.rb @@ -0,0 +1,2 @@ +module ComentariosHelper +end diff --git a/app/helpers/planet_helper.rb b/app/helpers/planet_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/sites_helper.rb b/app/helpers/sites_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/trips_helper.rb b/app/helpers/trips_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/types_helper.rb b/app/helpers/types_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/visits_helper.rb b/app/helpers/visits_helper.rb old mode 100644 new mode 100755 diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep old mode 100644 new mode 100755 diff --git a/app/models/.gitkeep b/app/models/.gitkeep old mode 100644 new mode 100755 diff --git a/app/models/comentario.rb b/app/models/comentario.rb new file mode 100755 index 0000000..471e904 --- /dev/null +++ b/app/models/comentario.rb @@ -0,0 +1,6 @@ +class Comentario < ActiveRecord::Base + belongs_to :site + belongs_to :user + + attr_protected :user_id +end diff --git a/app/models/comentario.rb~ b/app/models/comentario.rb~ new file mode 100755 index 0000000..8b39078 --- /dev/null +++ b/app/models/comentario.rb~ @@ -0,0 +1,4 @@ +class Comentario < ActiveRecord::Base + belongs_to :site + belongs_to :user +end diff --git a/app/models/site.rb b/app/models/site.rb old mode 100644 new mode 100755 index 7a3bd34..39848d4 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -3,11 +3,13 @@ class Site < ActiveRecord::Base belongs_to :user has_many :visits has_many :trips, :through => :visits + has_many :comentarios + has_attached_file :image # Debe estar protegido para evitar accesos indeseados attr_protected :user_id # Se añaden estas definiciones - validates :name, :type_id, :image_url, :presence => true # campo obligatorio + validates :name, :type_id, :presence => true # campo obligatorio end diff --git a/app/models/site.rb~ b/app/models/site.rb~ new file mode 100755 index 0000000..54ca9d0 --- /dev/null +++ b/app/models/site.rb~ @@ -0,0 +1,14 @@ +class Site < ActiveRecord::Base + belongs_to :type + belongs_to :user + has_many :visits + has_many :trips, :through => :visits + has_many :comentarios + + + # Debe estar protegido para evitar accesos indeseados + attr_protected :user_id + + # Se añaden estas definiciones + validates :name, :type_id, :image_url, :presence => true # campo obligatorio +end diff --git a/app/models/trip.rb b/app/models/trip.rb old mode 100644 new mode 100755 diff --git a/app/models/type.rb b/app/models/type.rb old mode 100644 new mode 100755 diff --git a/app/models/user.rb b/app/models/user.rb old mode 100644 new mode 100755 index 35b8159..9b60370 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,7 @@ class User < ActiveRecord::Base has_many :sites + has_many :comentarios has_many :trips # Include default devise modules. Others available are: diff --git a/app/models/user.rb~ b/app/models/user.rb~ new file mode 100755 index 0000000..9b60370 --- /dev/null +++ b/app/models/user.rb~ @@ -0,0 +1,16 @@ +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 old mode 100644 new mode 100755 diff --git a/app/views/comentarios/_form.html.erb b/app/views/comentarios/_form.html.erb new file mode 100755 index 0000000..4f67d52 --- /dev/null +++ b/app/views/comentarios/_form.html.erb @@ -0,0 +1,30 @@ +<%= form_for(@comentario) do |f| %> + <% if @comentario.errors.any? %> +
+

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

+ + +
+ <% end %> + +
+ <%= f.label :coment %>
+ <%= f.text_area :coment, :rows => 4 %> +
+ +
+ <%= f.label :site_id %>
+ + <%= f.collection_select(:site_id, Site.find(:all, :order => :name), :id, :name) %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/comentarios/_form.html.erb~ b/app/views/comentarios/_form.html.erb~ new file mode 100755 index 0000000..40d3350 --- /dev/null +++ b/app/views/comentarios/_form.html.erb~ @@ -0,0 +1,30 @@ +<%= form_for(@comentario) do |f| %> + <% if @comentario.errors.any? %> +
+

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

+ + +
+ <% end %> + +
+ <%= f.label :coment %>
+ <%= f.text_field :coment %> +
+ +
+ <%= f.label :site_id %>
+ + <%= f.collection_select(:site_id, Site.find(:all, :order => :name), :id, :name) %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/comentarios/edit.html.erb b/app/views/comentarios/edit.html.erb new file mode 100755 index 0000000..9a8929b --- /dev/null +++ b/app/views/comentarios/edit.html.erb @@ -0,0 +1,6 @@ +

Editing comentario

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

Comentarios

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

Listing Comentarios

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

New comentario

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

<%= notice %>

+ +

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

+ +

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

+ +

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

+ + +<%= link_to 'Edit', edit_comentario_path(@comentario) %> | +<%= link_to 'Back', comentarios_path %> | +<%= link_to 'Destroy', @comentario, :confirm => 'Are you sure?', :method => :delete %> diff --git a/app/views/comentarios/show.html.erb~ b/app/views/comentarios/show.html.erb~ new file mode 100755 index 0000000..c7a6dec --- /dev/null +++ b/app/views/comentarios/show.html.erb~ @@ -0,0 +1,25 @@ +

<%= notice %>

+ +

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

+ +

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

+ +

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

+ + +<%= link_to 'Edit', edit_comentario_path(@comentario) %> | +<%= link_to 'Back', comentarios_path %> +<%= link_to 'Destroy', @comentario, + :confirm => 'Are you sure?', + :method => :delete %> diff --git a/app/views/devise/_links.erb b/app/views/devise/_links.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb old mode 100644 new mode 100755 index 82edd70..cc90224 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,7 +6,12 @@ <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> - + + @@ -14,22 +19,41 @@ <% end %> +
<%= f.label :name %>
<%= f.text_field :name %> @@ -24,8 +25,20 @@ <%= 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.label :zoom %>
+ <%= f.text_field :zoom %>
<%= f.submit %> diff --git a/app/views/sites/_form.html.erb~ b/app/views/sites/_form.html.erb~ new file mode 100755 index 0000000..21b015e --- /dev/null +++ b/app/views/sites/_form.html.erb~ @@ -0,0 +1,46 @@ +<%= form_for(@site) do |f| %> + <% if @site.errors.any? %> +
+

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

+ + +
+ <% end %> + + +
+ <%= f.label :name %>
+ <%= f.text_field :name %> +
+
+ <%= f.label :description %>
+ <%= f.text_area :description , :rows => 4 %> +
+
+ <%= f.label :type_id %>
+ <%= f.collection_select(:type_id, Type.find(:all, :order => :name), :id, :name) %> +
+
+ <%= f.label :image_url %>
+ <%= f.text_field :image_url %> +
+
+ <%= f.label :latitud %>
+ <%= f.text_field :latitud %> +
+
+ <%= f.label :longitud %>
+ <%= f.text_field :longitud %> +
+
+ <%= f.label :zoom %>
+ <%= f.text_field :zoom %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/sites/edit.html.erb b/app/views/sites/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb old mode 100644 new mode 100755 index df94078..ee41ed3 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -1,12 +1,12 @@
-

Listing Sites

+

Sites

<% @sites.each do |site| %> + <% end %> + <% end %>
- <%= link_to image_tag(site.image_url, :class => 'list_image'), site %> + <%= link_to image_tag(site.image.url, :class => 'list_image'), site %> @@ -14,16 +14,20 @@
<%= link_to site.name, site %>
<%= truncate(strip_tags(site.description), :length => 80) %>
+
Incluido en <%= site.visits.size %> viajes
+
<%= (link_to 'comentarios >>', site_comentarios_path(site.id)) if (site.comentarios.size > 0) %>
- <%= link_to 'Show', site %>
- <% if site.user == current_user %> <%= link_to 'Edit', edit_site_path(site) %>
+ + <% if site.user == current_user %> + <%= link_to 'Edit', edit_site_path(site) %>
<%= link_to 'Destroy', site, :confirm => 'Are you sure?', :method => :delete %> - <% end %>
@@ -31,4 +35,4 @@
-<%= link_to 'New site', new_site_path %> \ No newline at end of file +<%= link_to 'New site', new_site_path %> diff --git a/app/views/sites/index.html.erb~ b/app/views/sites/index.html.erb~ new file mode 100755 index 0000000..29e98df --- /dev/null +++ b/app/views/sites/index.html.erb~ @@ -0,0 +1,38 @@ +
+

Sites

+ + + <% @sites.each do |site| %> + + + + + + + + + <% end %> +
+ <%= link_to image_tag(site.image.url, :class => 'list_image'), site %> + +
+
<%= link_to site.name, site %>
+
<%= truncate(strip_tags(site.description), + :length => 80) %>
+
Incluido en <%= site.visits.size %> viajes
+
<%= (link_to 'comentarios >>', site_comentarios_path(site.id)) if (site.comentarios.size > 0) %>
+
+
+ + <% if site.user == current_user %> + <%= link_to 'Edit', edit_site_path(site) %>
+ <%= link_to 'Destroy', site, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %> +
+
+ +
+ +<%= link_to 'New site', new_site_path %> diff --git a/app/views/sites/new.html.erb b/app/views/sites/new.html.erb old mode 100644 new mode 100755 index 2988bdc..d3bd110 --- a/app/views/sites/new.html.erb +++ b/app/views/sites/new.html.erb @@ -1,3 +1,33 @@ + + + + + + +

New site

<%= render 'form' %> diff --git a/app/views/sites/new.html.erb~ b/app/views/sites/new.html.erb~ new file mode 100755 index 0000000..2988bdc --- /dev/null +++ b/app/views/sites/new.html.erb~ @@ -0,0 +1,5 @@ +

New site

+ +<%= render 'form' %> + +<%= link_to 'Back', sites_path %> diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb old mode 100644 new mode 100755 index 1b81f59..3ee4bb1 --- a/app/views/sites/show.html.erb +++ b/app/views/sites/show.html.erb @@ -1,15 +1,68 @@ + + + + +

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

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

<%= @site.name %>

<%=sanitize @site.description %>

-

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

-
+

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

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

<%= (link_to 'Comentarios >>', site_comentarios_path(@site.id)) if (@site.comentarios.size > 0) %>

+ +

<%= link_to 'Añadir Comentario', new_comentario_path %> + + +

+ +

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

+ +

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

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

<%= @site.name %>

+ +

<%=sanitize @site.description %>

+ +

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

+ +
+ Visitas: +
+ +

<%= (link_to 'Comentarios >>', site_comentarios_path(@site.id)) if (@site.comentarios.size > 0) %>

+ +

<%= link_to 'Añadir Comentario', new_comentario_path %> + + +

+ +
+ +

+<% if @site.user == current_user %> + <%= link_to 'Edit', edit_site_path(@site) %> | +<% end %> +<%= link_to 'Back', sites_path %> diff --git a/app/views/trips/_form.html.erb b/app/views/trips/_form.html.erb old mode 100644 new mode 100755 diff --git a/app/views/trips/_trip.html.erb b/app/views/trips/_trip.html.erb old mode 100644 new mode 100755 index d8c5b00..c8f84dd --- a/app/views/trips/_trip.html.erb +++ b/app/views/trips/_trip.html.erb @@ -3,9 +3,13 @@ <% trip.visits.order(:hour).each do |visit| %> - <%= link_to image_tag(visit.site.image_url, :class => 'list_image'), visit.site %> - + <%= link_to image_tag(visit.site.image.url, :class => 'list_image'), visit.site %> + + +

<%= visit.hour.to_s + 'h: ' %> diff --git a/app/views/trips/_trip.html.erb~ b/app/views/trips/_trip.html.erb~ new file mode 100755 index 0000000..0830535 --- /dev/null +++ b/app/views/trips/_trip.html.erb~ @@ -0,0 +1,33 @@ +
+ + <% trip.visits.order(:hour).each do |visit| %> + + + + + + + + + + <% end %> +
+ <%= link_to image_tag(visit.site.image.url, :class => 'list_image'), visit.site %> + +
+
<%= visit.hour.to_s + 'h: ' %> + <%=link_to(visit.site.name, visit.site) %>
+
<%= truncate(strip_tags(visit.site.description), + :length => 80) %>
+
+
+ <%= link_to 'Show', visit.site %>
+ <%= link_to 'Destroy', visit, + :confirm => 'Are you sure?', + :method => :delete if @trip.user == current_user %> + +
+
+ diff --git a/app/views/trips/edit.html.erb b/app/views/trips/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/trips/index.html.erb b/app/views/trips/index.html.erb old mode 100644 new mode 100755 diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb old mode 100644 new mode 100755 index 26176f0..9185d83 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -1,28 +1 @@ -

Name: <%= @trip.name %>

Date: <%= @trip.date %>

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

-

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

-
- -

Sitios a visitar

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

Name: <%= @trip.name %>

Date: <%= @trip.date %>

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

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

Sitios a visitar

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

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

Name: <%= @trip.name %>

Date: <%= @trip.date %>

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

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

Sitios a visitar

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

<% if @trip.user == current_user %> <%= link_to 'Edit', edit_trip_path(@trip) %> | <% end %> <%= link_to 'Back', trips_path %> \ No newline at end of file diff --git a/app/views/types/_form.html.erb b/app/views/types/_form.html.erb old mode 100644 new mode 100755 diff --git a/app/views/types/_form.html.erb~ b/app/views/types/_form.html.erb~ new file mode 100755 index 0000000..deb2959 --- /dev/null +++ b/app/views/types/_form.html.erb~ @@ -0,0 +1,29 @@ +<%= form_for(@type) do |f| %> + <% if @type.errors.any? %> +
+

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

+ +
    + <% @type.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :name %>
+ <%= f.text_field :name %> +
+
+ <%= f.label :description %>
+ <%= f.text_area :description, :rows => 4 %> +
+
+ <%= f.label :image %>
+ <%= f.file_field :image %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/types/edit.html.erb b/app/views/types/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb old mode 100644 new mode 100755 index e761359..17d2a89 --- a/app/views/types/index.html.erb +++ b/app/views/types/index.html.erb @@ -1,5 +1,5 @@
-

Listing Types

+

Types

<% @types.each do |type| %> @@ -9,7 +9,7 @@
<%= link_to type.name, type_sites_path(type) %>
<%= truncate(strip_tags(type.description), - :length => 80) %>
+ :length => 80) %>
Modificado el: <%= type.updated_at %>
@@ -27,4 +27,6 @@
-<%= link_to 'New Type', new_type_path %> +<%= link_to 'New Type', new_type_path %> | +<%= link_to 'Order By Name', types_ordered_index_path %> | +<%= link_to 'Order By Creation', types_path %> diff --git a/app/views/types/index.html.erb~ b/app/views/types/index.html.erb~ new file mode 100755 index 0000000..a8cdc63 --- /dev/null +++ b/app/views/types/index.html.erb~ @@ -0,0 +1,32 @@ +
+

Types

+ +
+ <% @types.each do |type| %> + + + + + + + <% end %> +
+
+
<%= link_to type.name, type_sites_path(type) %>
+
<%= truncate(strip_tags(type.description), + :length => 80) %>
Modificado el: <%= 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 %> | +<%= link_to 'Order By Name', types_ordered_index_path %> | +<%= link_to 'Order By Creation', types_index_path %> diff --git a/app/views/types/new.html.erb b/app/views/types/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/types/ordered_index.html.erb b/app/views/types/ordered_index.html.erb new file mode 100755 index 0000000..17d2a89 --- /dev/null +++ b/app/views/types/ordered_index.html.erb @@ -0,0 +1,32 @@ +
+

Types

+ + + <% @types.each do |type| %> + + + + + + + <% end %> +
+
+
<%= link_to type.name, type_sites_path(type) %>
+
<%= truncate(strip_tags(type.description), + :length => 80) %>
Modificado el: <%= 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 %> | +<%= link_to 'Order By Name', types_ordered_index_path %> | +<%= link_to 'Order By Creation', types_path %> diff --git a/app/views/types/ordered_index.html.erb~ b/app/views/types/ordered_index.html.erb~ new file mode 100755 index 0000000..a8cdc63 --- /dev/null +++ b/app/views/types/ordered_index.html.erb~ @@ -0,0 +1,32 @@ +
+

Types

+ + + <% @types.each do |type| %> + + + + + + + <% end %> +
+
+
<%= link_to type.name, type_sites_path(type) %>
+
<%= truncate(strip_tags(type.description), + :length => 80) %>
Modificado el: <%= 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 %> | +<%= link_to 'Order By Name', types_ordered_index_path %> | +<%= link_to 'Order By Creation', types_index_path %> diff --git a/app/views/types/show.html.erb b/app/views/types/show.html.erb old mode 100644 new mode 100755 index 98b32e7..2f844e6 --- a/app/views/types/show.html.erb +++ b/app/views/types/show.html.erb @@ -10,6 +10,11 @@ <%= @type.description %>

+

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

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

<%= notice %>

+ +

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

+ +

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

+ +

+ Last modified on: + <%= @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 old mode 100644 new mode 100755 diff --git a/app/views/visits/edit.html.erb b/app/views/visits/edit.html.erb old mode 100644 new mode 100755 diff --git a/app/views/visits/index.html.erb b/app/views/visits/index.html.erb old mode 100644 new mode 100755 diff --git a/app/views/visits/new.html.erb b/app/views/visits/new.html.erb old mode 100644 new mode 100755 diff --git a/app/views/visits/show.html.erb b/app/views/visits/show.html.erb old mode 100644 new mode 100755 diff --git a/config.ru b/config.ru old mode 100644 new mode 100755 diff --git a/config/application.rb b/config/application.rb old mode 100644 new mode 100755 diff --git a/config/boot.rb b/config/boot.rb old mode 100644 new mode 100755 diff --git a/config/database.yml b/config/database.yml old mode 100644 new mode 100755 diff --git a/config/environment.rb b/config/environment.rb old mode 100644 new mode 100755 diff --git a/config/environments/development.rb b/config/environments/development.rb old mode 100644 new mode 100755 diff --git a/config/environments/production.rb b/config/environments/production.rb old mode 100644 new mode 100755 diff --git a/config/environments/test.rb b/config/environments/test.rb old mode 100644 new mode 100755 diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb old mode 100644 new mode 100755 diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb old mode 100644 new mode 100755 diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb old mode 100644 new mode 100755 diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb old mode 100644 new mode 100755 diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb old mode 100644 new mode 100755 diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb old mode 100644 new mode 100755 diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb old mode 100644 new mode 100755 diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml old mode 100644 new mode 100755 diff --git a/config/locales/en.yml b/config/locales/en.yml old mode 100644 new mode 100755 diff --git a/config/routes.rb b/config/routes.rb old mode 100644 new mode 100755 index 29d3c86..90f3acd --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,7 @@ Planet::Application.routes.draw do + resources :comentarios + resources :visits resources :trips @@ -8,16 +10,24 @@ resources :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 # Rutas anidadas /types/id/sites..., + resources :comentarios, :only => [ :index ] # Restringe a acción “index” + end + get "planet/index" get "planet/contact" get "planet/ejemplo" + get "planet/autor" + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/config/routes.rb~ b/config/routes.rb~ new file mode 100755 index 0000000..c3d1723 --- /dev/null +++ b/config/routes.rb~ @@ -0,0 +1,89 @@ +Planet::Application.routes.draw do + + resources :comentarios + + resources :visits + + resources :trips + + devise_for :users + + resources :sites + + resources :types do # Rutas anidadas /types/id/sites..., + resources :sites, :only => [ :index ] # Restringe a acción “index” + end + + resources :sites do # Rutas anidadas /types/id/sites..., + resources :comentarios, :only => [ :index ] # Restringe a acción “index” + end + + get "types/ordered_index" + + get "planet/index" + + get "planet/contact" + + get "planet/ejemplo" + + get "planet/autor" + + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + # root :to => 'welcome#index' + + root :to => "planet#index" + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id(.:format)))' +end diff --git a/db/migrate/20120317231537_create_types.rb b/db/migrate/20120317231537_create_types.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120320100145_create_sites.rb b/db/migrate/20120320100145_create_sites.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120320100145_create_sites.rb~ b/db/migrate/20120320100145_create_sites.rb~ new file mode 100755 index 0000000..f9472ad --- /dev/null +++ b/db/migrate/20120320100145_create_sites.rb~ @@ -0,0 +1,15 @@ +class CreateSites < ActiveRecord::Migration + def change + create_table :sites do |t| + t.string :name + t.text :description + t.integer :type_id + t.string :image_url + t.float :longitud + t.float :latitud + t.integer :zoom + + t.timestamps + end + end +end diff --git a/db/migrate/20120328230302_devise_create_users.rb b/db/migrate/20120328230302_devise_create_users.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120329060322_user_name.rb b/db/migrate/20120329060322_user_name.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120329080433_user_sites.rb b/db/migrate/20120329080433_user_sites.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120409085740_create_trips.rb b/db/migrate/20120409085740_create_trips.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120409143117_create_visits.rb b/db/migrate/20120409143117_create_visits.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20120410235356_create_comentarios.rb b/db/migrate/20120410235356_create_comentarios.rb new file mode 100755 index 0000000..1f46d24 --- /dev/null +++ b/db/migrate/20120410235356_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/20120418184242_site_geolocalization.rb b/db/migrate/20120418184242_site_geolocalization.rb new file mode 100755 index 0000000..8b1be68 --- /dev/null +++ b/db/migrate/20120418184242_site_geolocalization.rb @@ -0,0 +1,25 @@ +class SiteGeolocalization < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :latitud, :float + end + change_table :sites do |t| + t.column :longitud, :float + end + change_table :sites do |t| + t.column :zoom, :integer + end + end + + def down + change_table :sites do |t| + t.remove :latitud + end + change_table :sites do |t| + t.remove :longitud + end + change_table :sites do |t| + t.remove :zoom + end + end +end diff --git a/db/migrate/20120418184242_site_geolocalization.rb~ b/db/migrate/20120418184242_site_geolocalization.rb~ new file mode 100755 index 0000000..c4adf15 --- /dev/null +++ b/db/migrate/20120418184242_site_geolocalization.rb~ @@ -0,0 +1,19 @@ +class SiteGeolocalization < ActiveRecord::Migration + def up + change_table :sites do |t| + t.column :latitud, :float + change_table :sites do |t| + t.column :longitud, :float + change_table :sites do |t| + t.column :zoom, :integer + end + + def down + change_table :sites do |t| + t.remove :latitud + change_table :sites do |t| + t.remove :longitud + change_table :sites do |t| + t.remove :zoom + end +end diff --git a/db/migrate/20120421232359_add_paperclip_to_sites.rb b/db/migrate/20120421232359_add_paperclip_to_sites.rb new file mode 100755 index 0000000..96de497 --- /dev/null +++ b/db/migrate/20120421232359_add_paperclip_to_sites.rb @@ -0,0 +1,20 @@ +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/20120421232359_add_paperclip_to_sites.rb~ b/db/migrate/20120421232359_add_paperclip_to_sites.rb~ new file mode 100755 index 0000000..be845a8 --- /dev/null +++ b/db/migrate/20120421232359_add_paperclip_to_sites.rb~ @@ -0,0 +1,4 @@ +class AddPaperclipToSites < ActiveRecord::Migration + def change + end +end diff --git a/db/migrate/20120425123554_site_visitas.rb b/db/migrate/20120425123554_site_visitas.rb new file mode 100644 index 0000000..4292789 --- /dev/null +++ b/db/migrate/20120425123554_site_visitas.rb @@ -0,0 +1,13 @@ +class SiteVisitas < ActiveRecord::Migration + def self.up + change_table :sites do |t| # añade la columna visits a la tabla sites + 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/migrate/20120425123554_site_visitas.rb~ b/db/migrate/20120425123554_site_visitas.rb~ new file mode 100644 index 0000000..b0abfb3 --- /dev/null +++ b/db/migrate/20120425123554_site_visitas.rb~ @@ -0,0 +1,13 @@ +class SiteVisitas < ActiveRecord::Migration + def self.up + change_table :sites do |t| # añade la columna visits a la tabla sites + t.column :visitas, :integer, + end + end + + def self.down + change_table :sites do |t| + t.remove :visitas + end + end +end diff --git a/db/migrate/20120425184401_rm_site_visitas.rb b/db/migrate/20120425184401_rm_site_visitas.rb new file mode 100644 index 0000000..c56b5a4 --- /dev/null +++ b/db/migrate/20120425184401_rm_site_visitas.rb @@ -0,0 +1,10 @@ +class RmSiteVisitas < ActiveRecord::Migration + def self.up + change_table :sites do |t| + t.remove :visitas + end + end + + def self.down + end +end diff --git a/db/migrate/20120425184401_rm_site_visitas.rb~ b/db/migrate/20120425184401_rm_site_visitas.rb~ new file mode 100644 index 0000000..62ecf04 --- /dev/null +++ b/db/migrate/20120425184401_rm_site_visitas.rb~ @@ -0,0 +1,7 @@ +class RmSiteVisitas < ActiveRecord::Migration + def up + end + + def down + end +end diff --git a/db/migrate/20120425184541_re_site_visitas.rb b/db/migrate/20120425184541_re_site_visitas.rb new file mode 100644 index 0000000..f46fe80 --- /dev/null +++ b/db/migrate/20120425184541_re_site_visitas.rb @@ -0,0 +1,13 @@ +class ReSiteVisitas < ActiveRecord::Migration + def self.up + change_table :sites do |t| # añade la columna visits a la tabla sites + 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/migrate/20120425184541_re_site_visitas.rb~ b/db/migrate/20120425184541_re_site_visitas.rb~ new file mode 100644 index 0000000..89019a0 --- /dev/null +++ b/db/migrate/20120425184541_re_site_visitas.rb~ @@ -0,0 +1,7 @@ +class ReSiteVisitas < ActiveRecord::Migration + def up + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb old mode 100644 new mode 100755 index 9eb10c3..6ffc7a4 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,16 +11,32 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120409085740) do +ActiveRecord::Schema.define(:version => 20120425184541) 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.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "user_id" + t.float "latitud" + t.float "longitud" + t.integer "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| @@ -58,4 +74,12 @@ add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + create_table "visits", :force => true do |t| + t.integer "trip_id" + t.integer "site_id" + t.integer "hour" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + end diff --git a/db/schema.rb~ b/db/schema.rb~ new file mode 100755 index 0000000..733fde1 --- /dev/null +++ b/db/schema.rb~ @@ -0,0 +1,85 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20120425123554) 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.integer "zoom" + t.string "image_file_name" + t.string "image_content_type" + t.string "image_file_size" + t.datetime "image_updated_at" + t.integer "visitas" + end + + create_table "trips", :force => true do |t| + t.string "name" + t.text "description" + t.date "date" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "types", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "users", :force => true do |t| + t.string "email", :default => "", :null => false + t.string "encrypted_password", :default => "", :null => false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "name" + end + + add_index "users", ["email"], :name => "index_users_on_email", :unique => true + add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + + create_table "visits", :force => true do |t| + t.integer "trip_id" + t.integer "site_id" + t.integer "hour" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end diff --git a/db/seeds.rb b/db/seeds.rb old mode 100644 new mode 100755 diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP old mode 100644 new mode 100755 diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep old mode 100644 new mode 100755 diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep old mode 100644 new mode 100755 diff --git a/log/.gitkeep b/log/.gitkeep old mode 100644 new mode 100755 diff --git a/public/404.html b/public/404.html old mode 100644 new mode 100755 diff --git a/public/422.html b/public/422.html old mode 100644 new mode 100755 diff --git a/public/500.html b/public/500.html old mode 100644 new mode 100755 diff --git a/public/favicon.ico b/public/favicon.ico old mode 100644 new mode 100755 diff --git a/public/robots.txt b/public/robots.txt old mode 100644 new mode 100755 diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep old mode 100644 new mode 100755 diff --git a/test/fixtures/comentarios.yml b/test/fixtures/comentarios.yml new file mode 100755 index 0000000..e7e2ac9 --- /dev/null +++ b/test/fixtures/comentarios.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + coment: MyString + user_id: 1 + site_id: 1 + +two: + coment: MyString + user_id: 1 + site_id: 1 diff --git a/test/fixtures/sites.yml b/test/fixtures/sites.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/trips.yml b/test/fixtures/trips.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/types.yml b/test/fixtures/types.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/visits.yml b/test/fixtures/visits.yml old mode 100644 new mode 100755 diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep old mode 100644 new mode 100755 diff --git a/test/functional/comentarios_controller_test.rb b/test/functional/comentarios_controller_test.rb new file mode 100755 index 0000000..2c09333 --- /dev/null +++ b/test/functional/comentarios_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class ComentariosControllerTest < ActionController::TestCase + setup do + @comentario = comentarios(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:comentarios) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create comentario" do + assert_difference('Comentario.count') do + post :create, comentario: @comentario.attributes + end + + assert_redirected_to comentario_path(assigns(:comentario)) + end + + test "should show comentario" do + get :show, id: @comentario + assert_response :success + end + + test "should get edit" do + get :edit, id: @comentario + assert_response :success + end + + test "should update comentario" do + put :update, id: @comentario, comentario: @comentario.attributes + assert_redirected_to comentario_path(assigns(:comentario)) + end + + test "should destroy comentario" do + assert_difference('Comentario.count', -1) do + delete :destroy, id: @comentario + end + + assert_redirected_to comentarios_path + end +end diff --git a/test/functional/planet_controller_test.rb b/test/functional/planet_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/functional/sites_controller_test.rb b/test/functional/sites_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/functional/trips_controller_test.rb b/test/functional/trips_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/functional/types_controller_test.rb b/test/functional/types_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/functional/visits_controller_test.rb b/test/functional/visits_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/integration/.gitkeep b/test/integration/.gitkeep old mode 100644 new mode 100755 diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb old mode 100644 new mode 100755 diff --git a/test/test_helper.rb b/test/test_helper.rb old mode 100644 new mode 100755 diff --git a/test/unit/.gitkeep b/test/unit/.gitkeep old mode 100644 new mode 100755 diff --git a/test/unit/comentario_test.rb b/test/unit/comentario_test.rb new file mode 100755 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 100755 index 0000000..d553eef --- /dev/null +++ b/test/unit/helpers/comentarios_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ComentariosHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/planet_helper_test.rb b/test/unit/helpers/planet_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/helpers/sites_helper_test.rb b/test/unit/helpers/sites_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/helpers/trips_helper_test.rb b/test/unit/helpers/trips_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/helpers/types_helper_test.rb b/test/unit/helpers/types_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/helpers/visits_helper_test.rb b/test/unit/helpers/visits_helper_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/site_test.rb b/test/unit/site_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/trip_test.rb b/test/unit/trip_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/type_test.rb b/test/unit/type_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb old mode 100644 new mode 100755 diff --git a/test/unit/visit_test.rb b/test/unit/visit_test.rb old mode 100644 new mode 100755 diff --git a/vendor/assets/javascripts/.gitkeep b/vendor/assets/javascripts/.gitkeep old mode 100644 new mode 100755 diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep old mode 100644 new mode 100755 diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep old mode 100644 new mode 100755