Skip to content

Commit

Permalink
Merge pull request #394 from CCALI/393-date-bounds-type-restrict
Browse files Browse the repository at this point in the history
393 date bounds type restrict
  • Loading branch information
tobiasnteireho authored Feb 26, 2024
2 parents df546f6 + aa12553 commit 8c5c216
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 22 deletions.
2 changes: 1 addition & 1 deletion index.dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
window.less = {async: true, fileSync: true};
</script>

<script src=node_modules/steal/steal.production.js?v=1707415201645" cache-key="v" cache-version="1707415201645" main="a2jauthor/app"></script>
<script src=node_modules/steal/steal.production.js?v=1708953946048" cache-key="v" cache-version="1708953946048" main="a2jauthor/app"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
window.less = {async: true, fileSync: true};
</script>

<script src=node_modules/steal/steal.production.js?v=1707416030358" cache-key="v" cache-version="1707416030358" main="a2jauthor/app"></script>
<script src=node_modules/steal/steal.production.js?v=1708984455616" cache-key="v" cache-version="1708984455616" main="a2jauthor/app"></script>
</body>
</html>
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "a2jauthor",
"version": "10.2.0-0",
"version": "10.2.0-2",
"description": "A2J Authoring App GUI.",
"license": "GNU AGPL v3.0",
"author": {
Expand All @@ -24,7 +24,7 @@
},
"dependencies": {
"@caliorg/a2jdeps": "^7.1.7",
"@caliorg/a2jviewer": "^8.2.0-1",
"@caliorg/a2jviewer": "^8.2.0-10",
"bit-tabs": "^2.0.0",
"blueimp-file-upload": "^9.10.1",
"bootstrap": "^3.4.1",
Expand Down
4 changes: 2 additions & 2 deletions src/footer/footerVersion.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

const version = {
number: '10.2.0-0',
date: '2024-02-08'
number: '10.2.0-2',
date: '2024-02-26'
}

export default version
47 changes: 47 additions & 0 deletions src/pages-tab/components/page-fields/page-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,53 @@ export const PageFieldsVM = DefineMap.extend('PageFieldsVM', {
return el.value
},

setBound(el){
},

checktoToday(el){
return el.checked ? "TODAY": ""
},

parseDateBound(boundedDate){
let textDate = "" // assume unfilled


if (boundedDate){

if (boundedDate !== "TODAY"){
textDate =
boundedDate.substr(4) + '-' +
boundedDate.substr(0, 2) + '-' +
boundedDate.substr(2,2)
}

}

return textDate

},

toggleDateBoundEnable(el){
$(el).prop('disabled', !$(el).prop('disabled'))
},

mangleDateBound(el){

let str = el.value.split(',').join('')
str = str.split('-').join('')
console.log("JAWN: " + str)

str =
str.substr(4,2) + '/' +
str.substr(6, 2) + '/' +
str.substr(0,4)

str = str.match(new RegExp(el.pattern || '.', 'g')).join('')

return str

},

applyPattern (el) {
el.value = el.value.match(new RegExp(el.pattern || '.', 'g')).join('')
return el.value
Expand Down
45 changes: 38 additions & 7 deletions src/pages-tab/components/page-fields/page-fields.stache
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,51 @@
</div>
{{#if(field.canMinMax)}}
<div class="editspan form-group" name="min">

<label class="control-label">Min Value:</label>
<input class="form-control ui-widget editable" type="text" placeholder="min"
value:bind="field.field.min"
<input class="form-control ui-widget editable"
type="date" placeholder="min"
id="min-date"
pattern="TODAY|(?:^-(?=.*\d))|\d*"
on:blur="field.field.min = applyPattern(scope.element)"
value="{{parseDateBound(field.field.min)}}"
on:blur="field.field.min = mangleDateBound(scope.element)"
{{ #eq(field.field.min, "TODAY")}} disabled {{/eq}}
>

<div name="today-min" class="{{^if(field.canRequire)}}hidden{{/if}}">
<div class="checkbox">
<label>
<input type="checkbox"
{{ #eq(field.field.min, "TODAY")}} checked {{/eq}}
on:blur="field.field.min = checktoToday(scope.element)"
on:click="toggleDateBoundEnable('#min-date')"
value:bind="field.field.min"
value="TODAY"> TODAY
</label>
</div>
</div>
</div>
<div class="editspan form-group" name="max">
<div>
<label class="control-label">Max Value:</label>
<input class="form-control ui-widget editable" type="text" placeholder="max"
value:bind="field.field.max"
<input class="form-control ui-widget editable"
type="date" placeholder="max"
id="max-date"
value="{{parseDateBound(field.field.max)}}"
pattern="TODAY|(?:^-(?=.*\d))|\d*"
on:blur="field.field.max = applyPattern(scope.element)"
{{ #eq(field.field.max, "TODAY")}} disabled {{/eq}}
on:blur="field.field.max = mangleDateBound(scope.element)"
>
<div name="today-max" class="{{^if(field.canRequire)}}hidden{{/if}}">
<div class="checkbox">
<label>
<input type="checkbox"
{{ #eq(field.field.max, "TODAY")}} checked {{/eq}}
on:blur="field.field.max = TODAY"
on:click="toggleDateBoundEnable('#max-date')"
value="TODAY"> TODAY
</label>
</div>
</div>
</div>
{{/if}}
{{#if(field.canList)}}
Expand Down

0 comments on commit 8c5c216

Please sign in to comment.