-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added date-offset UI elements to cohort builder. (#2880)
- Loading branch information
1 parent
fccb8dc
commit b789cd9
Showing
36 changed files
with
338 additions
and
34 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
define(['knockout'], function (ko) { | ||
var debug = false; | ||
function DateAdjustment(data) { | ||
var self = this; | ||
data = data || {}; | ||
|
||
self.StartWith = ko.observable(data.StartWith || DateAdjustment.START_DATE); | ||
self.StartOffset = ko.observable(data.StartOffset || 0); | ||
self.EndWith = ko.observable(data.EndWith || DateAdjustment.END_DATE); | ||
self.EndOffset = ko.observable(data.EndOffset || 0); | ||
} | ||
|
||
DateAdjustment.START_DATE = "START_DATE"; | ||
DateAdjustment.END_DATE = "END_DATE"; | ||
|
||
return DateAdjustment; | ||
}); |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
define(["knockout", "text!./DateAdjustmentTemplate.html", "../InputTypes/DateAdjustment"], function ( | ||
ko, | ||
componentTemplate, | ||
DateAdjustment | ||
) { | ||
function DateAdjustmentViewModel(params) { | ||
var self = this; | ||
self.DateAdjustment = params.DateAdjustment; | ||
self.dateOptions = [ | ||
{ | ||
id: DateAdjustment.START_DATE, | ||
name: ko.i18n('options.startDate', 'start date'), | ||
}, | ||
{ | ||
id: DateAdjustment.END_DATE, | ||
name: ko.i18n('options.endDate', 'end date'), | ||
} | ||
]; | ||
} | ||
|
||
// return compoonent definition | ||
return { | ||
viewModel: DateAdjustmentViewModel, | ||
template: componentTemplate, | ||
}; | ||
}); | ||
|
8 changes: 8 additions & 0 deletions
8
js/components/cohortbuilder/components/DateAdjustmentTemplate.html
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,8 @@ | ||
starting with <select | ||
data-bind="options: $component.dateOptions, optionsText: 'name', optionsValue: 'id', value: DateAdjustment().StartWith"></select> | ||
+ <input class="numericInputField" style="width:25px" | ||
data-bind="value: DateAdjustment().StartOffset.numeric(), autoGrowInput: {comfortZone: 8}"></input> days | ||
and ending with <select | ||
data-bind="options: $component.dateOptions, optionsText: 'name', optionsValue: 'id', value: DateAdjustment().EndWith"></select> | ||
+ <input class="numericInputField" style="width:25px" | ||
data-bind="value: DateAdjustment().EndOffset.numeric(), autoGrowInput: {comfortZone: 8}"></input> days |
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
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
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
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
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
Oops, something went wrong.