diff --git a/Gemfile.lock b/Gemfile.lock index fd905dc..53fc807 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,7 +60,7 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.18) - multi_json (1.3.1) + multi_json (1.3.2) orm_adapter (0.0.7) paperclip (3.0.2) activemodel (>= 3.0.0) @@ -95,7 +95,7 @@ GEM rake (0.9.2.2) rdoc (3.12) json (~> 1.4) - sass (3.1.15) + sass (3.1.16) sass-rails (3.2.5) railties (~> 3.2.0) sass (>= 3.1.10) @@ -104,7 +104,7 @@ GEM hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.5) + sqlite3 (1.3.6) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) diff --git a/app/assets/stylesheets/planet.css b/app/assets/stylesheets/planet.css index ead053a..a4f4c8d 100644 --- a/app/assets/stylesheets/planet.css +++ b/app/assets/stylesheets/planet.css @@ -104,8 +104,9 @@ float: left; padding-top: 1em; padding-left: 1em; + padding-right: 1em; padding-bottom: 1em; - width: 8em; /* Ajuste de borde izquierdo */ + width: 14em; /* Ajuste de borde izquierdo */ background: #446; } diff --git a/app/controllers/planet_controller.rb b/app/controllers/planet_controller.rb index a8636bd..041e512 100644 --- a/app/controllers/planet_controller.rb +++ b/app/controllers/planet_controller.rb @@ -29,5 +29,9 @@ def contact # Método que define una acción vacía del controlador def ejemplo end - + # Acción vacía para la búsqueda + def search + end + def doc_app_index_html + end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e4c9e36..4025431 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -25,6 +25,14 @@ <%= link_to "Viajes", trips_path %>
<%= link_to "Contact", planet_contact_path %>
<%= link_to "Sign up", new_user_registration_path unless current_user %> + <%= link_to "Documentation", "http://localhost:3000/doc/app/index.html" %>
+

<%= notice %>

<%= alert %>

@@ -32,4 +40,4 @@
- \ No newline at end of file + diff --git a/app/views/planet/search.html.erb b/app/views/planet/search.html.erb new file mode 100644 index 0000000..3688423 --- /dev/null +++ b/app/views/planet/search.html.erb @@ -0,0 +1,73 @@ + + +
+

Listing Sites and Trips

+ +
+

Sitios

+ + <% Site.where("name like ? or description like ?" , "%"+params[:q]+"%" , "%"+params[:q]+"%" ).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 => 50) %>
+
+
+ <%= link_to 'Show', site %>
+ <% if site.user == current_user %> <%= link_to 'Edit', edit_site_path(site) %>
+ <%= link_to 'Destroy', site, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %>
+
+ +
+

Viajes

+ + <% Trip.where("name like ? or description like ?" , "%"+params[:q]+"%" , "%"+params[:q]+"%" ).each do |trip| %> + + + + + <% end %> +
+
+
<%= link_to trip.name, trip_path(trip) %>
+
<%= truncate(strip_tags(trip.description), + :length => 80) + ', ' + trip.date.to_s %>
+
+
+ <%= link_to 'Show', trip %>
+ <% if trip.user == current_user %> + <%= link_to 'Edit', edit_trip_path(trip) %>
+ <%= link_to 'Destroy', trip, + :confirm => 'Are you sure?', + :method => :delete %> + <% end %> +
+

+
+ diff --git a/config/routes.rb b/config/routes.rb index 29d3c86..f4b4c4c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,6 +18,8 @@ get "planet/ejemplo" + get "planet/search" + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/db/schema.rb b/db/schema.rb index e6aa66f..de42b4b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,15 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120411160519) do +ActiveRecord::Schema.define(:version => 20120421170806) do + + create_table "comments", :force => true do |t| + t.string "comment" + t.integer "user_id" + t.integer "site_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end create_table "sites", :force => true do |t| t.string "name" @@ -26,6 +34,9 @@ t.string "image_file_size" t.datetime "image_updated_at" t.integer "visitas", :default => 0 + t.float "lat" + t.float "long" + t.float "zoom" end create_table "trips", :force => true do |t| diff --git a/doc/app/PlanetController.html b/doc/app/PlanetController.html index e3bde99..b9377e0 100644 --- a/doc/app/PlanetController.html +++ b/doc/app/PlanetController.html @@ -76,6 +76,8 @@

Methods

  • #index +
  • #search + @@ -214,7 +216,7 @@

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

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

    Public Instance Methods

    + + + diff --git a/doc/app/created.rid b/doc/app/created.rid index 2aaa3ea..8f88f28 100644 --- a/doc/app/created.rid +++ b/doc/app/created.rid @@ -1,19 +1,19 @@ -Mon, 16 Apr 2012 08:53:15 +0200 -doc/README_FOR_APP Sat, 17 Mar 2012 23:42:41 +0100 -app/controllers/application_controller.rb Sat, 17 Mar 2012 23:42:41 +0100 -app/controllers/planet_controller.rb Mon, 16 Apr 2012 08:53:07 +0200 -app/controllers/sites_controller.rb Thu, 12 Apr 2012 11:23:00 +0200 -app/controllers/trips_controller.rb Mon, 09 Apr 2012 17:09:15 +0200 -app/controllers/types_controller.rb Sun, 18 Mar 2012 00:15:37 +0100 -app/controllers/visits_controller.rb Tue, 10 Apr 2012 18:45:27 +0200 -app/helpers/application_helper.rb Sat, 17 Mar 2012 23:42:41 +0100 -app/helpers/planet_helper.rb Sat, 17 Mar 2012 23:48:05 +0100 -app/helpers/sites_helper.rb Tue, 20 Mar 2012 11:01:45 +0100 -app/helpers/trips_helper.rb Mon, 09 Apr 2012 10:57:40 +0200 -app/helpers/types_helper.rb Sun, 18 Mar 2012 00:15:37 +0100 -app/helpers/visits_helper.rb Mon, 09 Apr 2012 17:09:15 +0200 -app/models/site.rb Wed, 11 Apr 2012 13:04:49 +0200 -app/models/trip.rb Mon, 09 Apr 2012 17:09:15 +0200 -app/models/type.rb Wed, 28 Mar 2012 18:02:57 +0200 -app/models/user.rb Mon, 09 Apr 2012 17:09:15 +0200 -app/models/visit.rb Mon, 09 Apr 2012 17:09:15 +0200 +Tue, 24 Apr 2012 21:49:20 +0200 +doc/README_FOR_APP Sun, 22 Apr 2012 16:23:15 +0200 +app/models/type.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/models/visit.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/models/trip.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/models/site.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/models/user.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/controllers/planet_controller.rb Sun, 22 Apr 2012 20:17:01 +0200 +app/controllers/application_controller.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/controllers/sites_controller.rb Sun, 22 Apr 2012 16:52:49 +0200 +app/controllers/visits_controller.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/controllers/trips_controller.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/controllers/types_controller.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/helpers/trips_helper.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/helpers/application_helper.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/helpers/types_helper.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/helpers/visits_helper.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/helpers/planet_helper.rb Sun, 22 Apr 2012 16:23:15 +0200 +app/helpers/sites_helper.rb Sun, 22 Apr 2012 16:23:15 +0200 diff --git a/doc/app/images/add.png b/doc/app/images/add.png old mode 100755 new mode 100644 diff --git a/doc/app/images/delete.png b/doc/app/images/delete.png old mode 100755 new mode 100644 diff --git a/doc/app/images/tag_blue.png b/doc/app/images/tag_blue.png old mode 100755 new mode 100644 diff --git a/doc/app/js/search_index.js b/doc/app/js/search_index.js index f5703f3..a541f94 100644 --- a/doc/app/js/search_index.js +++ b/doc/app/js/search_index.js @@ -1 +1 @@ -var search_data = {"index":{"searchIndex":["applicationcontroller","applicationhelper","planetcontroller","planethelper","site","sitescontroller","siteshelper","trip","tripscontroller","tripshelper","type","typescontroller","typeshelper","user","visit","visitscontroller","visitshelper","contact()","create()","create()","create()","create()","destroy()","destroy()","destroy()","destroy()","edit()","edit()","edit()","edit()","ejemplo()","index()","index()","index()","index()","index()","new()","new()","new()","new()","show()","show()","show()","show()","update()","update()","update()","update()","readme_for_app"],"longSearchIndex":["applicationcontroller","applicationhelper","planetcontroller","planethelper","site","sitescontroller","siteshelper","trip","tripscontroller","tripshelper","type","typescontroller","typeshelper","user","visit","visitscontroller","visitshelper","planetcontroller#contact()","sitescontroller#create()","tripscontroller#create()","typescontroller#create()","visitscontroller#create()","sitescontroller#destroy()","tripscontroller#destroy()","typescontroller#destroy()","visitscontroller#destroy()","sitescontroller#edit()","tripscontroller#edit()","typescontroller#edit()","visitscontroller#edit()","planetcontroller#ejemplo()","planetcontroller#index()","sitescontroller#index()","tripscontroller#index()","typescontroller#index()","visitscontroller#index()","sitescontroller#new()","tripscontroller#new()","typescontroller#new()","visitscontroller#new()","sitescontroller#show()","tripscontroller#show()","typescontroller#show()","visitscontroller#show()","sitescontroller#update()","tripscontroller#update()","typescontroller#update()","visitscontroller#update()",""],"info":[["ApplicationController","","ApplicationController.html","",""],["ApplicationHelper","","ApplicationHelper.html","",""],["PlanetController","","PlanetController.html","","

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Acción vacía para la búsqueda\n"],["show","SitesController","SitesController.html#method-i-show","()","

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

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

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

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

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

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

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

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

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

    Methods

  • #contact — PlanetController -
  • #create — TypesController - -
  • #create — SitesController -
  • #create — TripsController
  • #create — VisitsController -
  • #destroy — TripsController +
  • #create — TypesController -
  • #destroy — TypesController +
  • #create — SitesController + +
  • #destroy — TripsController
  • #destroy — VisitsController
  • #destroy — SitesController -
  • #edit — TripsController +
  • #destroy — TypesController
  • #edit — TypesController +
  • #edit — SitesController +
  • #edit — VisitsController -
  • #edit — SitesController +
  • #edit — TripsController
  • #ejemplo — PlanetController @@ -133,30 +133,32 @@

    Methods

  • #index — PlanetController -
  • #new — TypesController -
  • #new — SitesController
  • #new — TripsController +
  • #new — TypesController +
  • #new — VisitsController -
  • #show — TripsController +
  • #search — PlanetController -
  • #show — TypesController +
  • #show — TripsController
  • #show — SitesController +
  • #show — TypesController +
  • #show — VisitsController
  • #update — SitesController +
  • #update — TripsController +
  • #update — TypesController
  • #update — VisitsController -
  • #update — TripsController - diff --git a/public/doc b/public/doc new file mode 120000 index 0000000..f430755 --- /dev/null +++ b/public/doc @@ -0,0 +1 @@ +../doc/ \ No newline at end of file diff --git a/test/functional/planet_controller_test.rb b/test/functional/planet_controller_test.rb index ce15d1b..edf1330 100644 --- a/test/functional/planet_controller_test.rb +++ b/test/functional/planet_controller_test.rb @@ -12,4 +12,9 @@ class PlanetControllerTest < ActionController::TestCase assert_response :success end + test "should get search" do + get(:search, {'q' => 'Text'}) + assert_response :success + end + end