Procházet zdrojové kódy

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

carlos.diaz44 před 4 roky
rodič
revize
94aeed527d
4 změnil soubory, kde provedl 44 přidání a 8 odebrání
  1. binární
      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ární
www/.index.html.swp Zobrazit soubor


+ 17
- 5
www/index.html Zobrazit soubor

@@ -254,7 +254,7 @@
254 254
                             //'title':'${Artesano.Nombre}','esp': '${info}'
255 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 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 258
                         <div class="title">${Artesano.Nombre}</div>
259 259
                     </ons-list-item>`);
260 260
 
@@ -393,9 +393,10 @@
393 393
                                      tel = lot[1],
394 394
                                      email = lot[2],
395 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,7 +538,7 @@
537 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 539
                     for (i = 0; i < all_artesanos.length;i++){
539 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 542
                         <div>${all_artesanos[i].Nombre}</div>
542 543
                     </ons-list-item>`);
543 544
                         document.getElementById('results').appendChild(artesano);
@@ -571,7 +572,8 @@
571 572
                             tel = this.data.tel,
572 573
                             em = this.data.email,
573 574
                             esp = this.data.esp,
574
-                            redes = this.data.redes;
575
+                            redes = this.data.redes,
576
+                            tecnicas = this.data.tecnicas;
575 577
 
576 578
                         //here the email is the string made from the start to where the '#' is.
577 579
                         email = em.slice(0, em.search("#"));
@@ -638,6 +640,16 @@
638 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 653
                         //This is the part that allows eveything (data) to be displayed
642 654
                         document.getElementById("all").innerHTML = `${data}`;
643 655
 

+ 2
- 2
www/js/azar.js Zobrazit soubor

@@ -6,7 +6,7 @@ var data = JSON.parse(localStorage.getItem("AZAR"));
6 6
 var page = document.getElementById("home");
7 7
 
8 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 10
 document.getElementById("Content").innerHTML = "<h4>" + data[aleatorio].titulo + "</h4>" + data[aleatorio].texto; 
11 11
 
12 12
 page.addEventListener("show", function(event){
@@ -15,7 +15,7 @@ page.addEventListener("show", function(event){
15 15
     var aleatorio = Math.floor(Math.random()*32);
16 16
     //var azar = document.getElementById("azar");
17 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 19
     //document.getElementById("Title").innerHTML = data[aleatorio].Renglones;
20 20
     document.getElementById("Content").innerHTML = "<h4>" + data[aleatorio].titulo + "</h4>" + data[aleatorio].texto;
21 21
     //azar.appendChild(img);

+ 25
- 1
www/js/searchfunctions.js Zobrazit soubor

@@ -53,6 +53,10 @@ function filter_any(input){
53 53
             x[i].style.display = "list-item";
54 54
             continue;
55 55
         }
56
+        else if (find_tecnicas(i,input)){
57
+            x[i].style.display = "list-item";
58
+            continue;
59
+        }
56 60
         else if (find_artesania(i,input)){
57 61
             x[i].style.display = "list-item";
58 62
             continue;
@@ -76,7 +80,7 @@ function filter_any(input){
76 80
 //Te trata de buscar si cualquiera de ellos tienen el input que se dio aplica a ese artista especifico (i)
77 81
 function find_any(i,input){
78 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 84
         return 1;
81 85
     }
82 86
     else{
@@ -117,6 +121,26 @@ function find_artesania(i,input){
117 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 144
 //trata de ver si el input es parte del municipio del artista i
121 145
 //Mayuscula y acento proof
122 146
 function find_municipio(i,input){