|
|
|
@ -1291,6 +1291,28 @@ function get_day_events(date, prio) {
|
|
|
|
|
return days; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function get_day_events_m(date, prio) { |
|
|
|
|
let events = get_day_events(date, prio); |
|
|
|
|
let day_rows = []; |
|
|
|
|
if (events.length == 0) |
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
events.map(function(day_events) { |
|
|
|
|
if (day_events[1].length == 0) |
|
|
|
|
return; |
|
|
|
|
let body = ""; |
|
|
|
|
day_events[1].map(function(ev_txt) { |
|
|
|
|
body += ev_txt + "\n"; |
|
|
|
|
}); |
|
|
|
|
day_rows.push(m("tr", [ |
|
|
|
|
m("th", { style: "padding: 1px; font-size: 75%" }, day_events[0]), |
|
|
|
|
m("td", { class: "content is-small narrow-content" }, m.trust(marked(body, markedOptions))), |
|
|
|
|
])); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return m("table", day_rows); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function get_day_events_body(date, prio) { |
|
|
|
|
let events = get_day_events(date, prio); |
|
|
|
|
let body = ""; |
|
|
|
@ -2321,15 +2343,14 @@ class EntryView {
|
|
|
|
|
|
|
|
|
|
if (is_diary_entry) { |
|
|
|
|
before_calling_marked_with_entry(entry, ["events", diary_day, "upcoming_tasks"]); |
|
|
|
|
let body = get_day_events_body(diary_day, "upcoming_tasks"); |
|
|
|
|
if (body) { |
|
|
|
|
body = m.trust(marked(body, markedOptions)); |
|
|
|
|
let elem = get_day_events_m(diary_day, "upcoming_tasks"); |
|
|
|
|
if (elem) { |
|
|
|
|
card.push( |
|
|
|
|
m("div", { |
|
|
|
|
class: "card-content", |
|
|
|
|
entry_id: vn.attrs.entry_id, |
|
|
|
|
style: "padding: 0.1rem 0.5rem; border: 1px solid #FCC;" |
|
|
|
|
}, m("div", { class: "content" }, body))); |
|
|
|
|
}, elem)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -3243,43 +3264,45 @@ var TopLevel = {
|
|
|
|
|
let srchtxt = ev.target.value; |
|
|
|
|
vn.state.event_input_txt = srchtxt; |
|
|
|
|
} }), |
|
|
|
|
m("button", { class: "button is-primary", |
|
|
|
|
onclick: function(ev) { |
|
|
|
|
append_to_entry_by_tags( |
|
|
|
|
"events current specific-day", "- " + get_day_fmt(cur_date) |
|
|
|
|
+ ": - " + vn.state.event_input_txt + "\n"); |
|
|
|
|
vn.state.event_input_txt = ""; |
|
|
|
|
} }, |
|
|
|
|
"Add Task"), |
|
|
|
|
m("button", { class: "button is-primary", |
|
|
|
|
onclick: function(ev) { |
|
|
|
|
append_to_entry_by_tags( |
|
|
|
|
"events current specific-day", "- " + get_day_fmt(cur_date) |
|
|
|
|
+ ": - [ ] " + vn.state.event_input_txt + "\n"); |
|
|
|
|
vn.state.event_input_txt = ""; |
|
|
|
|
} }, |
|
|
|
|
"Add Important"), |
|
|
|
|
m("div", { class: "buttons" }, [ |
|
|
|
|
m("button", { class: "button is-primary is-small", |
|
|
|
|
onclick: function(ev) { |
|
|
|
|
append_to_entry_by_tags( |
|
|
|
|
"events current specific-day", "- " + get_day_fmt(cur_date) |
|
|
|
|
+ ": - " + vn.state.event_input_txt + "\n"); |
|
|
|
|
vn.state.event_input_txt = ""; |
|
|
|
|
} }, |
|
|
|
|
"Add Task"), |
|
|
|
|
m("button", { class: "button is-danger is-small", |
|
|
|
|
onclick: function(ev) { |
|
|
|
|
append_to_entry_by_tags( |
|
|
|
|
"events current specific-day", "- " + get_day_fmt(cur_date) |
|
|
|
|
+ ": - [ ] " + vn.state.event_input_txt + "\n"); |
|
|
|
|
vn.state.event_input_txt = ""; |
|
|
|
|
} }, |
|
|
|
|
"Add Important"), |
|
|
|
|
]), |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
let body = get_day_events_body(get_day_fmt(cur_date), "task_today"); |
|
|
|
|
let event_elem = null; |
|
|
|
|
if (body) { |
|
|
|
|
body = m.trust(marked(body, markedOptions)); |
|
|
|
|
cur_row.push(m("div", { class: "content column is-2" }, [ |
|
|
|
|
cur_row.push(m("div", { class: "content column is-3" }, [ |
|
|
|
|
m("h3", day_title), |
|
|
|
|
m("div", { |
|
|
|
|
style: "padding: 0.1rem 0.5rem; border: 1px solid #FCC;" |
|
|
|
|
}, m("div", { class: "content" }, body)), |
|
|
|
|
}, m("div", { class: "content narrow-content" }, body)), |
|
|
|
|
task_add, |
|
|
|
|
])); |
|
|
|
|
} else { |
|
|
|
|
cur_row.push(m("div", { class: "content column is-2" }, [ |
|
|
|
|
cur_row.push(m("div", { class: "content narrow-content column is-3" }, [ |
|
|
|
|
m("h3", day_title), |
|
|
|
|
task_add, |
|
|
|
|
])); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (cur_row.length >= 5) { |
|
|
|
|
if (cur_row.length >= 4) { |
|
|
|
|
layout_rows.push(cur_row); |
|
|
|
|
cur_row = []; |
|
|
|
|
} |
|
|
|
|