Merge pull request #328 from thusithak/master

responsive tab panel component - markup rewrite for uuf
revert-dabc3590
Rasika Perera 8 years ago committed by GitHub
commit 3c845dc3bd

@ -50,49 +50,61 @@ var InitiateViewOption = null;
); );
} }
$(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) { $(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) {
var activeTabPane = $(e.target).attr("href"), var activeTabPane = $(e.target).attr("href");
activeCollapsePane = $(activeTabPane).find("[data-toggle=collapse]").data("target"), var activeListGroupItem = $(".media .list-group-item.active");
activeCollapsePaneSiblings = $(activeTabPane).siblings().find("[data-toggle=collapse]").data("target"),
activeListGroupItem = $(".media .list-group-item.active");
$(activeCollapsePaneSiblings).collapse("hide"); $(activeTabPane).removeClass("visible-xs-block");
$(activeCollapsePane).collapse("show"); $(activeTabPane).siblings().not(".arrow-left").addClass("visible-xs-block");
positionArrow(activeListGroupItem); positionArrow(activeListGroupItem);
$(".panel-heading .caret-updown").removeClass("fw-sort-down");
$(".panel-heading.collapsed .caret-updown").addClass("fw-sort-up");
}); });
$(".media.tab-responsive .tab-content").on("shown.bs.collapse", function (e) { $(".media.tab-responsive .tab-content").on("shown.bs.collapse", function (e) {
var activeTabPane = $(e.target).parent().attr("id"); var thisParent = $(e.target).parent();
$(".media.tab-responsive [data-toggle=tab][href=#" + activeTabPane + "]").tab("show"); var activeTabPaneCaret = thisParent.find('.caret-updown');
$(".panel-heading .caret-updown").removeClass("fw-sort-up"); var activeTabPaneCaretSiblings = thisParent.siblings().find('.caret-updown');
$(".panel-heading.collapsed .caret-updown").addClass("fw-sort-down");
activeTabPaneCaret.removeClass("fw-up").addClass("fw-down");
activeTabPaneCaretSiblings.removeClass("fw-down").addClass("fw-up");
});
$('.media.tab-responsive a[data-toggle="collapse"]').on('click',function(){
var clickedPanel = $(this).attr('href');
if($(clickedPanel).hasClass('in')){
$(clickedPanel).collapse('hide');
}else{
$(clickedPanel).collapse('show');
}
}); });
function positionArrow(selectedTab) { function positionArrow(selectedTab) {
var selectedTabHeight = $(selectedTab).outerHeight(); var selectedTabHeight = $(selectedTab).innerHeight();
var arrowPosition = 0; var arrowPosition = 0;
var totalHeight = 0; var totalHeight = 0;
var arrow = $(".media .panel-group.tab-content .arrow-left"); var arrow = $(".media .panel-group.tab-content .arrow-left");
var parentHeight = $(arrow).parent().outerHeight(); var parentHeight = $(arrow).parent().innerHeight();
// if($(selectedTab).prev().length){
// $(selectedTab).prevAll().each(function() { if($(selectedTab).prev().length){
// totalHeight += $(this).outerHeight(); $(selectedTab).prevAll().each(function() {
// }); totalHeight += $(this).innerHeight();
// arrowPosition = totalHeight + (selectedTabHeight / 2); });
// }else{ arrowPosition = totalHeight + (selectedTabHeight / 2);
// arrowPosition = selectedTabHeight / 2; }else{
// } arrowPosition = selectedTabHeight / 2;
}
if(arrowPosition >= parentHeight){ if(arrowPosition >= parentHeight){
parentHeight = arrowPosition + 10; parentHeight = arrowPosition + 50;
$(arrow).parent().height(parentHeight); $(arrow).siblings(".panel.active").height(parentHeight);
}else{ }else{
$(arrow).parent().removeAttr("style"); $(arrow).parent().removeAttr("style");
} }
$(arrow).css("top", arrowPosition - 10); $(arrow).css("top", arrowPosition - 10);
} }
@ -228,8 +240,8 @@ var InitiateViewOption = null;
$("#applications-list-container").html(content); $("#applications-list-container").html(content);
} else { } else {
$("#applications-list-container"). $("#applications-list-container").
html("<div class='panel-body'><br><p class='fw-warning'>&nbsp;No applications found. " + html("<div class='message message-info'><h4><i class='icon fw fw-info'></i>No applications found.</h4>" +
"please try refreshing the list in a while.<p></div>"); "<p>Please try refreshing the list in a while.</p></div>");
} }
} }
}, },
@ -315,4 +327,5 @@ var InitiateViewOption = null;
} }
); );
} }
}()); }());

Loading…
Cancel
Save