Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ejercicio Rails Ia #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
Binary file added app/assets/images/antonio.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/fer.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/assets/stylesheets/planet.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
color: #226;
border-bottom: 3px dotted #77d;
}
/* Styles for authors/index */
#fotoFer{
float: rigth;
}
.cv{
float: left;
}
#fotoFer{
float: rigth;
}

/* Styles for products/index */

Expand Down
157 changes: 157 additions & 0 deletions app/assets/stylesheets/planet.css~
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
/* 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;
}

#columns {
background: #446;
}

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

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

#side a {
color: #bfb;
font-size: small;
}
/* END:mainlayout */

/* An entry in the store catalog (no utilizados de momento) */

#planet .entry {
overflow: auto;
margin-top: 1em;
border-bottom: 1px dotted #77d;
}

#planet .name {
font-size: 120%;
font-family: sans-serif;
}

#store .entry img {
width: 80px;
margin-right: 5px;
margin-bottom: 5px;
float: left;
}


#store .entry h3 {
margin-top: 0;
margin-bottom: 2px;
color: #227;
}

#store .entry p {
margin-top: 0.5em;
margin-bottom: 0.8em;
}

#store .entry .price_line {
clear: both;
margin-bottom: 0.5em;
}

#store .entry .add_to_cart {
position: relative;
}

#store .entry .price {
color: #44a;
font-weight: bold;
margin-right: 2em;
}
9 changes: 9 additions & 0 deletions app/controllers/types_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,13 @@ def destroy
format.json { head :no_content }
end
end

# ordered_index
def ordered_index
@types = Type.find(:all, :order => :name)
respond_to do |format|
format.html { render action: "index" }
format.json { render json: @types }
end
end
end
83 changes: 83 additions & 0 deletions app/controllers/types_controller.rb~
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
<%= link_to "Sitios", sites_path %><br />
<%= link_to "Contact", planet_contact_path %>
</div>
<div id="main">
<div id="main">
<%= link_to('Home', planet_index_path) + "|" + link_to('Contacts', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path) + "|" + link_to('Author', planet_author_path) + "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', types_ordered_index_path) %>
<%= yield %>
</br>
<%= link_to('Home', planet_index_path) + "|" + link_to('Contacts', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path) + "|" + link_to('Author', planet_author_path) + "|" + link_to('Tipos', types_path) + "|" + link_to('Tipos_ordenados', types_ordered_index_path) %>
</div>
</div>
</body>
</html>
</html>
36 changes: 36 additions & 0 deletions app/views/layouts/application.html.erb~
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<title>Planet</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>

<script type="text/javascript">
$(function() {
$( "#trip_description" ).cleditor();
});
</script>

</head>
<body id="planet">
<div id="banner">
<%= image_tag("logo3.png") %>
<%= @page_title || "Planet Travel Site" %>
</div>
<div id="columns">
<div id="side">
<%= link_to "Home", planet_index_path %><br />
<%= link_to "Tipos", types_path %><br />
<%= link_to "Sitios", sites_path %><br />
<%= link_to "Contact", planet_contact_path %>
</div>
<div id="main">
<%= link_to('Home', planet_index_path) + "|" + link_to('Contacts', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path) + "|" + link_to('Author', planet_author_path)%>
<%= yield %>
</br>
<%= link_to('Home', planet_index_path) + "|" + link_to('Contacts', planet_contact_path) + "|" + link_to('Ejemplo', planet_ejemplo_path) + "|" + link_to('Author', planet_author_path)%>
</div>
</div>
</body>
</html>
35 changes: 35 additions & 0 deletions app/views/planet/author.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<h1>Autores:</h1>

<div id="datosFer">
<div class="cv">
<ul>
<li>Nombre: Fernando Valdenebro González </br>
<li>Dirección postal: C/Posadas Nº.1, San Ildefonso, SEGOVIA, ESPAÑA </br>
<li>Email: [email protected]</br>
<li>Fecha de nacimiento: 14/09/1989</br>
<li>Estudios: Ingeniero de Telecomunicación (ETSIT-UPM)</br>
<li>Especialidad: Telemática </br>
</ul>
</div>

<div id="fotoFer">
<%= image_tag('fer.jpg') %>
</div>
</div>

<div id="datosAntonio">
<div class="cv">
<ul>
<li>Nombre: Antonio José Turel Rodríguez </br>
<li>Dirección postal: (sin definir)</br>
<li>Email: [email protected]</br>
<li>Fecha de nacimiento: (sin definir)</br>
<li>Estudios: Ingeniero de Telecomunicación (ETSIT-UPM) </br>
<li>Especialidad: Telemática </br>
</ul>
</div>

<div id="fotoAntonio">
<%= image_tag('antonio.jpg') %>
</div>
</div>
2 changes: 2 additions & 0 deletions app/views/planet/author.html.erb~
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Planet#author</h1>
<p>Find me in app/views/planet/author.html.erb</p>
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>Fecha de modificación: <%= (type.updated_at)%></dd>
</dl>
</td>

Expand Down
Loading