Browse Source

Added the tecnicas for the search bar and fixed the image sizes in home

carlos.diaz44 3 years ago
parent
commit
94aeed527d
4 changed files with 44 additions and 8 deletions
  1. BIN
      www/.index.html.swp
  2. 17
    5
      www/index.html
  3. 2
    2
      www/js/azar.js
  4. 25
    1
      www/js/searchfunctions.js

BIN
www/.index.html.swp View File


+ 17
- 5
www/index.html View File

254
                             //'title':'${Artesano.Nombre}','esp': '${info}'
254
                             //'title':'${Artesano.Nombre}','esp': '${info}'
255
                             //Tries to pass all the info of each artesano into a new page, the page that display this information is 'artesano.html', not to be confused with 'artesanias.html' or 'artesanos.html'(current page)
255
                             //Tries to pass all the info of each artesano into a new page, the page that display this information is 'artesano.html', not to be confused with 'artesanias.html' or 'artesanos.html'(current page)
256
                             //And puts this into the 'item' variable
256
                             //And puts this into the 'item' variable
257
-                            var item = ons.createElement(`<ons-list-item onclick="myNavigator.pushPage('artesano.html', { data: { title: '${Artesano.Nombre}', mun: '${Artesano.Municipio}', tel: '${Artesano["Telefono 1"]}', email: '${Artesano["E-mail"]}', esp: '${Artesano.Especificacion}', redes: '${Artesano["E-Commerce 1"]}' } })" tappable>
257
+                            var item = ons.createElement(`<ons-list-item onclick="myNavigator.pushPage('artesano.html', { data: { title: '${Artesano.Nombre}', mun: '${Artesano.Municipio}', tel: '${Artesano["Telefono 1"]}', email: '${Artesano["E-mail"]}', esp: '${Artesano.Especificacion}', redes: '${Artesano["E-Commerce 1"]}', tecnicas: '' } })" tappable>
258
                         <div class="title">${Artesano.Nombre}</div>
258
                         <div class="title">${Artesano.Nombre}</div>
259
                     </ons-list-item>`);
259
                     </ons-list-item>`);
260
 
260
 
393
                                      tel = lot[1],
393
                                      tel = lot[1],
394
                                      email = lot[2],
394
                                      email = lot[2],
395
                                      esp = lot[3],
395
                                      esp = lot[3],
396
-                                     redes = lot[4];
396
+                                     redes = lot[4],
397
+                                     tecnicas = '';
397
 
398
 
398
-                                 listaArt += `<ons-item tappable onclick="myNavigator.pushPage('artesano.html', {data: {title:'${arts[i]}', mun: '${mun}', tel: '${tel}', email: '${email}', esp: '${esp}', redes: '${redes}'}} )" ><div class="center">`+ arts[i] +`</div></ons-item><br>`;
399
+                                 listaArt += `<ons-item tappable onclick="myNavigator.pushPage('artesano.html', {data: {title:'${arts[i]}', mun: '${mun}', tel: '${tel}', email: '${email}', esp: '${esp}', redes: '${redes}', tecnicas: '' }} )" ><div class="center">`+ arts[i] +`</div></ons-item><br>`;
399
                              }
400
                              }
400
 
401
 
401
 
402
 
537
                     //It iterates though each artists in the all_artesanos json file from before, it displays their name in the "Buscar" page, and it gets prepared so that when its clicked it redirects to the "artesano.html" page with the other aditional information that we have other than the name.
538
                     //It iterates though each artists in the all_artesanos json file from before, it displays their name in the "Buscar" page, and it gets prepared so that when its clicked it redirects to the "artesano.html" page with the other aditional information that we have other than the name.
538
                     for (i = 0; i < all_artesanos.length;i++){
539
                     for (i = 0; i < all_artesanos.length;i++){
539
                         var artesano = ons.createElement(`<ons-list-item class = "artists"
540
                         var artesano = ons.createElement(`<ons-list-item class = "artists"
540
-                        onclick="SNavigator.pushPage('artesano.html', { data: {title: '${all_artesanos[i].Nombre}', mun: '${all_artesanos[i].Municipio}', tel: '${all_artesanos[i]["Telefono 1"]}', email: '${all_artesanos[i]["E-mail"]}', esp: '${all_artesanos[i].Especificacion}', redes: '${all_artesanos[i]["E-Commerce 1"]}' } })" tappable>
541
+                        onclick="SNavigator.pushPage('artesano.html', { data: {title: '${all_artesanos[i].Nombre}', mun: '${all_artesanos[i].Municipio}', tel: '${all_artesanos[i]["Telefono 1"]}', email: '${all_artesanos[i]["E-mail"]}', esp: '${all_artesanos[i].Especificacion}', redes: '${all_artesanos[i]["E-Commerce 1"]}', tecnicas: '${all_artesanos[i]["Tecnica 1"]}' } })" tappable>
541
                         <div>${all_artesanos[i].Nombre}</div>
542
                         <div>${all_artesanos[i].Nombre}</div>
542
                     </ons-list-item>`);
543
                     </ons-list-item>`);
543
                         document.getElementById('results').appendChild(artesano);
544
                         document.getElementById('results').appendChild(artesano);
571
                             tel = this.data.tel,
572
                             tel = this.data.tel,
572
                             em = this.data.email,
573
                             em = this.data.email,
573
                             esp = this.data.esp,
574
                             esp = this.data.esp,
574
-                            redes = this.data.redes;
575
+                            redes = this.data.redes,
576
+                            tecnicas = this.data.tecnicas;
575
 
577
 
576
                         //here the email is the string made from the start to where the '#' is.
578
                         //here the email is the string made from the start to where the '#' is.
577
                         email = em.slice(0, em.search("#"));
579
                         email = em.slice(0, em.search("#"));
638
                             console.log("no tiene nada");
640
                             console.log("no tiene nada");
639
                         }
641
                         }
640
 
642
 
643
+                        if(tecnicas.trim() != ''){
644
+                            if(tecnicas.includes(";", 0)){
645
+                                tecnicas = tecnicas.replace(/;/g,", ");
646
+                                data+='Tecnicas que usan: '+tecnicas+'<br>';
647
+                            }
648
+                            else {
649
+                                data+='Tecnicas que usan: '+tecnicas+'<br>';
650
+                            }
651
+                        }
652
+
641
                         //This is the part that allows eveything (data) to be displayed
653
                         //This is the part that allows eveything (data) to be displayed
642
                         document.getElementById("all").innerHTML = `${data}`;
654
                         document.getElementById("all").innerHTML = `${data}`;
643
 
655
 

+ 2
- 2
www/js/azar.js View File

6
 var page = document.getElementById("home");
6
 var page = document.getElementById("home");
7
 
7
 
8
 var aleatorio = Math.floor(Math.random()*52);
8
 var aleatorio = Math.floor(Math.random()*52);
9
-document.getElementById("image").innerHTML = `<img src="img/${aleatorio}.jpg" width="100%" height="300">`;
9
+document.getElementById("image").innerHTML = `<img src="img/${aleatorio}.jpg" width="100%" height="auto">`;
10
 document.getElementById("Content").innerHTML = "<h4>" + data[aleatorio].titulo + "</h4>" + data[aleatorio].texto; 
10
 document.getElementById("Content").innerHTML = "<h4>" + data[aleatorio].titulo + "</h4>" + data[aleatorio].texto; 
11
 
11
 
12
 page.addEventListener("show", function(event){
12
 page.addEventListener("show", function(event){
15
     var aleatorio = Math.floor(Math.random()*32);
15
     var aleatorio = Math.floor(Math.random()*32);
16
     //var azar = document.getElementById("azar");
16
     //var azar = document.getElementById("azar");
17
     //var img = ons.createElement(`<img src="img/${aleatorio}.png">`);
17
     //var img = ons.createElement(`<img src="img/${aleatorio}.png">`);
18
-    document.getElementById("image").innerHTML = `<img src="img/${aleatorio}.jpg" width="100%" height="300">`;
18
+    document.getElementById("image").innerHTML = `<img src="img/${aleatorio}.jpg" width="100%" height="auto">`;
19
     //document.getElementById("Title").innerHTML = data[aleatorio].Renglones;
19
     //document.getElementById("Title").innerHTML = data[aleatorio].Renglones;
20
     document.getElementById("Content").innerHTML = "<h4>" + data[aleatorio].titulo + "</h4>" + data[aleatorio].texto;
20
     document.getElementById("Content").innerHTML = "<h4>" + data[aleatorio].titulo + "</h4>" + data[aleatorio].texto;
21
     //azar.appendChild(img);
21
     //azar.appendChild(img);

+ 25
- 1
www/js/searchfunctions.js View File

53
             x[i].style.display = "list-item";
53
             x[i].style.display = "list-item";
54
             continue;
54
             continue;
55
         }
55
         }
56
+        else if (find_tecnicas(i,input)){
57
+            x[i].style.display = "list-item";
58
+            continue;
59
+        }
56
         else if (find_artesania(i,input)){
60
         else if (find_artesania(i,input)){
57
             x[i].style.display = "list-item";
61
             x[i].style.display = "list-item";
58
             continue;
62
             continue;
76
 //Te trata de buscar si cualquiera de ellos tienen el input que se dio aplica a ese artista especifico (i)
80
 //Te trata de buscar si cualquiera de ellos tienen el input que se dio aplica a ese artista especifico (i)
77
 function find_any(i,input){
81
 function find_any(i,input){
78
     //if you find any of these in that space then return 1 if you didnt find that anything matched with the input then return 0
82
     //if you find any of these in that space then return 1 if you didnt find that anything matched with the input then return 0
79
-    if (find_name(i,input) || find_telefono(i,input) || find_email(i,input) || find_artesania(i,input) || find_municipio(i,input)){
83
+    if (find_tecnicas(i,input) || find_name(i,input) || find_telefono(i,input) || find_email(i,input) || find_artesania(i,input) || find_municipio(i,input)){
80
         return 1;
84
         return 1;
81
     }
85
     }
82
     else{
86
     else{
117
     return 0;
121
     return 0;
118
 }
122
 }
119
 
123
 
124
+
125
+function find_tecnicas(i,input){
126
+    var tecnicas = all_artesanos[i]["Tecnica 1"];
127
+    tecnicas = tecnicas.trim().toLowerCase();
128
+    tecnicas = acento_replace(tecnicas);
129
+    if(tecnicas.search(input) != -1){
130
+        return 1;
131
+    }
132
+    //artesanias = artesanias.split(',');
133
+    //for (var j = 0; j < artesanias.length; j++){
134
+        //var artesania = artesanias[j];
135
+        //artesania = artesania.trim().toLowerCase();
136
+        //artesania = acento_replace(artesania);
137
+        //if (artesania.search(input) != -1){
138
+            //return 1;
139
+        //}
140
+    //}
141
+    return 0;
142
+}
143
+
120
 //trata de ver si el input es parte del municipio del artista i
144
 //trata de ver si el input es parte del municipio del artista i
121
 //Mayuscula y acento proof
145
 //Mayuscula y acento proof
122
 function find_municipio(i,input){
146
 function find_municipio(i,input){