-
Notifications
You must be signed in to change notification settings - Fork 5
/
bolsa.html
201 lines (164 loc) · 5.87 KB
/
bolsa.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
---
layout: default
title: Bolsa de trabajo
---
<div class="home">
{% if site.paginate %}
{% assign posts = paginator.trabajos %}
{% else %}
{% assign posts = site.trabajos %}
{% endif %}
{%- if posts.size > 0 -%}
<div id="title" class="banner">
<h2>Esta plataforma virtual se construye de forma colaborativa, entre varios colectivos y actores sociales insertos en el territorio que aportan a la difusión y comprensión de todas las iniciativas solidarias.</h2>
<div id="search-container" class="search">
<select id="departamento" class="filter">
<option value="" selected>Departamento</option>
{%- for post in site.departamentos -%}
<option value="{{ post.nombre }}">{{ post.nombre }}</option>
{%- endfor -%}
</select>
<select id="barrio" class="filter">
<option value="" selected>Barrio/Localidad</option>
</select>
<select id="categoria" class="filter">
</select>
<input type="text" id="search-input" class="search-field" placeholder="Buscar por nombre ...">
</div>
</div>
<!-- hay un java script que oculta uno de estos dos divs dependiendo si se muestra todo el listado o solo las búsquedas-->
<div id="results-container" class="row flex-grid"></div>
<div id="row" class="row flex-grid">
{%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
{%- for post in posts -%}
<a class="post-link" href="{{ post.url | relative_url }}">
<article class="box-item">
<div class="box-body">
<div class="box-barrio">
<span class="post-meta">{{ post.barrio }}, {{ post.departamento }}</span>
</div>
<h3>
<a class="post-link" href="{{ post.url | relative_url }}">
{{ post.title | escape }}
</a>
</h3>
<p>{{ post.categoria }}</p>
{%- if site.show_excerpts -%}
{{ post.excerpt }}
{%- endif -%}
</div>
</article>
</a>
{%- endfor -%}
</div>
{% if site.paginate %}
<div class="pager">
<ul class="pagination">
{%- if paginator.previous_page %}
<li><a href="{{ paginator.previous_page_path | relative_url }}" class="previous-page">{{ paginator.previous_page }}</a></li>
{%- else %}
<li><div class="pager-edge">•</div></li>
{%- endif %}
<li><div class="current-page">{{ paginator.page }}</div></li>
{%- if paginator.next_page %}
<li><a href="{{ paginator.next_page_path | relative_url }}" class="next-page">{{ paginator.next_page }}</a></li>
{%- else %}
<li><div class="pager-edge">•</div></li>
{%- endif %}
</ul>
</div>
{%- endif %}
{%- endif -%}
</div>
<script src="js/jquery-3.4.1.min.js"></script>
<script>
$("#departamento").change(function() {
var $dropdown = $(this);
$.getJSON("/search.json", function(data) {
var depto = $dropdown.val();
var barrioVals = [];
for (var i = 0; i < data.length; i++) {
for (var key in data[i]) {
if (key == 'departamento' && data[i][key] == depto) {
/*hay barrios separados por comas*/
var barrios = data[i]['barrio'].split(",")
for (var j = 0; j < barrios.length; j++) {
if (!barrioVals.includes(barrios[j])) {
barrioVals.push(barrios[j])
}
}
}
}
}
barrioVals.sort();
var $secondChoice = $("#barrio");
$secondChoice.empty();
$secondChoice.append("<option value=\"\" selected>" + "Barrio/Localidad" + "</option>");
$.each(barrioVals, function(index, value) {
$secondChoice.append("<option>" + value + "</option>");
});
});
});
</script>
<script>
$(document).ready(function(){
$.getJSON("/bolsa-search.json", function(data) {
var actividadVals = [];
for (var i = 0; i < data.length; i++) {
for (var key in data[i]) {
if (key == 'categoria' && !actividadVals.includes(data[i][key])) {
actividadVals.push(data[i][key])
}
}
}
actividadVals.sort();
var $secondChoice = $("#categoria");
$secondChoice.empty();
$secondChoice.append("<option value=\"\" selected>" + "Categoría" + "</option>");
$.each(actividadVals, function(index, value) {
$secondChoice.append("<option>" + value + "</option>");
});
});
});
</script>
<script>
$(document).ready(function(){
$("#search-input").keyup(function() {
$("#row").hide();
});
});
$(document).ready(function(){
$("#departamento").change(function() {
$("#row").hide();
});
});
$(document).ready(function(){
$("#barrio").change(function() {
$("#row").hide();
});
});
$(document).ready(function(){
$("#actividad").change(function() {
$("#row").hide();
});
});
</script>
<!-- Script pointing to search-script.js -->
<script src="js/search-script.js" type="text/javascript"></script>
<!-- Configuration -->
<script>
var filtersMap = new Map();
filtersMap.set('departamento', document.getElementById("departamento"));
filtersMap.set('barrio', document.getElementById("barrio"));
filtersMap.set('categorias', document.getElementById("categoria"));
SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
searchResultTemplate: '<article class="box-item"><div class="box-body"><div class="box-barrio"><span class="post-meta">{barrio}, {departamento}</span></div><h3><a class="post-link" href="{url}">{title}</a></h3><p>{categoria}</p></div></article>',
noResultsText: ("¡No se encontraron resultados!"),
limit: 1000,
fuzzy: false,
filterSelectTags: filtersMap,
json: '/bolsa-search.json'
})
</script>