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

Entrega5 #24

Open
wants to merge 6 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/foto_perfil.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/controllers/planet_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ def contact
def ejemplo
end

def author
end

end
11 changes: 11 additions & 0 deletions app/controllers/types_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ def index
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 # ordered_index.html.erb
format.json { render json: @types }
end
end

# GET /types/1
# GET /types/1.json
def show
Expand Down
4 changes: 4 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
</head>
<body>

<%= link_to('Index', planet_index_path) + " " + link_to('Contact', planet_contact_path) + " " + link_to('Ejemplo', planet_ejemplo_path) + " " + link_to('Autor', planet_author_path) + " " + link_to('Types', types_path) + " " + link_to('Ordered Index Types', types_ordered_index_path) %>

<%= yield %>

<%= link_to('Index', planet_index_path) + " " + link_to('Contact', planet_contact_path) + " " + link_to('Ejemplo', planet_ejemplo_path) + " " + link_to('Autor', planet_author_path) + " " + link_to('Types', types_path) + " " + link_to('Ordered Index Types', types_ordered_index_path) %>

</body>
</html>
10 changes: 10 additions & 0 deletions app/views/planet/author.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<h1> Autor </h1>

<%= image_tag('foto_perfil.jpg') %>
<ul>
<li> Nombre: Juan Antonio Zea Herranz </li>
<li> Dirección: C/ Calabria 18, Madrid </li>
<li> email: [email protected] </li>
<li> Curriculum: Estudiante de telecomunicación, trabajador de Qindel, empresario en proceso. </li>
<ul>

4 changes: 4 additions & 0 deletions app/views/types/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<tr>
<th>Name</th>
<th>Description</th>
<th>Created</th>
<th>Last Updated</th>
<th></th>
<th></th>
<th></th>
Expand All @@ -13,6 +15,8 @@
<tr>
<td><%= type.name %></td>
<td><%= type.description %></td>
<td><%= type.created_at %></td>
<td><%= type.updated_at %></td>
<td><%= link_to 'Show', type %></td>
<td><%= link_to 'Edit', edit_type_path(type) %></td>
<td><%= link_to 'Destroy', type, confirm: 'Are you sure?', method: :delete %></td>
Expand Down
29 changes: 29 additions & 0 deletions app/views/types/ordered_index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<h1>Listing types</h1>

<table>
<tr>
<th>Name</th>
<th>Description</th>
<th>Created</th>
<th>Last Updated</th>
<th></th>
<th></th>
<th></th>
</tr>

<% @types.each do |type| %>
<tr>
<td><%= type.name %></td>
<td><%= type.description %></td>
<td><%= type.created_at %></td>
<td><%= type.updated_at %></td>
<td><%= link_to 'Show', type %></td>
<td><%= link_to 'Edit', edit_type_path(type) %></td>
<td><%= link_to 'Destroy', type, confirm: 'Are you sure?', method: :delete %></td>
</tr>
<% end %>
</table>

<br />

<%= link_to 'New Type', new_type_path %>
10 changes: 10 additions & 0 deletions app/views/types/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
<%= @type.description %>
</p>

<p>
<b>Created:</b>
<%= @type.created_at %>
</p>

<p>
<b>Last Update:</b>
<%= @type.updated_at %>
</p>


<%= link_to 'Edit', edit_type_path(@type) %> |
<%= link_to 'Back', types_path %>
5 changes: 5 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Planet::Application.routes.draw do

get "types/ordered_index"

resources :types

get "planet/index"
Expand All @@ -7,6 +10,8 @@

get "planet/ejemplo"

get "planet/author"

# The priority is based upon order of creation:
# first created -> highest priority.

Expand Down
10 changes: 10 additions & 0 deletions test/functional/planet_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,14 @@ class PlanetControllerTest < ActionController::TestCase
assert_response :success
end

test "should get ejemplo" do
get :ejemplo
assert_response :success
end

test "should get author" do
get :author
assert_response :success
end

end