minor adjustments

This commit is contained in:
ajuvercr 2020-09-16 01:40:48 +02:00
parent 039b5935f9
commit 78c055636b
4 changed files with 10 additions and 7 deletions

View file

@ -87,7 +87,8 @@ function ready() {
}
const documents = <%= CreateFullTextIndex.new(@items.find_all("**/verenigingen/*") + @items.find_all("**/konventen/*")).call.to_json %>;
partials = <%= to_partials_search(all_groups()) %>;
const partials = <%= to_partials_search(all_groups()) %>;
const index = lunr(function () {
this.field('id', {boost: 15});
this.field('title', {boost: 10});
@ -101,7 +102,7 @@ function ready() {
doSearch = (query) => {
clearDiv(wrapper);
render_results(wrapper, index.search(query).sortByKey(i => partials[i.ref].titel).stableSort((a, b) => b.score - a.score).map(i => partials[i.ref]));
render_results(wrapper, index.search(query).sortByKey(i => partials[i.ref].titel).stableSort((a, b) => b.score - a.score).map(i => partials[i.ref].html));
window.history.pushState("search state", "", window.location.pathname + "?q="+query);
};

View file

@ -435,7 +435,7 @@ fieldset p label input {
gap: 20px;
padding: 0.5rem;
max-width: 700px;
max-width: 600px;
flex-grow: 1;
min-width: 20%;
}
@ -446,7 +446,6 @@ fieldset p label input {
gap: 20px;
flex-wrap: wrap;
justify-content: space-evenly;
}
.link:hover {

View file

@ -1,4 +1,4 @@
<a class="link" href="<%= item.path %>">
<div class="link" onclick="window.location.href='<%= item.path %>'">
<div class="link__img">
<img src="https://dsa.ugent.be/api/verenigingen/<%= abbreviation(item) %>/logo?size=small" alt="<%= item[:naam] %>">
</div>
@ -10,4 +10,4 @@
<%= text_segment(item.compiled_content) %>
</p>
</div>
</a>
</div>

View file

@ -30,7 +30,10 @@ module SearchHelper
my_hash = {}
items.each do |item|
my_hash[(item.path)] = (render '/partials/pretty_link.*', :item => item).gsub("\n", '')
my_hash[(item.path)] = {
html: (render '/partials/pretty_link.*', :item => item).gsub("\n", ''),
titel: item[:titel] || item[:naam]
}
end
my_hash.to_json
end