-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First-pass interactive record requesting UI
- Loading branch information
1 parent
0f55923
commit d34caef
Showing
4 changed files
with
129 additions
and
30 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
grails-app/assets/javascripts/requestAssessmentRecordsModel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//= require knockout/3.4.0/knockout-3.4.0.js | ||
//= require knockout/3.4.0/knockout-3.4.0.debug.js | ||
|
||
var RequestAssessmentRecordsModel = function(filterGroupMapping){ | ||
const self = this; | ||
this.filters = Object.keys(filterGroupMapping); | ||
this.selected = ko.observableArray([]); | ||
this.deIdentify = ko.observable(false); | ||
this.isLoading = ko.observable(false); | ||
|
||
this.isFilterSelected = function(filter) { | ||
return self.selected.indexOf(filter) > -1; | ||
} | ||
|
||
this.onFilterSelect = function(filter) { | ||
// Only allow for user interaction if we're not already loading a request | ||
if (!self.isLoading()) { | ||
if (self.isFilterSelected(filter)) { | ||
self.selected.remove(filter); | ||
} else { | ||
self.selected.push(filter); | ||
} | ||
} | ||
} | ||
|
||
this.onRequestRecords = function() { | ||
// Update the loading flag | ||
self.isLoading(true); | ||
|
||
const selectedGroups = self.selected().map((filter) => filterGroupMapping[filter]); | ||
const unique = Array.from(new Set(selectedGroups)) | ||
|
||
console.log(unique, self.deIdentify()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
|
||
.ref-assess-filters-list { | ||
max-height: 200px; | ||
overflow-y: scroll; | ||
} | ||
|
||
.ref-assess-filters-list > div { | ||
cursor: pointer; | ||
} | ||
|
||
.ref-assess-filters-list > div.disabled { | ||
cursor: default; | ||
} | ||
|
||
.ref-assess-identify-text { | ||
font-family: 'Lato', sans-serif; | ||
font-size: 18px; | ||
} | ||
|
||
.ref-assess-identify-card { | ||
transition: all cubic-bezier(0, 0, 0.15, 1) 250ms; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters