Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,15 @@ GEM
mime-types (1.17.2)
multi_json (1.1.0)
orm_adapter (0.0.7)
<<<<<<< HEAD
=======
paperclip (2.4.5)
activerecord (>= 2.3.0)
activesupport (>= 2.3.2)
cocaine (>= 0.0.2)
mime-types
pg (0.13.2)
>>>>>>> Entrega6/master
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
Expand Down
Binary file added app/assets/images/Javi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/Lara.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/Lara.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/foto.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 32 additions & 10 deletions app/assets/stylesheets/planet.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
border-bottom: 3px dotted #77d;
}

#planet h3 {
font: 120% sans-serif;
color: #226;
}

/* Styles for products/index */

#site_list table {
Expand Down Expand Up @@ -90,29 +95,46 @@
}

#columns {
background: #446;

}


#main {
margin-left: 9em; /* Ajuste de borde izquierdo */
margin-left: 2em; /* Ajuste de borde izquierdo */
margin-right: 2em; /* Ajuste de borde izquierdo */
padding-top: 4ex;
padding-left: 2em;
background: white;
}

#side {
float: left;
padding-top: 1em;
padding-left: 1em;
padding-bottom: 1em;
width: 8em; /* Ajuste de borde izquierdo */

#footer {
background: #446;
}

#side a {
#footer a {
background: #446;
padding-left: 2em;
color: #bfb;
font-size: small;
}
#footer a:hover {
background: #446;
color: #fff;
font-size: small;
}

#leftauthor{
width: 49%;
float: left;
margin-right: 5px;
}
#rightauthor{
width: 49%;
float: right;
margin-right: 5px;
}


/* END:mainlayout */

/* An entry in the store catalog (no utilizados de momento) */
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/planet_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ def contact

def ejemplo
end


def author
end

end
25 changes: 25 additions & 0 deletions app/controllers/sites_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
class SitesController < ApplicationController
<<<<<<< HEAD
before_filter :authenticate_user!, :except => [ :index, :show ]
=======

# authenticate_user! ejecuta acción solo si sesión existe
before_filter :authenticate_user!, :except => [ :index, :show ]
after_filter :count_visita, :only => :show

>>>>>>> Entrega6/master
# GET /sites
# GET /sites.json
def index
Expand Down Expand Up @@ -33,7 +37,11 @@ def show
# GET /sites/new.json
def new
@site = current_user.sites.build # crea sitio vacio asociado a current_user
<<<<<<< HEAD

=======

>>>>>>> Entrega6/master
respond_to do |format|
format.html # new.html.erb
format.json { render json: @site }
Expand All @@ -42,14 +50,22 @@ def new

# GET /sites/1/edit
def edit
<<<<<<< HEAD
@site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user
=======
@site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user
>>>>>>> Entrega6/master
end

# POST /sites
# POST /sites.json
def create
@site = current_user.sites.build(params[:site]) # Asigna solo si sitio asociado a current_user
<<<<<<< HEAD

=======

>>>>>>> Entrega6/master
respond_to do |format|
if @site.save
format.html { redirect_to @site, notice: 'Site was successfully created.' }
Expand All @@ -64,8 +80,13 @@ def create
# PUT /sites/1
# PUT /sites/1.json
def update
<<<<<<< HEAD
@site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user

=======
@site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user

>>>>>>> Entrega6/master
respond_to do |format|
if @site.update_attributes(params[:site])
format.html { redirect_to @site, notice: 'Site was successfully updated.' }
Expand All @@ -80,7 +101,11 @@ def update
# DELETE /sites/1
# DELETE /sites/1.json
def destroy
<<<<<<< HEAD
@site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user
=======
@site = current_user.sites.find(params[:id]) # busca solo en sitios asociados a current_user
>>>>>>> Entrega6/master
@site.destroy

respond_to do |format|
Expand Down
11 changes: 11 additions & 0 deletions app/controllers/types_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,15 @@ def destroy
format.json { head :no_content }
end
end

# GET /types/ordered_index
# GET /types/ordered_index.json
def ordered_index
@types = Type.find(:all, :order => :name)

respond_to do |format|
format.html # index.html.erb
format.json { render json: @types }
end
end
end
5 changes: 5 additions & 0 deletions app/models/site.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
class Site < ActiveRecord::Base
belongs_to :type
belongs_to :user
<<<<<<< HEAD

attr_protected :user_id
=======
has_many :visits
has_many :trips, :through => :visits
has_attached_file :image
Expand All @@ -11,4 +15,5 @@ class Site < ActiveRecord::Base

# Se añaden estas definiciones
validates :name, :type_id, :presence => true # campo obligatorio
>>>>>>> Entrega6/master
end
10 changes: 10 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
class User < ActiveRecord::Base
<<<<<<< HEAD
=======

has_many :sites
has_many :trips

>>>>>>> Entrega6/master
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable

<<<<<<< HEAD
# Setup accessible (or protected) attributes for your model
attr_accessible :name, :email, :password, :password_confirmation, :remember_me

has_many :sites
=======
validates_presence_of :name

# Setup accessible (or protected) attributes for your model
attr_accessible :name, :email, :password, :password_confirmation, :remember_me
>>>>>>> Entrega6/master
end
7 changes: 7 additions & 0 deletions app/views/devise/registrations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>

<<<<<<< HEAD
<div><%= f.label :name %><br />
<%= f.text_field :name %></div>

<div><%= f.label :email %><br />
=======
<p><%= f.label :name %><br /> <%= f.text_field :name %></p> <div><%= f.label :email %><br />
>>>>>>> Entrega6/master
<%= f.email_field :email %></div>

<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
Expand Down
6 changes: 6 additions & 0 deletions app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>

<<<<<<< HEAD
<div><%= f.label :name %><br />
<%= f.text_field :name %></div>

=======
<p><%= f.label :name %><br /> <%= f.text_field :name %></p>
>>>>>>> Entrega6/master
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>

Expand Down
45 changes: 44 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,37 @@
<body id="planet">
<div id="banner">
<%= image_tag("logo3.png") %>
<<<<<<< HEAD
<%= @page_title || "Planet Travel Site" %>
<div class="user">
<% if current_user %>
<%= link_to current_user.name,
edit_user_registration_path %> |
<%= link_to "Sign out", destroy_user_session_path %>
<% else %>
<%= link_to "Sign in", new_user_session_path %>
<% end %>
</div>

</div>
<div id="footer">
<%= link_to "Home", planet_index_path %>
<%= link_to "Contact", planet_contact_path %>
<%= link_to "Ejemplo", planet_ejemplo_path %>
<%= link_to "Authors", planet_author_path %>
<%= link_to "Tipos", types_path %>
<%= link_to "Ordered Types", types_ordered_index_path %>
<%= link_to "Sitios", sites_path %>
<%= link_to "Contact", planet_contact_path %>
<%= link_to "Sign up", new_user_registration_path %>
</div>
<div id="columns">

<div id="main">
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %>
=======
<%= @page_title || "Planet Travel Site" %><br />
<div class="user"> <% if current_user %> <%= link_to current_user.name, edit_user_registration_path %> | <%= link_to "Sign out", destroy_user_session_path, :method => :delete %> <% else %> <%= link_to "Sign in", new_user_session_path %> <% end %>
</div>
Expand All @@ -29,7 +60,19 @@
<div id="main">
<p class="notice"><%= notice %></p> <p class="alert"><%= alert %></p>
<%= yield %>
>>>>>>> Entrega6/master
</div>
</div>
<div id="footer">
<%= link_to "Home", planet_index_path %>
<%= link_to "Contact", planet_contact_path %>
<%= link_to "Ejemplo", planet_ejemplo_path %>
<%= link_to "Authors", planet_author_path %>
<%= link_to "Tipos", types_path %>
<%= link_to "Ordered Types", types_ordered_index_path %>
<%= link_to "Sitios", sites_path %>
<%= link_to "Contact", planet_contact_path %>
<%= link_to "Sign up", new_user_registration_path %>
</div>
</body>
</html>
</html>
Expand Down
1 change: 1 addition & 0 deletions app/views/planet/author.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Authors:</h1><p>This site was created by:</p><div id="leftauthor"> <h3>Lara Lorna Jimenez Jimenez</h3> <p><strong>Dirección:</strong> Calle Paradisia nº38 Las Rozas 28230 Madrid</p> <p><strong>E-mail:</strong> [email protected]</p> <%= image_tag('Lara.jpg') %> <p>Becaria del Grupo de Sistemas Inteligentes (GSI)<br> Estudiante de 4º curso de Ingeniería Superior de Telecomunicaciones (ETSIT)</p></div><div id="rightauthor"> <h3>Javier Espinosa</h3> <p><strong>Dirección:</strong> Calle Arturo Soria nº134 Madrid</p> <p><strong>E-mail:</strong> [email protected]</p> <%= image_tag('Javi.jpg') %> <p>Estudiante de Ingeniería Superior de Telecomunicaciones (2007-Ahora) <br> Becario del Grupo de Sistemas Inteligentes (GSI) desde 2011</p></div><br><p>Feel free to contact us at any time.</p>
Expand Down
2 changes: 1 addition & 1 deletion app/views/planet/index.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h1>Wecome to the Planet Travel Site</h1><p>This site gathers information of touristic sites from all over the world and should help you to organize your trips and your holidays.</p><%= image_tag('pedriza2-m.png') %><p>Feel free to use it for your convenience and pleasure.</p>
<h1>Wecome to the Planet Travel Site</h1><p>This site gathers information of touristic sites from all over the world and should help you to organize your trips and your holidays.</p><%= image_tag('foto.jpg') %><p>Feel free to use it for your convenience and pleasure.</p>
Expand Down
12 changes: 11 additions & 1 deletion app/views/sites/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,26 @@

<td class="list_actions">
<%= link_to 'Show', site %><br/>
<<<<<<< HEAD
<% if site.user == current_user %>
<%= link_to 'Edit', edit_site_path(site) %><br/>
<%= link_to 'Destroy', site,
:confirm => 'Are you sure?',
:method => :delete %>
<% end %>
</td>
=======
<% if site.user == current_user %> <%= link_to 'Edit', edit_site_path(site) %><br/>
<%= link_to 'Destroy', site,
:confirm => 'Are you sure?',
:method => :delete %>
<% end %> </td>
>>>>>>> Entrega6/master
</tr>
<% end %>
</table>
</div>

<br />

<%= link_to 'New site', new_site_path %>
<%= link_to 'New site', new_site_path %>
Expand Down
19 changes: 17 additions & 2 deletions app/views/sites/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
<div id="site">
<div id="site">

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

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

<h3><%= @site.name %></h3>

<p><%=sanitize @site.description %></p>

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

<<<<<<< HEAD
<% if @site.user == current_user %>
=======
<p><b>Autor:</b> <%= @site.user.name if @site.user %></p>
</div>
>>>>>>> Entrega6/master

<div class="visitas">
<b>Visitas:</b> <%= @site.visitas %>
</div>

<p />
<<<<<<< HEAD
<%= link_to 'Edit', edit_site_path(@site) %> |
<% end %>
<%= link_to 'Back', sites_path %>

</div>
=======
<% if @site.user == current_user %> <%= link_to 'Edit', edit_site_path(@site) %> |<% end %><%= link_to 'Back', sites_path %>
>>>>>>> Entrega6/master
Expand Down
1 change: 1 addition & 0 deletions app/views/types/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<dt><%= link_to type.name, type_sites_path(type) %></dt>
<dd><%= truncate(strip_tags(type.description),
:length => 80) %></dd>
<dd><strong>Modified: </strong><%= type.updated_at %></dd>
</dl>
</td>

Expand Down
Loading