Skip to content

Commit

Permalink
Cargo datos en seed
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorBosch committed Aug 4, 2014
1 parent 49c1255 commit af631c5
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 54 deletions.
Binary file added app/assets/images/economista.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/english-teacher1.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/estudianteArte.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/guitar-teacher1.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/ingeniero.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/jubilada.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/profesoraPiano.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion app/assets/stylesheets/courses.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ thead th {
.container-opinions {
background-size: auto auto;
width: auto;
height: 630px;
position: relative;
}

8 changes: 5 additions & 3 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def is_logued_student_with_facebook_id?
def get_profile_picture_for_user(user)
unless user.nil? then
puts "User: #{user}"
if user.facebook_id then
puts "http://graph.facebook.com/#{user.facebook_id}/picture?type=large"
if not user.facebook_id.nil? and user.facebook_id != 0 then
#puts "http://graph.facebook.com/#{user.facebook_id}/picture?type=large"
return "http://graph.facebook.com/#{user.facebook_id}/picture?type=large"
else
return nil
end
end
end
return "http://sndt.ac.in/images/courses/courses-imgs.jpg"
end

Expand Down
76 changes: 35 additions & 41 deletions app/views/courses/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,23 @@ de vuelta para que se vean lindas pisando la config que toque arriba :P
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<!-- All slides go inside .carousel-inner
<div class="item active">
<img src="http://sndt.ac.in/images/courses/courses-imgs.jpg" width="400" height="300" alt="..." />
<div class="carousel-caption">Primer imagen</div>
</div>
<div class="item">
<img src="https://www.coleurope.eu/content/studyprogrammes/law/images/Students%20in%20a%20course.%20nb%20031.jpg" width="400" height="300" alt="..." />
<div class="carousel-caption">Segunda imagen</div>
</div>
<div class="item">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTNKieMWGkXrXpzTlOl8J04vlc7lrrWwPlmqk2cUlrhN5Btrq1Pnw" width="400" height="300" alt="..." />
<div class="carousel-caption">Tercer imagen</div>
</div>
</div>
-->
<% if(@course.uploads.size() > 0) %>
<% if(@course.uploads.size() > 0) %>
<div class="item active">
<img src="<%= @course.uploads.first().upload %>" style="width:400px;height:300px;" />
<div class="carousel-caption">Primer imagen</div>
<div class="carousel-caption"><%= @course.name %></div>
</div>
<% @course.uploads.drop(1).each do |u| %>
<div class="item ">
<img src="<%= u.upload %>" style="width:400px;height:300px;" />
<div class="carousel-caption"><%= @course.name %></div>
</div>
<% end %>
<% else %>
<div class="item active">
<img src="../college.png" style="width:400px;height:300px;" />
<div class="carousel-caption"><%= @course.name %></div>
</div>
<% end %>
<% else %>
<div class="item active">
<%= image_tag "college.png" , :size=>"300x400" %>
<div class="carousel-caption"><%= @course.name %></div>
</div>
<% end %>
</div>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
Expand Down Expand Up @@ -181,32 +166,35 @@ de vuelta para que se vean lindas pisando la config que toque arriba :P
<div class="tab-content">
<div class="tab-pane fade in active" id="Reseñas">
<%= bootstrap_form_for [@course, Opinion.new] do |f| %>
<div class="panel-body" id ="listasReseñas">
<ul class="media-list container-opinionsResults">
<div class="panel-body container-opinionsResults" id ="listasReseñas">
<ul class="media-list ">
<% @course.opinions.select{|op| not op.user.nil?}.each do |o| %>
<li class="media">
<div class="media-body">
<h5 class="media-heading">
<a class="pull-left" href="#"> <img class="media-object" src=<%= get_profile_picture_for_user o.user%> width="64" height="64" alt="..." /> </a>
<% if get_profile_picture_for_user o.user %>
<a class="pull-left" href="#"> <img class="media-object" src=<%= get_profile_picture_for_user o.user%> width="64" height="64" alt="..." /> </a>
<% else %>
<a class="pull-left" href="#">
<%= image_tag o.user.image , :size=>"64x64" %></a>
<% end %>
<b><%= o.user.name %></b>
<%= o.date %>
<input id="opinion_<%= o.id %>" type="number" class="rating" min=0 max=5 readonly="true" data-container-class='text-right' value="<%= o.rating.nil? ? 0 : o.rating%>" data-size='xs' >
</h5>
</h5>
<%= o.description %>

<input id="opinion_<%= o.id %>" type="number" class="rating" min=0 max=5 readonly="true" data-container-class='text-right' value="<%= o.rating.nil? ? 0 : o.rating%>" data-size='xs' >
</div>
</li>
<% end %>
</ul>
</div>

<% if current_user %>
<div class="col-md-12 col-ms-offset-1" >
<a id="newOpinion" class="list-group-item " > <h4 class="list-group-item-heading"> Dejanos tu comentario </h4>
<p class="list-group-item-text">
<textarea class="form-control" id="opinion_description" name="opinion[description]" placeholder="Descripción"></textarea>
<br>
<input id="opinion_rating" name="opinion[rating]" value="0" type="number" class="rating" min=0 max=5 step=1 data-size="xs" >

<button id="addOpinion" class="btn btn-primary col-md-offset-11" >
Add
</button>
Expand All @@ -216,30 +204,35 @@ de vuelta para que se vean lindas pisando la config que toque arriba :P
</div>
<% end %>
<% end %>
</div>
</div>
<div class="tab-pane fade" id="Consultas">

<%= bootstrap_form_for [@course, Consultation.new] do |f| %>
<div class="panel-body" id ="listaConsultas">
<ul class="media-list container-opinionsResults">
<div class="panel-body container-opinionsResults" id ="listaConsultas">
<ul class="media-list ">
<% @course.consultations.select{|consulta| not consulta.user.nil?}.each do |c| %>
<% if(c.user.role == User::ROLE_TEACHER) %>
<li class="media list-group-item-success">
<% else %>
<li class="media list-group-item-success">
<% else %>
<li class="media">
<% end %>
<div class="media-body">
<h5 class="media-heading"> <% unless c.user.nil? %>
<a class="pull-left" href="#"> <img class="media-object " src=<%= get_profile_picture_for_user c.user%> width="64" height="64" alt="..." /> </a>
<b><%= c.user.name %></b>
<%= c.date %>
<% end %> </h5>
<h5 class="media-heading">
<% unless c.user.nil? %>
<% if get_profile_picture_for_user c.user %>
<a class="pull-left" href="#"> <img class="media-object" src=<%= get_profile_picture_for_user c.user%> width="64" height="64" alt="..." /> </a>
<% else %>
<a class="pull-left" href="#">
<%= image_tag c.user.image , :size=>"64x64" %></a>
<% end %>
<% end %>
</h5>
<%= c.description %>
</div>
</li>
<% end %>
</ul>
</div>
<div class="col-md-12 col-ms-offset-1" >
<a id="newOpinion" class="list-group-item " > <h4 class="list-group-item-heading"> Preguntas </h4>
<p class="list-group-item-text">
Expand All @@ -251,6 +244,7 @@ de vuelta para que se vean lindas pisando la config que toque arriba :P

</p> </a>
</div>
</div>
<% end %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/students/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<% end %>
<p><b>Email:</b> <%= @student.email %></p>
<p><b>Descripción:</b> <%= @student.description %></p>
<img src="http://espndeportes-assets.espn.go.com/2003/photos2013/0930/g_icardi_200x300.jpg" width="200" height="200"/>
<%= image_tag @student.image , :size=>"200x200" %></a>
</div>
</div>
</div>
Expand Down
50 changes: 42 additions & 8 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
Subcategory.create(:name => "Tango", :category_id => 3)
Subcategory.create(:name => "Capoeira", :category_id => 3)

Tag.create(:name => "Musica")
Tag.create(:name => "Idioma")
Tag.create(:name => "Baile")
Tag.create(:name => "Avanzado")
Tag.create(:name => "Intermedio")
Tag.create(:name => "Principiante")
Tag.create(:name => "Experiencia")

Plan.create(:name => "Visitas Básico", :type => "VisitsPlan", :price => 100.00, :active => true)
Plan.create(:name => "Visitas Full", :type => "VisitsPlan", :price => 300.00, :active => true)
Expand All @@ -30,20 +31,53 @@

#PROFES
User.create(:name => "Juan Perez", :description => "Profesor de guitarra. 12 años de experiencia", :image => "guitar-teacher1.jpg", :birthdate => "1966-07-08 00:00:00", :email => "[email protected]", :role => User::ROLE_TEACHER, :password => "123123", :password_confirmation => "123123")
User.create(:name => "Carla Gomez", :description => "Profesora de ingles. 5 años viviendo en Inglaterra. Certificaciones internacionales", :image => "english-teacher1.jpg", :birthdate => "1978-04-19 00:00:00", :email => "[email protected]", :role => User::ROLE_TEACHER, :password => "123123", :password_confirmation => "123123")
User.create(:name => "Carla Gomez", :description => "Profesora de ingles y francés. 5 años viviendo en Europa. Certificaciones internacionales", :image => "english-teacher1.jpg", :birthdate => "1978-04-19 00:00:00", :email => "[email protected]", :role => User::ROLE_TEACHER, :password => "123123", :password_confirmation => "123123")
User.create(:name => "Amanda González", :description => "Profesora de piano. Reconocida internacionalmente.", :image => "profesoraPiano.jpg", :birthdate => "1950-04-19 00:00:00", :email => "[email protected]", :role => User::ROLE_TEACHER, :password => "123123", :password_confirmation => "123123")

#ESTUDIANTES
User.create(:name => "Mauro Icardi", :description => "Jugador del Inter de Milan", :image => nil, :birthdate => "1990-04-16 00:00:00", :email => "[email protected]", :role => User::ROLE_STUDENT, :password => "123123", :password_confirmation => "123123", :facebook_id => 666474016767940)
User.create(:name => "Esteban Garcia", :description => "Economista", :image => "economista.jpg", :birthdate => "1974-06-20 00:00:00", :email => "[email protected]", :role => User::ROLE_STUDENT, :password => "123123", :password_confirmation => "123123")
User.create(:name => "Susana Rinaldi", :description => "Jubilada", :image => "jubilada.jpg", :birthdate => "1950-09-16 00:00:00", :email => "[email protected]", :role => User::ROLE_STUDENT, :password => "123123", :password_confirmation => "123123")
User.create(:name => "Lucas Estevez", :description => "Ingeniero", :image => "ingeniero.jpg", :birthdate => "1985-02-07 00:00:00", :email => "[email protected]", :role => User::ROLE_STUDENT, :password => "123123", :password_confirmation => "123123")
User.create(:name => "Micaela Baez", :description => "Estudiante de arte", :image => "estudianteArte.jpg", :birthdate => "1993-05-03 00:00:00", :email => "[email protected]", :role => User::ROLE_STUDENT, :password => "123123", :password_confirmation => "123123")

Course.create(name: "Guitarra para principiantes", description: "Curso de guitarra en zona sur", longitude: -58.3887, latitude: -34.8029, address: "Avenida Tomás Espora 1007, Adrogué, Buenos Aires Province, Argentina", subcategory_id: 1, price: 150)
Course.create(name: "Super curso de guitarra", description: "Aprende las canciones que te gustan", longitude: -58.39121840000001, latitude: -34.7970765, address: "Mitre 1230, Adrogué, Buenos Aires Province, Argentina", subcategory_id: 1, price: 90)
Course.create(name: "Curso de Piano clásico", description: "Curso de piano, nivel avanzado", longitude: -58.38872439999999, latitude: -34.8103353, address: "Avenida Tomás Espora 1507, Adrogué, Buenos Aires Province, Argentina", subcategory_id: 2, price: 350)
Course.create(name: "Aprenda ingles con Miss Carla", description: "Clases de ingles para escolares", longitude: -58.3792534, latitude: -34.7678337, address: "Temperley, Buenos Aires Province, Argentina", subcategory_id: 4, price: 200)
Course.create(name: "Francés para todas las edades!", description: "Clases de francés en todos los niveles, para todas las edades. Más de 50 años de experiencia.", longitude: -58.3945, latitude: -34.7789, address: "Avenida Eva Perón, Temperley, Buenos Aires, Argentina 280", subcategory_id: 5, price: 300)

#CourseStudent.create(:student_id => 1, :course_id => 1)
CourseTeacher.create(:teacher_id => 1, :course_id => 1)
CourseTeacher.create(:teacher_id => 1, :course_id => 2)
CourseTeacher.create(:teacher_id => 2, :course_id => 4)
CourseTeacher.create(:teacher_id => 2, :course_id => 5)
CourseTeacher.create(:teacher_id => 3, :course_id => 3)

#Curso 1 - Guitarra
Opinion.create(description: "El profesor sabe mucho pero no explica bien", course_id: 1, date: Time.now - 1, rating: 2, user_id: 6)
Opinion.create(description: "El curso es muy interesante, se aprende un montón", course_id: 1, date: Time.now - 5, rating: 4, user_id: 4)
Consultation.create(description: "Buenas tardes, quería saber los días en los que se dicta el curso. Gracias!", course_id: 1, date: Time.now - 10, user_id: 7)
Consultation.create(description: "Buenas tardes Micaela, los cursos se dictan de lunes a viernes, en horarios acordados con el alumno. Saludos ", course_id: 1, date: Time.now - 3, user_id: 1)

#Curso 2 - Guitarra
Opinion.create(description: "100% recomendado! El profe un genio!", course_id: 2, date: Time.now - 2, rating: 4, user_id: 7)
Opinion.create(description: "El profesor explica muy bien!", course_id: 2, date: Time.now - 3, rating: 5, user_id: 5)

#Curso 4 - Ingles
Opinion.create(description: "Las profesoras son muy agradables, en la clase se habla todo el tiempo en inglés.", course_id: 4, date: Time.now - 10, rating: 4, user_id: 7)
Opinion.create(description: "Fue una buena experiencia, aunque hubiera preferido un curso más personalizado, con menos alumnos.", course_id: 4, date: Time.now - 5, rating: 3, user_id: 4)


Opinion.create(description: "100% recomendado! El profe un genio!", course_id: 2, date: Time.now - 2, rating: 4)
Opinion.create(description: "El profesor explica muy bien!", course_id: 2, date: Time.now - 3, rating: 5)
Opinion.create(description: "El profesor sabe mucho pero no explica bien", course_id: 1, date: Time.now - 1, rating: 2)
Opinion.create(description: "El profesor es un ladrón!", course_id: 1, date: Time.now - 5, rating: 1)
#Imagenes curso
Upload.create(upload_file_name: "curso6.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 44974 ,upload_updated_at: "2014-08-03 19:43:22",course_id: 1 ,created_at: "2014-08-03 19:43:22" ,updated_at: "2014-08-03 19:43:22")
Upload.create(upload_file_name: "curso7.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 26901 ,upload_updated_at: "2014-08-03 19:43:22",course_id: 1 ,created_at: "2014-08-03 19:43:22" ,updated_at: "2014-08-03 19:43:22")
Upload.create(upload_file_name: "curso8.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 2729778 ,upload_updated_at: "2014-08-03 19:43:22",course_id: 1 ,created_at: "2014-08-03 19:43:22" ,updated_at: "2014-08-03 19:43:22")
Upload.create(upload_file_name: "curso3.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 16682 ,upload_updated_at: "2014-08-03 20:12:21",course_id: 4 ,created_at: "2014-08-03 20:12:21" ,updated_at: "2014-08-03 20:12:21")
Upload.create(upload_file_name: "curso4.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 29123 ,upload_updated_at: "2014-08-03 20:12:21",course_id: 4 ,created_at: "2014-08-03 20:12:21" ,updated_at: "2014-08-03 20:12:21")
Upload.create(upload_file_name: "curso1.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 577049 ,upload_updated_at: "2014-08-03 20:12:22",course_id: 4 ,created_at: "2014-08-03 20:12:22" ,updated_at: "2014-08-03 20:12:22")
Upload.create(upload_file_name: "curso_piano1.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 23420 ,upload_updated_at: "2014-08-03 20:15:39",course_id: 3 ,created_at: "2014-08-03 20:15:39" ,updated_at: "2014-08-03 20:15:39")
Upload.create(upload_file_name: "curso_piano2.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 48925 ,upload_updated_at: "2014-08-03 20:15:39",course_id: 3 ,created_at: "2014-08-03 20:15:39" ,updated_at: "2014-08-03 20:15:39")
Upload.create(upload_file_name: "curso_piano3.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 200566 ,upload_updated_at: "2014-08-03 20:15:39",course_id: 3 ,created_at: "2014-08-03 20:15:39" ,updated_at: "2014-08-03 20:15:39")
Upload.create(upload_file_name: "curso_piano4.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 72422 ,upload_updated_at: "2014-08-03 20:20:29",course_id: 2 ,created_at: "2014-08-03 20:20:30" ,updated_at: "2014-08-03 20:20:30")
Upload.create(upload_file_name: "curso_guitarra4.jpg" ,upload_content_type: "image/jpeg" ,upload_file_size: 3626228 ,upload_updated_at: "2014-08-03 20:20:30",course_id: 2 ,created_at: "2014-08-03 20:20:30" ,updated_at: "2014-08-03 20:20:30")

0 comments on commit af631c5

Please sign in to comment.