Finished fixing stuff

pull/3/head
assar 7 years ago
parent 18ec17347e
commit a976a4932f

@ -212,13 +212,13 @@ function perform_query() {
var notes = $('<div class="results-notes"></div>'); var notes = $('<div class="results-notes"></div>');
if (data[i].notes != null && data[i].notes.length > 0) { if (data[i].notes != null && data[i].notes.length > 0) {
var icon = $('<i class="fa fa-sticky-note"></i>'); var icon = $('<i class="fa fa-sticky-note"></i>');
var tooltipText = $('<div class="tooltiptext"></div>'); var tooltipText = $('<div class="tooltiptext"></div>').text(data[i].notes);
var tooltip = $('<div class="tooltip"></div>'); var tooltip = $('<div class="tooltip"></div>');
tooltip.append(icon, tooltipText); tooltip.append(icon, tooltipText);
notes.append(tooltip); notes.append(tooltip);
} }
newClicker.append(notes); newClicker.append(notes);
var datasheet = $('<div class="results-datashet"></div>'); var datasheet = $('<div class="results-datasheet"></div>');
if (data[i].datasheet != null) if (data[i].datasheet != null)
datasheet.html('<a href="https://www.elab.kth.se/parts/getfile/' datasheet.html('<a href="https://www.elab.kth.se/parts/getfile/'
+ data[i].datasheet.substring(0, data[i].datasheet.length - 4) + data[i].datasheet.substring(0, data[i].datasheet.length - 4)
@ -286,7 +286,13 @@ $(document).ready(function() {
$('.search-bar').on('keyup', function() { $('.search-bar').on('keyup', function() {
perform_query(); perform_query();
}); });
$('.toggle-btn').on('change', function() { $('.checkbox').change( function() {
perform_query(); if ( !$('#type').is(':checked')
&& !$('#partno').is(':checked')
&& !$('#description').is(':checked')
&& !$('#notes').is(':checked'))
$(this).prop('checked', true);
else
perform_query();
}); });
}); });

@ -21,10 +21,10 @@
<div class="filter-concontainertainer"> <div class="filter-concontainertainer">
<div class="filter-container"> <div class="filter-container">
<p>Search in:</p> <p>Search in:</p>
<input type="checkbox" id="type" checked></input><label class="toggle-btn" for="type">Manufacturer</label> <input type="checkbox" class="checkbox" id="type" checked></input><label class="toggle-btn" for="type">Manufacturer</label>
<input type="checkbox" id="partno" checked></input><label class="toggle-btn" for="partno">Part Number</label> <input type="checkbox" class="checkbox" id="partno" checked></input><label class="toggle-btn" for="partno">Part Number</label>
<input type="checkbox" id="description" checked></input><label class="toggle-btn" for="description">Description</label> <input type="checkbox" class="checkbox" id="description" checked></input><label class="toggle-btn" for="description">Description</label>
<input type="checkbox" id="notes" checked></input><label class="toggle-btn" for="notes">Notes</label> <input type="checkbox" class="checkbox" id="notes" checked></input><label class="toggle-btn" for="notes">Notes</label>
</div> </div>
</div> </div>
<div class="res-header-small">Block</div> <div class="res-header-small">Block</div>

Loading…
Cancel
Save