Skip to content

Commit 720d70c

Browse files
shubham3211agbilotia1998
authored andcommitted
track and room filter work when star applied (#1764)
1 parent 8fc0dce commit 720d70c

File tree

1 file changed

+54
-11
lines changed

1 file changed

+54
-11
lines changed

src/backend/templates/schedule.hbs

+54-11
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@
495495
trackName = $(this).text();
496496
trackFilterMode = 1;
497497
roomFilterMode=0;
498+
var local_storage_events=JSON.parse(localStorage[eventName]);
498499
499500
var sidebarDiv = $('.side-collapse');
500501
if (!sidebarDiv.hasClass('in'))
@@ -521,7 +522,11 @@
521522
$(this).find('.event').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0 ||
522523
$(this).find('.speaker-name').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0) {
523524
var name=$(this).find('.title-inline .blacktext').text();
524-
if(name!=trackName) {
525+
var id=$(this).attr('id');
526+
if(mode && local_storage_events[id]!=1)
527+
{
528+
$(this).hide();
529+
}else if(name!=trackName) {
525530
$(this).hide();
526531
} else {
527532
$(this).show();
@@ -558,6 +563,7 @@
558563
roomName = $(this).text();
559564
roomFilterMode = 1;
560565
trackFilterMode = 0;
566+
var local_storage_events = JSON.parse(localStorage[eventName]);
561567
562568
var sidebarDiv = $('.side-collapse');
563569
if (!sidebarDiv.hasClass('in'))
@@ -584,7 +590,10 @@
584590
$(this).find('.event').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0 ||
585591
$(this).find('.speaker-name').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0) {
586592
var name = $(this).find('#location').text();
587-
if (name != roomName) {
593+
var id=$(this).attr('id');
594+
if(mode && local_storage_events[id]!=1) {
595+
$(this).hide();
596+
} else if (name != roomName) {
588597
$(this).hide();
589598
} else {
590599
$(this).show();
@@ -611,20 +620,26 @@
611620
});
612621
613622
$('.fossasia-filter').change(function() {
623+
614624
var filterVal = $(this).val();
625+
var local_storage_events = JSON.parse(localStorage[eventName]);
626+
615627
$('.day-filter').each(function() {
616628
var temp = 1;
617629
$(this).find('.time-filter').each(function() {
618630
var flag = 1;
619631
$(this).find('.schedule-track').each(function() {
632+
var id=$(this).attr('id');
620633
if ($(this).find('.tip-description').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0 ||
621634
$(this).find('.session-speakers-list a p span').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0 ||
622635
$(this).find('.session-speakers-more').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0 ||
623636
$(this).find('.event').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0 ||
624637
$(this).find('.speaker-name').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0) {
625638
var trackVal=$(this).find('.title-inline .blacktext').text();
626639
var roomVal=$(this).find('#location').text();
627-
if(trackFilterMode && trackVal!=trackName) {
640+
if(mode && local_storage_events[id]!=1){
641+
$(this).hide();
642+
}else if(trackFilterMode && trackVal!=trackName) {
628643
$(this).hide();
629644
}else if(roomFilterMode&&roomVal!=roomName){
630645
$(this).hide();
@@ -825,37 +840,65 @@
825840
826841
function display() {
827842
var temp = JSON.parse(localStorage[eventName]);
843+
var filterVal;
844+
$('.fossasia-filter').each(function () {
845+
if ($(this).is(':visible')) {
846+
filterVal = $(this).val();
847+
}
848+
});
828849
829850
$('.day-filter').each(function() {
830851
var dayFlag = 0;
831852
$(this).find('.time-filter').each(function() {
832853
var timeFlag = 0;
833854
$(this).find('.schedule-track').each(function() {
855+
var filter=1;
856+
if(trackFilterMode){
857+
var trackVal=$(this).find('.title-inline .blacktext').text();
858+
if(trackVal!=trackName){
859+
filter=0;
860+
}
861+
} else if(roomFilterMode){
862+
var roomVal=$(this).find('#location').text();
863+
if(roomVal!=roomName){
864+
filter=0;
865+
}
866+
}
834867
var elemId = $(this).attr('id');
835868
var elemFlag = 0;
836-
if(temp[elemId] == 1) {
837-
elemFlag = timeFlag = dayFlag = 1;
838-
$(this).find('.bookmark').each(function() {
839-
$(this).css("color", "black");
840-
});
869+
if ($(this).find('.tip-description').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0 ||
870+
$(this).find('.session-speakers-list a p span').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0 ||
871+
$(this).find('.session-speakers-more').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0 ||
872+
$(this).find('.event').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0 ||
873+
$(this).find('.speaker-name').text().toUpperCase().indexOf(filterVal.toUpperCase()) >= 0){
874+
if(temp[elemId] == 1 && filter) {
875+
elemFlag = 1;
876+
$(this).find('.bookmark').each(function() {
877+
$(this).css("color", "black");
878+
});
879+
}else if(!mode&&filter) {
880+
elemFlag=1;
881+
}
841882
}
842-
if (elemFlag || !mode) {
883+
if (elemFlag) {
884+
timeFlag=1;
843885
$(this).show();
844886
}
845887
else {
846888
$(this).hide();
847889
}
848890
});
849891
850-
if(timeFlag || !mode) {
892+
if(timeFlag) {
893+
dayFlag=1;
851894
$(this).show();
852895
}
853896
else {
854897
$(this).hide();
855898
}
856899
});
857900
858-
if(dayFlag || !mode) {
901+
if(dayFlag) {
859902
$(this).show();
860903
}
861904
else {

0 commit comments

Comments
 (0)