1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-06-28 20:37:46 +02:00

fix scrolling on modals spawned by settings modal, fix getUsers cache

closing the settings modal to immediately open another caused the
'modal-open' class on the body to get deleted, which meant scrolling
stopped working inside them. Also fix mistake added to jfapi in last commit.
This commit is contained in:
Harvey Tindall 2020-09-16 17:36:14 +01:00
parent 410c35c844
commit 802f957d22
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
2 changed files with 25 additions and 5 deletions

View File

@ -136,6 +136,10 @@
.settingIcon {
margin-left: 0.2rem;
}
body.modal-open {
overflow: hidden;
}
</style>
<title>Admin</title>
</head>
@ -404,10 +408,23 @@
<script>
{{ if .bs5 }}
function createModal(id, find = false) {
let modal;
if (find) {
return bootstrap.Modal.getInstance(document.getElementById(id));
modal = bootstrap.Modal.getInstance(document.getElementById(id));
} else {
modal = new bootstrap.Modal(document.getElementById(id));
}
return new bootstrap.Modal(document.getElementById(id));
document.getElementById(id).addEventListener('shown.bs.modal', function () {
document.body.classList.add("modal-open");
});
return {
modal: modal,
show: function() {
let temp = this.modal.show();
return temp
},
hide: function() { return this.modal.hide(); }
};
}
{{ else }}
let send_to_addess_enabled = document.getElementById('send_to_address_enabled');
@ -419,9 +436,13 @@
multiUseEnabled.classList.remove('form-check-input');
}
function createModal(id, find = false) {
$('#' + id).on('shown.bs.modal', function () {
document.body.classList.add("modal-open");
});
return {
show: function() {
return $('#' + id).modal('show');
let temp = $('#' + id).modal('show');
return temp
},
hide: function() {
return $('#' + id).modal('hide');

View File

@ -224,7 +224,6 @@ func (jf *Jellyfin) getUsers(public bool) ([]map[string]interface{}, int, error)
if public {
url := fmt.Sprintf("%s/users/public", jf.server)
data, status, err = jf._get(url, nil)
} else {
url := fmt.Sprintf("%s/users", jf.server)
data, status, err = jf._get(url, jf.loginParams)
@ -237,7 +236,7 @@ func (jf *Jellyfin) getUsers(public bool) ([]map[string]interface{}, int, error)
jf.cacheExpiry = time.Now().Add(time.Minute * time.Duration(jf.cacheLength))
return result, status, nil
}
return jf.userCache, status, nil
return jf.userCache, 200, nil
}
func (jf *Jellyfin) userByName(username string, public bool) (map[string]interface{}, int, error) {