diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-11-23 22:48:18 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-11-23 22:48:18 +0100 |
commit | 2bddf0dcd9337d3e7ee8cb5d773ba94e01bff244 (patch) | |
tree | e1666db18a1229917719eb2cc471036c62a45baf | |
parent | JS Add date_time pseudo tag. (diff) | |
download | calp-2bddf0dcd9337d3e7ee8cb5d773ba94e01bff244.tar.gz calp-2bddf0dcd9337d3e7ee8cb5d773ba94e01bff244.tar.xz |
Found out some inconvinient truths about the format.
-rw-r--r-- | static/binders.js | 7 | ||||
-rw-r--r-- | static/rrule.js | 11 |
2 files changed, 16 insertions, 2 deletions
diff --git a/static/binders.js b/static/binders.js index b609058a..15275d28 100644 --- a/static/binders.js +++ b/static/binders.js @@ -10,17 +10,19 @@ function bind_recur(el, e) { let p = get_property(el, 'rrule'); // let rrule = el.rrule; + /* add listeners to bind-rr tags */ for (let rr of e.querySelectorAll('.bind-rr')) { if (rr.classList.contains('input-list')) { rr.addEventListener('input', function () { let name = rr.attributes.name.value; el.properties.rrule[name] = this.get_value(); }); - } else if (rr.tagName === 'input') { + } else if (rr.tagName === 'input' || rr.classList.contains('date-time')) { rr.addEventListener('input', function () { + console.log(this); el.properties.rrule[rr.name] = this.value; }); - } else if (rr.tagName === 'option') { + } else if (rr.tagName === 'select') { console.log("TODO"); } } @@ -35,6 +37,7 @@ function bind_recur(el, e) { break; case 'select': /* TODO */ + console.log("Implement me!"); break; default: if (input_field.classList.contains('date-time')) { diff --git a/static/rrule.js b/static/rrule.js index 8f3693a6..2f2120e3 100644 --- a/static/rrule.js +++ b/static/rrule.js @@ -19,6 +19,12 @@ class RRule { 'bymonthday', 'byyearday', 'byweekno', 'bymonth', 'bysetpos', 'wkst'] + /* + TODO multi valued byhour should be represented as + <byhour>1</byhour><byhour>2</byhour> + NOT as <byhour>1,2</byhour> as it currently does. + */ + constructor() { this.listeners = {} @@ -27,6 +33,11 @@ class RRule { this[f] = false; Object.defineProperty( this, f, { + /* + TODO many of the fields should be wrapped + in type tags. e.g. <until> elements are either + <date> or <date-time>, NOT a raw date. + */ get: () => this['_' + f], set: (v) => { this['_' + f] = v |