morel-theme 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,34 @@
1
+ ---
2
+ layout: page
3
+ ---
4
+ <div style="padding-bottom: 3rem;">
5
+ <form class="form-inline" action="/search.html" method="get">
6
+ <div class="top_search_con">
7
+ <input class="form-control mr-sm-2" placeholder="busca aquí ..." type="text" style="color:var(--color-1);" id="search-box" name="query">
8
+ </div>
9
+ </form>
10
+ <form action="/search.html" method="get">
11
+ <label for="search-box">Search</label>
12
+ <input type="text" id="search-box" name="query">
13
+ <input type="submit" value="search">
14
+ </form>
15
+ </div>
16
+
17
+ <ul id="search-results"></ul>
18
+
19
+ <script>
20
+ window.store = {
21
+ {% for book in site.books %}
22
+ "{{ book.url | slugify }}": {
23
+ "title": "{{ book.title | xml_escape }}",
24
+ "descarga": "{{ book.descarga | xml_escape }}",
25
+ "author": "{{ book.author | xml_escape }}",
26
+ "content": {{ book.content | strip_html | strip_newlines | jsonify }},
27
+ "url": "{{ book.url | xml_escape }}"
28
+ }
29
+ {% unless forloop.last %},{% endunless %}
30
+ {% endfor %}
31
+ };
32
+ </script>
33
+ <script src="{{ BASE_PATH }}/js/lunr.min.js"></script>
34
+ <script src="{{ BASE_PATH }}/js/search.js"></script>
@@ -0,0 +1,62 @@
1
+ (function() {
2
+ function displaySearchResults(results, store) {
3
+ var searchResults = document.getElementById('search-results');
4
+
5
+ if (results.length) { // Are there any results?
6
+ var appendString = '';
7
+
8
+ for (var i = 0; i < results.length; i++) { // Iterate over the results
9
+ var item = store[results[i].ref];
10
+ appendString += '<li><a href="' + item.url + '"><h3>' + item.title + '</h3></a>';
11
+ appendString += '<p>' + item.content.substring(0, 150) + '...</p></li>';
12
+ appendString += '<li><a class="morel" href="' + item.descarga + '">descarga</a></li>';
13
+ }
14
+
15
+ searchResults.innerHTML = appendString;
16
+ } else {
17
+ searchResults.innerHTML = '<p>Aún esa obra o esa autora no están disponibles. <a href="{{BASE_PATH}}/agregar">Sugiere su incorporación</a><p>';
18
+ }
19
+ }
20
+
21
+ function getQueryVariable(variable) {
22
+ var query = window.location.search.substring(1);
23
+ var vars = query.split('&');
24
+
25
+ for (var i = 0; i < vars.length; i++) {
26
+ var pair = vars[i].split('=');
27
+
28
+ if (pair[0] === variable) {
29
+ return decodeURIComponent(pair[1].replace(/\+/g, '%20'));
30
+ }
31
+ }
32
+ }
33
+
34
+ var searchTerm = getQueryVariable('query');
35
+
36
+ if (searchTerm) {
37
+ document.getElementById('search-box').setAttribute("value", searchTerm);
38
+
39
+ // Initalize lunr with the fields it will be searching on. I've given title
40
+ // a boost of 10 to indicate matches on this field are more important.
41
+ var idx = lunr(function () {
42
+ this.field('id');
43
+ this.field('title', { boost: 10 });
44
+ this.field('author');
45
+ this.field('author');
46
+ this.field('content');
47
+ });
48
+
49
+ for (var key in window.store) { // Add the data to lunr
50
+ idx.add({
51
+ 'id': key,
52
+ 'title': window.store[key].title,
53
+ 'author': window.store[key].author,
54
+ 'author': window.store[key].author,
55
+ 'content': window.store[key].content
56
+ });
57
+
58
+ var results = idx.search(searchTerm); // Get lunr to perform a search
59
+ displaySearchResults(results, window.store); // We'll write this in the next section
60
+ }
61
+ }
62
+ })();
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morel-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - febr3s
@@ -40,12 +40,20 @@ files:
40
40
  - _includes/footer.html
41
41
  - _includes/lista-todas-sample.html
42
42
  - _includes/nav-bar.html
43
+ - _includes/obras-por-autora.html
44
+ - _includes/obras-por-ciudad.html
45
+ - _includes/obras-por-imprenta-y-editorial.html
46
+ - _includes/obras-por-repositorio.html
43
47
  - _includes/promotion.html
44
48
  - _includes/social-block.html
45
49
  - _includes/ultima-vitrina.html
50
+ - _layouts/busquedas.html
51
+ - _layouts/default-blog.html
46
52
  - _layouts/default.html
47
53
  - _layouts/index.html
54
+ - _layouts/page-chriteria.html
48
55
  - _layouts/page.html
56
+ - _layouts/periodo.html
49
57
  - _layouts/post.html
50
58
  - assets/css/main.css
51
59
  - assets/img/tema/+obras.png
@@ -53,12 +61,23 @@ files:
53
61
  - assets/img/tema/autora.jpg
54
62
  - assets/img/tema/avatar.png
55
63
  - assets/img/tema/bello-fondo.png
64
+ - assets/img/tema/e.png
56
65
  - assets/img/tema/edicion.jpg
57
66
  - assets/img/tema/imprenta.jpg
67
+ - assets/img/tema/l.png
58
68
  - assets/img/tema/logo.png
59
69
  - assets/img/tema/lugar.jpg
70
+ - assets/img/tema/m.png
71
+ - assets/img/tema/o.png
72
+ - assets/img/tema/r.png
60
73
  - assets/img/tema/repositorio.jpg
61
74
  - assets/img/tema/trama.png
75
+ - assets/js/app.js
76
+ - assets/js/jquery-3.3.1.js
77
+ - assets/js/lunr.min.js
78
+ - assets/js/particles.js
79
+ - assets/js/search.html
80
+ - assets/js/search.js
62
81
  homepage: http://morel.la.
63
82
  licenses:
64
83
  - MIT