From 2bddf0dcd9337d3e7ee8cb5d773ba94e01bff244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 23 Nov 2020 22:48:18 +0100 Subject: Found out some inconvinient truths about the format. --- static/binders.js | 7 +++++-- static/rrule.js | 11 +++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'static') 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 + 12 + NOT as 1,2 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. elements are either + or , NOT a raw date. + */ get: () => this['_' + f], set: (v) => { this['_' + f] = v -- cgit v1.2.3