diff options
Diffstat (limited to 'uploader/static/js')
| -rw-r--r-- | uploader/static/js/populations.js | 17 | ||||
| -rw-r--r-- | uploader/static/js/pubmed.js | 2 | ||||
| -rw-r--r-- | uploader/static/js/species.js | 16 | ||||
| -rw-r--r-- | uploader/static/js/upload_samples.js | 24 | ||||
| -rw-r--r-- | uploader/static/js/urls.js | 26 |
5 files changed, 70 insertions, 15 deletions
diff --git a/uploader/static/js/populations.js b/uploader/static/js/populations.js index be1231f..111ebb7 100644 --- a/uploader/static/js/populations.js +++ b/uploader/static/js/populations.js @@ -13,9 +13,24 @@ $(() => { } }, { + searchable: true, data: (apopulation) => { return `${apopulation.FullName} (${apopulation.InbredSetName})`; } } - ]); + ], + { + select: "single", + paging: true, + scrollY: 500, + deferRender: true, + scroller: true, + scrollCollapse: true, + layout: { + topStart: "info", + topEnd: "search", + bottomStart: "pageLength", + bottomEnd: false + } + }); }); diff --git a/uploader/static/js/pubmed.js b/uploader/static/js/pubmed.js index 9afd4c3..f425f49 100644 --- a/uploader/static/js/pubmed.js +++ b/uploader/static/js/pubmed.js @@ -22,7 +22,7 @@ var extract_details = (pubmed_id, details) => { "journal": details[pubmed_id].fulljournalname, "volume": details[pubmed_id].volume, "pages": details[pubmed_id].pages, - "month": _date.length > 1 ? months[_date[1].toLowerCase()] : "jan", + "month": _date.length > 1 ? (months[_date[1].toLowerCase()] || "January") : "January", "year": _date[0], }; }; diff --git a/uploader/static/js/species.js b/uploader/static/js/species.js index 9ea3017..fb0d2d2 100644 --- a/uploader/static/js/species.js +++ b/uploader/static/js/species.js @@ -16,5 +16,19 @@ $(() => { return `${aspecies.FullName} (${aspecies.SpeciesName})`; } } - ]); + ], + { + select: "single", + paging: true, + scrollY: 500, + deferRender: true, + scroller: true, + scrollCollapse: true, + layout: { + topStart: "info", + topEnd: "search", + bottomStart: "pageLength", + bottomEnd: false + } + }); }); diff --git a/uploader/static/js/upload_samples.js b/uploader/static/js/upload_samples.js index aed536f..1c25a1d 100644 --- a/uploader/static/js/upload_samples.js +++ b/uploader/static/js/upload_samples.js @@ -87,20 +87,20 @@ function display_preview(event) { var data_preview_table = document.getElementById("tbl:samples-preview"); remove_rows(data_preview_table); - var separator = document.getElementById("select:separator").value; + var separator = document.getElementById("select-separator").value; if(separator === "other") { - separator = document.getElementById("txt:separator").value; + separator = document.getElementById("txt-separator").value; } if(separator == "") { display_error_row(data_preview_table, "Please provide a separator."); return false; } - var delimiter = document.getElementById("txt:delimiter").value; + var delimiter = document.getElementById("txt-delimiter").value; - var firstlineheading = document.getElementById("chk:heading").checked; + var firstlineheading = document.getElementById("chk-heading").checked; - var fileelement = document.getElementById("file:samples"); + var fileelement = document.getElementById("file-samples"); var preview_data = JSON.parse( fileelement.getAttribute("data-preview-content") || "[]"); if(preview_data.length == 0) { @@ -115,18 +115,18 @@ function display_preview(event) { delimiter)); } -document.getElementById("chk:heading").addEventListener( +document.getElementById("chk-heading").addEventListener( "change", display_preview); -document.getElementById("select:separator").addEventListener( +document.getElementById("select-separator").addEventListener( "change", display_preview); -document.getElementById("txt:separator").addEventListener( +document.getElementById("txt-separator").addEventListener( "keyup", display_preview); -document.getElementById("txt:delimiter").addEventListener( +document.getElementById("txt-delimiter").addEventListener( "keyup", display_preview); -document.getElementById("file:samples").addEventListener( +document.getElementById("file-samples").addEventListener( "change", (event) => { read_first_n_lines(event, - document.getElementById("file:samples"), + document.getElementById("file-samples"), 30, - document.getElementById("chk:heading").checked); + document.getElementById("chk-heading").checked); }); diff --git a/uploader/static/js/urls.js b/uploader/static/js/urls.js new file mode 100644 index 0000000..e3fb7c6 --- /dev/null +++ b/uploader/static/js/urls.js @@ -0,0 +1,26 @@ +function baseURL() { + return new URL(`${window.location.protocol}//${window.location.host}`); +}; + +function buildURLFromCurrentURL(pathname, searchParams = new URLSearchParams()) { + var uri = baseURL(); + uri.pathname=pathname; + var _search = new URLSearchParams(window.location.search); + searchParams.forEach(function(value, key) { + _search.set(key, value); + }); + uri.search = _search.toString(); + return uri +}; + +function deleteSearchParams(url, listOfParams = []) { + _params = new URLSearchParams(url.search); + listOfParams.forEach(function(paramName) { + _params.delete(paramName); + }); + + + newUrl = new URL(url.toString()); + newUrl.search = _params.toString(); + return newUrl; +} |
