Skip to content
Snippets Groups Projects
Commit c1d673ea authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

replace subjects by highlights in main page

parent 1cdffd9e
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
color: white; color: white;
} }
.mainpage-subjects, .mainpage-highlights { .mainpage-highlights {
margin-top: 30px; margin-top: 30px;
h2 { h2 {
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
} }
} }
.mainpage-subject-element { .mainpage-highlight-element {
width: 250px; width: 250px;
h4 { h4 {
......
...@@ -37,11 +37,11 @@ class SearchController < ApplicationController ...@@ -37,11 +37,11 @@ class SearchController < ApplicationController
def autocomplete def autocomplete
begin begin
auto = AutocompleteService.new auto = AutocompleteService.new
query = params["q"] || "" query = params['q'] || ''
json_data = auto.query(query) json_data = auto.query(query)
render text: json_data render text: json_data
rescue rescue
render text: "[]" render text: '[]'
end end
end end
......
...@@ -11,9 +11,7 @@ class WelcomeController < ApplicationController ...@@ -11,9 +11,7 @@ class WelcomeController < ApplicationController
learning_object_repository.find(id) learning_object_repository.find(id)
end end
@subjects = subject_repository.all_from_offset_to_limit 0, 10 @highlights = learning_object_repository.all_by_score_from_offset_to_limit 0, 6
@subjects.reject!{|s| s.highlights.blank?}
@subjects = @subjects.take(6)
end end
def faq def faq
......
...@@ -121,6 +121,11 @@ module OrientDb ...@@ -121,6 +121,11 @@ module OrientDb
[] []
end end
def all_by_score_from_offset_to_limit(offset, limit)
objects_hash = connection.query "SELECT FROM LearningObject ORDER BY score DESC LIMIT #{limit} SKIP #{offset}", limit: limit
objects = build_objects(objects_hash) || []
end
def get_subjects(learning_object) def get_subjects(learning_object)
result = get_edges_end("IsAbout", "out", learning_object.id) result = get_edges_end("IsAbout", "out", learning_object.id)
subject_repository.build_objects(result) subject_repository.build_objects(result)
...@@ -290,4 +295,4 @@ module OrientDb ...@@ -290,4 +295,4 @@ module OrientDb
end end
end end
end end
\ No newline at end of file
...@@ -66,15 +66,14 @@ ...@@ -66,15 +66,14 @@
<% end %> <% end %>
</div> </div>
<div class="row mainpage-subjects"> <div class="row mainpage-highlights">
<div class="col-md-12"> <div class="col-md-12">
<% unless @subjects.blank? %> <% unless @highlights.blank? %>
<div class="row learning-object-columns"> <div class="row learning-object-columns">
<h2>Destaque</h2> <h2>Destaque</h2>
<% @subjects.each do |subject| %> <% @highlights.each do |highlight| %>
<div class="row mainpage-subject-element"> <div class="row mainpage-highlight-element">
<h4><b><%= subject.name %></b></h4> <%= render highlight, orientation: 'vertical' %>
<%= render subject.highlights.first, orientation: 'vertical' unless subject.highlights.first.nil? %>
<p class="more"> <p class="more">
<a href="#">Ver Mais</a> <a href="#">Ver Mais</a>
</p> </p>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment