made url not contain part id when part view closed

pull/7/head
Marek Baczynski 2 years ago
parent b698ec446f
commit 51022e79bd

@ -215,8 +215,19 @@ function show_part_info(partID) {
});
// update URL and history
update_url(partID);
}
function update_url(partID){
params = {}
var query = $('.search-bar').val();
window.history.pushState('searching', '', 'parts?q=' + query + '&p=' + partID)
if(len(query)>0){
params['q'] = query
}
if(partID != 0){
params['p'] = partID
}
window.history.pushState('searching', '', 'parts?' + jQuery.param(params));
}
function perform_query() {
@ -250,8 +261,7 @@ function perform_query() {
console.log( "Query failed" );
});
// update URL and history
window.history.pushState('searching', '', 'parts?q=' + query)
update_url(0);
}
function container_onchange() {

@ -37,7 +37,7 @@
</tr>
</table>
<h3 id="no-results">No results.</h3>
<div class="shadow" onclick="overlay_out()"></div>
<div class="shadow" onclick="overlay_out();update_url();"></div>
<div class="overlay">
<h2>Part Details</h2>
<div id="info-container">
@ -73,7 +73,7 @@
</div>
</div>
<div>
<div class="small-square-button"><a href="#" onclick="overlay_out()"><i class="fa fa-times" aria-hidden="true"></i></a></div>
<div class="small-square-button"><a href="#" onclick="overlay_out();update_url(0);"><i class="fa fa-times" aria-hidden="true"></i></a></div>
</div>
</div>
<div class="round-floating-button"><a href="#" onclick="new_entry()"><i class="fa fa-plus" aria-hidden="true"></i></a></div>

Loading…
Cancel
Save