From 0b7a5769bb7d3e9aa0da28d33db618bb7da2b90b Mon Sep 17 00:00:00 2001 From: Chris Hallberg <crhallberg@gmail.com> Date: Wed, 4 Dec 2013 13:56:26 -0500 Subject: [PATCH] OR facet indicators for non-JS users. --- themes/bootstrap/css/screen.css | 3 ++- themes/bootstrap/js/common.js | 11 ++--------- themes/bootstrap/templates/Recommend/SideFacets.phtml | 9 ++++++++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/themes/bootstrap/css/screen.css b/themes/bootstrap/css/screen.css index b620271f015..1711879d01b 100644 --- a/themes/bootstrap/css/screen.css +++ b/themes/bootstrap/css/screen.css @@ -22,7 +22,8 @@ li a.hidden {display:none} .sidebar .checkbox { margin-left:10px } .sidebar .nav-list li:not(.divider) { min-height:26px } .sidebar .nav-list li span.main { display:inline-block;padding:3px 0 } -.sidebar .nav-list li input[type="checkbox"] { float:left;margin:4px 3px 0 0} +.sidebar .nav-list li input[type="checkbox"] { float:left;margin:4px 3px 0 0 } +.sidebar .nav-list li.applied input[type="checkbox"] { margin-top:7px } .sidebar .nav-list li .icon-ok { margin-top:3px } .sidebar .nav-list li .icon-remove { margin-left:3px } .sidebar .small { color:#333;margin-top:9px;line-height:85% } diff --git a/themes/bootstrap/js/common.js b/themes/bootstrap/js/common.js index fd14c0b5119..ffd74660ee7 100644 --- a/themes/bootstrap/js/common.js +++ b/themes/bootstrap/js/common.js @@ -56,15 +56,8 @@ function updateOrFacets(url, op) { list.html(header[0].outerHTML+'<div class="alert alert-info">'+vufindString.loading+'...</div>'); } function setupOrFacets() { - var facets = $('.facetOR'); - for(var i=0;i<facets.length;i++) { - var $facet = $(facets[i]); - if($facet.hasClass('applied')) { - $facet.find('span:not(.pull-right)').prepend('<input type="checkbox" checked onChange="updateOrFacets($(this).parent().parent().attr(\'href\'), this)"/>'); - } else { - $facet.find('a.main').prepend('<input type="checkbox" onChange="updateOrFacets($(this).parent().attr(\'href\'), this)"/> '); - } - } + $('.facetOR').find('.icon-check').replaceWith('<input type="checkbox" checked onChange="updateOrFacets($(this).parent().parent().attr(\'href\'), this)"/>'); + $('.facetOR').find('.icon-check-empty').replaceWith('<input type="checkbox" onChange="updateOrFacets($(this).parent().attr(\'href\'), this)"/> '); } $(document).ready(function() { diff --git a/themes/bootstrap/templates/Recommend/SideFacets.phtml b/themes/bootstrap/templates/Recommend/SideFacets.phtml index 56eef7df2d9..876453cd841 100644 --- a/themes/bootstrap/templates/Recommend/SideFacets.phtml +++ b/themes/bootstrap/templates/Recommend/SideFacets.phtml @@ -109,7 +109,11 @@ JS; <? endif; ?> <? if ($thisFacet['isApplied']): ?> <li class="<? if ($i>5): ?><?=$moreClass ?><?endif ?><? if ($thisFacet['operator'] == 'OR'): ?> facetOR applied" href="<?=$this->currentPath().$results->getUrlQuery()->removeFacet($title, $thisFacet['value'], true, $thisFacet['operator']) ?><? endif ?>"> - <i class="icon-ok pull-right"></i> + <? if($thisFacet['operator'] == 'OR'): ?> + <i class="icon-check"></i> + <? else: ?> + <i class="icon-ok pull-right"></i> + <? endif; ?> <span class="main"><?=$this->escapeHtml($thisFacet['displayText'])?></span> </li> <? else: ?> @@ -122,6 +126,9 @@ JS; <? endif; ?> </span> <a class="main" href="<?=$this->currentPath().$results->getUrlQuery()->addFacet($title, $thisFacet['value'], $thisFacet['operator'])?>"> + <? if($thisFacet['operator'] == 'OR'): ?> + <i class="icon-check-empty"></i> + <? endif; ?> <?=$this->escapeHtml($thisFacet['displayText'])?> </a> </li> -- GitLab