Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix search tags, specs #157

Merged
merged 1 commit into from Aug 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 16 additions & 16 deletions themes/default/assets/js/main.js
Expand Up @@ -47,7 +47,7 @@ function filterSpecList(status) {
$(this).hide();
}
});
var specs = $(".spec-list a").filter(function(){return $(this).children().first().is(':visible');})
var specs = $(".spec-list a").filter(function() { return $(this).children().first().is(':visible'); })
filterSidebar(specs, $('#searchSpecifications').val().trim());
}

Expand All @@ -58,9 +58,9 @@ function showFirstSpecContent() {
}
}

function filterSidebar(specsCollection,searchText) {
function filterSidebar(specsCollection, searchText) {
if (!index) return;
tagMatches = index.tags[searchText];
tagMatches = index.Tags[searchText];
specsCollection.each(function() {
var relPath = $(this).attr('href').split("/");
var fileName = relPath[relPath.length - 1];
Expand Down Expand Up @@ -89,12 +89,12 @@ function resetSidebar() {
}

function openModal(e) {
$(this).next('.modal').css('display','block');
$(this).next('.modal').css('display', 'block');
$('body').addClass('is-modal-open');
}

function closeModal() {
$('.modal').css('display','none');
$('.modal').css('display', 'none');
$('body').removeClass('is-modal-open');
}

Expand All @@ -116,7 +116,7 @@ var initializers = {
if (sessionStorage.SearchText) {
$('#searchSpecifications').val(sessionStorage.SearchText);
var specs = $(".spec-list a");
filterSidebar(specs,sessionStorage.SearchText);
filterSidebar(specs, sessionStorage.SearchText);
}
},
"attachScenarioToggle": function() {
Expand All @@ -125,16 +125,16 @@ var initializers = {
$(this).addClass('selected');
var tr = $(this).data('rowindex');
$(".scenario-container").each(function() {
if (typeof $(this).data('tablerow') != 'undefined'){
if (typeof $(this).data('tablerow') != 'undefined') {
if ($(this).data('tablerow') === tr) { $(this).show(); } else { $(this).hide(); }
}else {
} else {
$(this).show();
}
});
$(".error-container").each(function() {
if (typeof $(this).data('tablerow') != 'undefined'){
if (typeof $(this).data('tablerow') != 'undefined') {
if ($(this).data('tablerow') === tr) { $(this).show(); } else { $(this).hide(); }
}else {
} else {
$(this).show();
}
});
Expand All @@ -159,16 +159,16 @@ var initializers = {
resetState();
resetSidebar();
sessionStorage.removeItem('FilterStatus');
var specs = $(".spec-list a").filter(function(){return $(this).children().first().is(':visible');})
var specs = $(".spec-list a").filter(function() { return $(this).children().first().is(':visible'); })
filterSidebar(specs, $('#searchSpecifications').val().trim());
showFirstSpecContent();
$(this).addClass('active');
});
},
"registerModals": function() {
"registerModals": function() {
$('.modal-link').click(openModal);
$(document).keydown(function(e) {
if(e.keyCode == 27) closeModal();
if (e.keyCode == 27) closeModal();
})
$('.close').click(closeModal)
},
Expand Down Expand Up @@ -215,8 +215,8 @@ var initializers = {
minChars: 1,
source: function(term, suggest) {
term = term.toLowerCase();
var tagChoices = Object.keys(index.tags);
var specChoices = Object.keys(index.specs);
var tagChoices = Object.keys(index.Tags);
var specChoices = Object.keys(index.Specs);
var suggestions = [];
var suggestionPredicate = function(type) {
return function(x) {
Expand Down Expand Up @@ -260,4 +260,4 @@ var initializers = {

$(function() {
$.each(initializers, function(k, v) { v(); });
});
});