|
@@ -459,43 +459,73 @@ |
459 |
459 |
|
$("#navigationGallery label").removeClass("btn-bsav"); |
460 |
460 |
|
$(this).addClass("btn-bsav"); |
461 |
461 |
|
|
462 |
|
- |
console.log( thisCarouselData) |
|
462 |
+ |
Gallery.generateChildrensActuacions( thisCarouselData ); |
|
463 |
+ |
}) |
463 |
464 |
|
|
464 |
|
- |
if( $(this).attr("id") === "btnImgsGallery" ) |
|
465 |
+ |
/* |
|
466 |
+ |
* @desc Genera los elementos hijos si son imágenes, crea arrays de objetos globales |
|
467 |
+ |
* @param Data - Array de objetos |
|
468 |
+ |
*/ |
|
469 |
+ |
Gallery.generateChildrens = function( data ) |
|
470 |
+ |
{ |
|
471 |
+ |
Gallery.videoCommons = [];//videos globales |
|
472 |
+ |
Gallery.imagesCommons = [];//imágenes globales |
|
473 |
+ |
for( obj in data ) |
465 |
474 |
|
{ |
466 |
|
- |
for(var i=0 ; i< thisCarouselData.length ; i++) |
|
475 |
+ |
if( _.has( data[obj] , 'img' ) ) |
467 |
476 |
|
{ |
468 |
|
- |
if( thisCarouselData[i].desc ) |
469 |
|
- |
{ |
470 |
|
- |
$('<div class="item"><center><img src="'+thisCarouselData[i].img+'"><br><div class="carousel-caption"><h5 style="font-weight: bold;">'+thisCarouselData[i].title+'</h5><p style="font-size: 14px">'+thisCarouselData[i].desc+'</p></div></center></div>').appendTo('.carousel-inner'); |
471 |
|
- |
} |
472 |
|
- |
else |
473 |
|
- |
{ |
474 |
|
- |
$('<div class="item"><center><img src="'+thisCarouselData[i].img+'"><div class="carousel-caption"><h5 style="font-weight: bold;">'+thisCarouselData[i].title+'</h5></div></center></div>').appendTo('.carousel-inner'); |
475 |
|
- |
} |
|
477 |
+ |
|
|
478 |
+ |
Gallery.imagesCommons.push({ |
|
479 |
+ |
id: obj, |
|
480 |
+ |
date: _.has( data[obj] , 'date' ) === true ? data[obj].date.value : null, |
|
481 |
+ |
desc: _.has( data[obj] , 'desc' ) === true ? data[obj].desc.value : null, |
|
482 |
+ |
img: _.has( data[obj] , 'img' ) === true ? data[obj].img.value : null, |
|
483 |
+ |
title: _.has( data[obj] , 'title' ) === true ? data[obj].title.value : null |
|
484 |
+ |
}) |
|
485 |
+ |
} |
|
486 |
+ |
else if( _.has( data[obj] , 'video' ) ) |
|
487 |
+ |
{ |
|
488 |
+ |
Gallery.videoCommons.push({ |
|
489 |
+ |
id: obj, |
|
490 |
+ |
desc: _.has( data[obj] , 'desc' ) === true ? data[obj].desc.value : null, |
|
491 |
+ |
title: _.has( data[obj] , 'title' ) === true ? data[obj].title.value : null, |
|
492 |
+ |
video: _.has( data[obj] , 'video' ) === true ? data[obj].video.value : null |
|
493 |
+ |
}) |
476 |
494 |
|
} |
477 |
495 |
|
} |
478 |
|
- |
else |
|
496 |
+ |
|
|
497 |
+ |
Gallery.imagesCommons.sort(function(a,b) |
|
498 |
+ |
{ |
|
499 |
+ |
return new Date(b.date) - new Date(a.date); |
|
500 |
+ |
}); |
|
501 |
+ |
|
|
502 |
+ |
Gallery.imagesCommons.reverse(); |
|
503 |
+ |
|
|
504 |
+ |
Gallery.hideVideos(); |
|
505 |
+ |
|
|
506 |
+ |
Gallery.displayCarousel(); |
|
507 |
+ |
|
|
508 |
+ |
$(".carousel-inner").html( "" ); |
|
509 |
+ |
|
|
510 |
+ |
for(var i=0 ; i < Gallery.imagesCommons.length ; i++) |
479 |
511 |
|
{ |
480 |
|
- |
for(var i=0 ; i< thisCarouselData.length ; i++) |
|
512 |
+ |
if( Gallery.imagesCommons[i].desc ) |
481 |
513 |
|
{ |
482 |
|
- |
if( thisCarouselData[i].desc.value ) |
483 |
|
- |
{ |
484 |
|
- |
$('<div class="item"><center><img src="'+thisCarouselData[i].img.value+'"><br><div class="carousel-caption"><h5 style="font-weight: bold;">'+thisCarouselData[i].title.value+'</h5><p style="font-size: 14px">'+thisCarouselData[i].desc.value+'</p></div></center></div>').appendTo('.carousel-inner'); |
485 |
|
- |
} |
486 |
|
- |
else |
487 |
|
- |
{ |
488 |
|
- |
$('<div class="item"><center><img src="'+thisCarouselData[i].img.value+'"><div class="carousel-caption"><h5 style="font-weight: bold;">'+thisCarouselData[i].title.value+'</h5></div></center></div>').appendTo('.carousel-inner'); |
489 |
|
- |
} |
|
514 |
+ |
$('<div class="item"><center><img src="'+Gallery.imagesCommons[i].img+'"><br><div class="carousel-caption"><strong><h5 style="font-weight: bold;">'+Gallery.imagesCommons[i].title+'</h5></strong><p style="font-size: 14px">'+Gallery.imagesCommons[i].desc+'</p></div></center></div>').appendTo('.carousel-inner'); |
|
515 |
+ |
} |
|
516 |
+ |
else |
|
517 |
+ |
{ |
|
518 |
+ |
$('<div class="item"><center><img src="'+Gallery.imagesCommons[i].img+'"><div class="carousel-caption"><h4>'+Gallery.imagesCommons[i].title+'</h4></div></center></div>').appendTo('.carousel-inner'); |
490 |
519 |
|
} |
491 |
520 |
|
} |
492 |
521 |
|
|
493 |
|
- |
Gallery.displayControls(thisCarouselData); |
|
522 |
+ |
$("#navigationGallery").appendTo("#buttonsMoved"); |
|
523 |
+ |
|
|
524 |
+ |
Gallery.displayControls(Gallery.imagesCommons); |
494 |
525 |
|
|
495 |
526 |
|
$('.item').first().addClass('active'); |
496 |
527 |
|
|
497 |
528 |
|
$(".carousel").css("max-height", "500px"); |
498 |
|
- |
$(".carousel img").css("display", "block"); |
499 |
529 |
|
|
500 |
530 |
|
//$('.carousel-indicators > li').first().addClass('active'); |
501 |
531 |
|
$('#bsav-gallery-carrousel').carousel(); |
|
@@ -504,22 +534,21 @@ |
504 |
534 |
|
caption.css('display','none'); |
505 |
535 |
|
$('#captionGallery').html(caption.html()); |
506 |
536 |
|
Gallery.displayCaption(); |
507 |
|
- |
}) |
|
537 |
+ |
} |
508 |
538 |
|
|
509 |
539 |
|
/* |
510 |
540 |
|
* @desc Genera los elementos hijos si son imágenes, crea arrays de objetos globales |
511 |
541 |
|
* @param Data - Array de objetos |
512 |
542 |
|
*/ |
513 |
|
- |
Gallery.generateChildrens = function( data ) |
|
543 |
+ |
Gallery.generateChildrensActuacions = function( data ) |
514 |
544 |
|
{ |
515 |
|
- |
Gallery.videoCommons = [];//videos globales |
516 |
|
- |
Gallery.imagesCommons = [];//imágenes globales |
|
545 |
+ |
Gallery.actuacio = [];//videos globales |
|
546 |
+ |
Gallery.videoActuacio = [];//imágenes globales |
517 |
547 |
|
for( obj in data ) |
518 |
548 |
|
{ |
519 |
549 |
|
if( _.has( data[obj] , 'img' ) ) |
520 |
550 |
|
{ |
521 |
|
- |
|
522 |
|
- |
Gallery.imagesCommons.push({ |
|
551 |
+ |
Gallery.actuacio.push({ |
523 |
552 |
|
id: obj, |
524 |
553 |
|
date: _.has( data[obj] , 'date' ) === true ? data[obj].date.value : null, |
525 |
554 |
|
desc: _.has( data[obj] , 'desc' ) === true ? data[obj].desc.value : null, |
|
@@ -529,7 +558,7 @@ |
529 |
558 |
|
} |
530 |
559 |
|
else if( _.has( data[obj] , 'video' ) ) |
531 |
560 |
|
{ |
532 |
|
- |
Gallery.videoCommons.push({ |
|
561 |
+ |
Gallery.videoActuacio.push({ |
533 |
562 |
|
id: obj, |
534 |
563 |
|
desc: _.has( data[obj] , 'desc' ) === true ? data[obj].desc.value : null, |
535 |
564 |
|
title: _.has( data[obj] , 'title' ) === true ? data[obj].title.value : null, |
|
@@ -538,34 +567,32 @@ |
538 |
567 |
|
} |
539 |
568 |
|
} |
540 |
569 |
|
|
541 |
|
- |
Gallery.imagesCommons.sort(function(a,b) |
|
570 |
+ |
Gallery.actuacio.sort(function(a,b) |
542 |
571 |
|
{ |
543 |
572 |
|
return new Date(b.date) - new Date(a.date); |
544 |
573 |
|
}); |
545 |
574 |
|
|
546 |
|
- |
Gallery.imagesCommons.reverse(); |
547 |
|
- |
|
548 |
575 |
|
Gallery.hideVideos(); |
549 |
576 |
|
|
550 |
577 |
|
Gallery.displayCarousel(); |
551 |
578 |
|
|
552 |
579 |
|
$(".carousel-inner").html( "" ); |
553 |
580 |
|
|
554 |
|
- |
for(var i=0 ; i < Gallery.imagesCommons.length ; i++) |
|
581 |
+ |
for(var i=0 ; i < Gallery.actuacio.length ; i++) |
555 |
582 |
|
{ |
556 |
|
- |
if( Gallery.imagesCommons[i].desc ) |
|
583 |
+ |
if( Gallery.actuacio[i].desc ) |
557 |
584 |
|
{ |
558 |
|
- |
$('<div class="item"><center><img src="'+Gallery.imagesCommons[i].img+'"><br><div class="carousel-caption"><strong><h5 style="font-weight: bold;">'+Gallery.imagesCommons[i].title+'</h5></strong><p style="font-size: 14px">'+Gallery.imagesCommons[i].desc+'</p></div></center></div>').appendTo('.carousel-inner'); |
|
585 |
+ |
$('<div class="item"><center><img src="'+Gallery.actuacio[i].img+'"><br><div class="carousel-caption"><strong><h5 style="font-weight: bold;">'+Gallery.actuacio[i].title+'</h5></strong><p style="font-size: 14px">'+Gallery.actuacio[i].desc+'</p></div></center></div>').appendTo('.carousel-inner'); |
559 |
586 |
|
} |
560 |
587 |
|
else |
561 |
588 |
|
{ |
562 |
|
- |
$('<div class="item"><center><img src="'+Gallery.imagesCommons[i].img+'"><div class="carousel-caption"><h4>'+Gallery.imagesCommons[i].title+'</h4></div></center></div>').appendTo('.carousel-inner'); |
|
589 |
+ |
$('<div class="item"><center><img src="'+Gallery.actuacio[i].img+'"><div class="carousel-caption"><h4></h4></div></center></div>').appendTo('.carousel-inner'); |
563 |
590 |
|
} |
564 |
591 |
|
} |
565 |
592 |
|
|
566 |
593 |
|
$("#navigationGallery").appendTo("#buttonsMoved"); |
567 |
594 |
|
|
568 |
|
- |
Gallery.displayControls(Gallery.imagesCommons); |
|
595 |
+ |
Gallery.displayControls(Gallery.actuacio); |
569 |
596 |
|
|
570 |
597 |
|
$('.item').first().addClass('active'); |
571 |
598 |
|
|
|
@@ -630,11 +657,11 @@ |
630 |
657 |
|
var explodedType = data.type.split("-")[0]; |
631 |
658 |
|
var grouped = _.groupBy(response.data.childrens, 'post_type'); |
632 |
659 |
|
Gallery.generateButtonsActuacions( grouped, explodedType ); |
633 |
|
- |
Gallery.generateChildrens( grouped["aereas-"+explodedType] ); |
634 |
660 |
|
Gallery.arrayAereas = grouped["aereas-"+explodedType]; |
635 |
661 |
|
Gallery.arrayPonts = grouped["ponts-"+explodedType]; |
636 |
662 |
|
Gallery.arrayElevats = grouped["elevats-"+explodedType]; |
637 |
|
- |
Gallery.arrayVideos = _.has( grouped , 'videos-'+explodedType ) === true ? grouped["videos-"+explodedType] : []; |
|
663 |
+ |
Gallery.videoCommons = _.has( grouped , 'videos-'+explodedType ) === true ? grouped["videos-"+explodedType] : []; |
|
664 |
+ |
Gallery.generateChildrensActuacions( grouped["aereas-"+explodedType] ); |
638 |
665 |
|
} |
639 |
666 |
|
Gallery.hidePreloader(); |
640 |
667 |
|
} |