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

Remember the state of the disclosure triangles in Assets #11403

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion resources/views/hardware/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,37 @@ function user_add(status_id) {

});


{{-- TODO: Clean up some of the duplication in here. Not too high of a priority since we only copied it once. --}}
$("#optional_info").on("click",function(){
$('#optional_details').fadeToggle(100);
$('#optional_info_icon').toggleClass('fa-caret-right fa-caret-down');
var optional_info_open = $('#optional_info_icon').hasClass('fa-caret-down');
document.cookie = "optional_info_open="+optional_info_open+'; path=/';
});

$("#order_info").on("click",function(){
$('#order_details').fadeToggle(100);
$("#order_info_icon").toggleClass('fa-caret-right fa-caret-down');
var order_info_open = $('#order_info_icon').hasClass('fa-caret-down');
document.cookie = "order_info_open="+order_info_open+'; path=/';
});

var all_cookies = document.cookie.split(';')
for(var i in all_cookies) {
var trimmed_cookie = all_cookies[i].trim(' ')
if (trimmed_cookie.startsWith('optional_info_open=')) {
elems = all_cookies[i].split('=', 2)
if (elems[1] == 'true') {
$('#optional_info').trigger('click')
}
}
if (trimmed_cookie.startsWith('order_info_open=')) {
elems = all_cookies[i].split('=', 2)
if (elems[1] == 'true') {
$('#order_info').trigger('click')
}
}
}

});

Expand Down