Merge pull request 'clear-partid-when-closing-part-vuew' (#7) from clear-partid-when-closing-part-vuew into master

Reviewed-on: #7
fix-creating-users
marek 2 years ago
commit cd224a685b

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

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