Skip to content

Commit

Permalink
Merge branch 'release/v22.1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-c committed Jan 7, 2022
2 parents 2e1a2e3 + 5de7fdb commit 9033112
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
7 changes: 4 additions & 3 deletions portal/config/eproms/Organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -1565,9 +1565,10 @@
},
{
"research_protocols": [
{"name": "IRONMAN v2", "retired_as_of": "2019-03-03T00:00:00Z"},
{"name": "IRONMAN v3", "retired_as_of": "2020-08-07T04:00:00Z"},
{"name": "IRONMAN v5"}
{"name": "IRONMAN v2", "retired_as_of": "2019-03-03T00:00:00Z"},
{"name": "IRONMAN v3", "retired_as_of": "2020-08-07T04:00:00Z"},
{"name": "IRONMAN v5"},
{"name": "EMPRO v1"}
],
"url": "http://us.truenth.org/identity-codes/research-protocol"
}
Expand Down
13 changes: 13 additions & 0 deletions portal/static/js/src/bootstrapTableExtensions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {dateSorter, alphanumericSorter} from "./modules/Utility.js";

/*
* global variables, can be used in custom sort in datatable, e.g. patient list
*/
var tnthTables = window.tnthTables = {
dateSorter : dateSorter,
alphanumericSorter: alphanumericSorter
};
/*
* function used by bootstrap datatable extension lib
*/
var alphanum = window.alphanum = alphanumericSorter;
9 changes: 9 additions & 0 deletions portal/static/js/src/modules/Utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,12 @@ export function convertArrayToObject (array, key) {
}, {});
return array;
}

export function dateSorter(a, b) {
return new Date(a) - new Date(b);
}
export function alphanumericSorter(a, b) {
return a.toString().localeCompare(b.toString(), "en", { numeric: true });
//The localeCompare() method returns 1 if a reference string comes before, -1 it comes after or 0 if the reference string is the same as the given string.
//see relevant discussion here, https://stackoverflow.com/questions/4340227/sort-mixed-alpha-numeric-array
}
2 changes: 1 addition & 1 deletion portal/templates/admin/admin_base.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{%- extends "layout.html" -%}
{% block additional_scripts %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.3/js/jasny-bootstrap.min.js"></script>
<script src="{{ url_for('static', filename='js/dist/bootstrapTableExtensions.bundle.js') }}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/extensions/export/bootstrap-table-export.min.js"></script>
<script src="https://cdn.rawgit.com/myadzel/6405e60256df579eda8c/raw/e24a756e168cb82d0798685fd3069a75f191783f/alphanum.js"></script>
<script src="https://cdn.jsdelivr.net/gh/hhurz/[email protected]/tableExport.js" async></script>
<script src="{{ url_for('static', filename='js/vendor/bootstrap_table_filter_control.js') }}"></script>
<script src="{{ url_for('static', filename='js/vendor/bootstrap_datatables_extension.js') }}"></script>
Expand Down
2 changes: 1 addition & 1 deletion portal/views/patch_flask_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def patch_forgot_password():

# Do NOT allow non registered to change password
non_registered_roles = set(current_app.config['PRE_REGISTERED_ROLES'])
current_roles = {r.name for r in user.roles}
current_roles = {r.name for r in user.roles} if user else set()
disjoint = current_roles.isdisjoint(non_registered_roles)

if disjoint and user:
Expand Down
1 change: 1 addition & 0 deletions portal/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
"account": JsSrcPath+"/accountCreation.js",
"admin": JsSrcPath+"/admin.js",
"assessmentReport": JsSrcPath+"/assessmentReport.js",
"bootstrapTableExtensions": JsSrcPath+"/bootstrapTableExtensions.js",
"CookieMonster": JsSrcPath+"/CookieMonster.js",
"coredata": JsSrcPath+"/coredata.js",
"initialQueries": JsSrcPath+"/initialQueries.js",
Expand Down

0 comments on commit 9033112

Please sign in to comment.