forked from ITwrxOrg/Forget-Me-Not
initial commit
This commit is contained in:
14
templates/error403.nimf
Normal file
14
templates/error403.nimf
Normal file
@@ -0,0 +1,14 @@
|
||||
#? stdtmpl(subsChar = '$', metaChar = '#')
|
||||
#import "main_template_top.nimf", "main_template_bottom.nimf"
|
||||
#proc error403Template*(mode: string, csrfToken: string): string =
|
||||
# result = ""
|
||||
${mainTemplateTop("Error! Status Code: 403", "", mode, csrfToken)}
|
||||
<div class="pjax-me">
|
||||
<h1 class="mt-8 text-xl text-red-500">Error! Status Code: 403</h1><br>
|
||||
<p>You are not authorized for the resource your browser requested.<br><br> If you feel this is in error please report to web your host.<br><br> Thanks!</p>
|
||||
</div>
|
||||
${mainTemplateBottom(mode)}
|
||||
<div class="page-js"></div>
|
||||
</body>
|
||||
</html>
|
||||
#end proc
|
||||
14
templates/error404.nimf
Normal file
14
templates/error404.nimf
Normal file
@@ -0,0 +1,14 @@
|
||||
#? stdtmpl(subsChar = '$', metaChar = '#')
|
||||
#import "main_template_top.nimf", "main_template_bottom.nimf"
|
||||
#proc error404Template*(csrfToken: string): string =
|
||||
# result = ""
|
||||
${mainTemplateTop("Error! Status Code: 404", csrfToken)}
|
||||
<div class="pjax-me">
|
||||
<h1 class="mt-8 text-xl text-red-500">Error! Status Code: 404</h1><br>
|
||||
<p>The page or resource requested does not exist.<br><br> Please try again, or report to site admin.<br><br> Thanks!</p>
|
||||
</div>
|
||||
${mainTemplateBottom()}
|
||||
<div class="page-js"></div>
|
||||
</body>
|
||||
</html>
|
||||
#end proc
|
||||
17
templates/error500.nimf
Normal file
17
templates/error500.nimf
Normal file
@@ -0,0 +1,17 @@
|
||||
#? stdtmpl(subsChar = '$', metaChar = '#')
|
||||
#import "main_template_top.nimf", "main_template_bottom.nimf", "../helpers/form"
|
||||
#proc error500Template*(csrfToken: string, fr: FormResult): string =
|
||||
# result = ""
|
||||
${mainTemplateTop("Error! Status Code: 500", csrfToken)}
|
||||
<div class="pjax-me">
|
||||
<h1 class="mt-8 text-xl text-red-500">Error! Status Code: 500</h1><br>
|
||||
#if fr.message.len > 0:
|
||||
<h2 id="form_message" class="${fr.messageClass}">Application Error Message: ${fr.message}</h2>
|
||||
#end if
|
||||
<p>If you're seeing this, unfortunately, you've found a bug.<br><br> Please report that you received a "500 page", including any Application Error Message above, to your web host.<br><br> Thank You!</p>
|
||||
</div>
|
||||
${mainTemplateBottom()}
|
||||
<div class="page-js"></div>
|
||||
</body>
|
||||
</html>
|
||||
#end proc
|
||||
45
templates/login.nimf
Normal file
45
templates/login.nimf
Normal file
@@ -0,0 +1,45 @@
|
||||
#? stdtmpl(subsChar = '$', metaChar = '#')
|
||||
#import "../helpers/global", "../helpers/form"
|
||||
#import "main_template_top.nimf", "main_template_bottom.nimf"
|
||||
#proc loginTemplate*(csrfToken: string, fr: FormResult): string =
|
||||
# result = ""
|
||||
${mainTemplateTop("Log In", csrfToken)}
|
||||
<div class="pjax-me">
|
||||
<div class="flex flex-row">
|
||||
<div class="basis-1/5"> </div>
|
||||
<div class="basis-3/5">
|
||||
<h1 class="mt-4 text-2xl">Log In</h1>
|
||||
#if fr.message.len > 0:
|
||||
<h2 id="form_message" class="${fr.messageClass}">${fr.message}</h2>
|
||||
#end if
|
||||
<form method="POST" action="${APP_URL}/login" accept-charset="utf-8" class="ml-8">
|
||||
<input type="hidden" name="csrf_token" value="${csrfToken}">
|
||||
<span class="text-2xl text-red-500">*</span><label for="email" class="inline-block mt-8">Email Address:</label>
|
||||
#if fErrorMsg(fr, "email").len > 0:
|
||||
<span class="text-red-500">${fErrorMsg(fr, "email")}</span>
|
||||
#end if
|
||||
<br>
|
||||
<input type="email" name="email" id="email" class="lg:w-2/5 bg-slate-400 text-slate-950" value="${fOldInput(fr, "email")}" required><br>
|
||||
<span class="text-2xl text-red-500">*</span><label for="password" class="inline-block mt-8">Password:</label>
|
||||
#if fErrorMsg(fr, "password").len > 0:
|
||||
<span class="text-red-500">${fErrorMsg(fr, "password")}</span>
|
||||
#end if
|
||||
<br>
|
||||
<input type="password" name="password" id="password" class="lg:w-2/5 bg-slate-400 text-slate-950 focus:ring-yellow-300" required><br>
|
||||
<br>
|
||||
<br>
|
||||
<div class="lg:flex lg:flex-row">
|
||||
<div class="lg:basis-2/3"></div>
|
||||
<div class="lg:basis-1/3">
|
||||
<button class="mt-4 p-1 font-semibold rounded-lg shadow-md text-white hover:text-white bg-green-800 hover:bg-green-700" type="submit">Login</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="basis-1/5"> </div>
|
||||
</div>
|
||||
</div>
|
||||
${mainTemplateBottom()}
|
||||
##leave this even when empty.
|
||||
<div class="page-js"></div>
|
||||
#end proc
|
||||
35
templates/main_template_bottom.nimf
Normal file
35
templates/main_template_bottom.nimf
Normal file
@@ -0,0 +1,35 @@
|
||||
#? stdtmpl(subsChar = '$', metaChar = '#')
|
||||
#import "../helpers/global"
|
||||
#proc mainTemplateBottom*(): string =
|
||||
# result = ""
|
||||
</main>
|
||||
<footer class="py-8 lg:mt-12">
|
||||
<div class="lg:flex lg:flex-row">
|
||||
<div class="lg:basis-1/3">
|
||||
<div class="p-4 lg:py-2 lg:ml-4">
|
||||
</div>
|
||||
</div>
|
||||
<div class="lg:basis-1/3">
|
||||
</div>
|
||||
<div class="lg:basis-1/3">
|
||||
|
||||
<div class="p-2 lg:ml-44">
|
||||
<span>Built & Hosted by: </span>
|
||||
<a href="https://itwrx.org" target="_blank" rel="nofollow" class="ITwrx_link"><img src="${ASSETS_URL}/img/itwrx_logo.png" alt="ITwrx.org logo" width="50" height="50" class="inline -mt-3"></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<!-- close the middle flex div. -->
|
||||
</div>
|
||||
<div class="lg:basis-1/12"></div>
|
||||
<!-- close the flex-row -->
|
||||
</div>
|
||||
<div class="page-js">
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
#end proc
|
||||
32
templates/main_template_top.nimf
Normal file
32
templates/main_template_top.nimf
Normal file
@@ -0,0 +1,32 @@
|
||||
#? stdtmpl(subsChar = '$', metaChar = '#')
|
||||
#import "../helpers/global", "../models/reminder", "../helpers/auth"
|
||||
#proc mainTemplateTop*(title, csrfToken: string): string =
|
||||
#let sections = getAllReminders()
|
||||
# result = ""
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="min-h-full">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>${title}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" >
|
||||
<link rel="shortcut icon apple-touch-icon-precomposed" href="${ASSETS_URL}/img/touch-icon.png">
|
||||
<link href="${ASSETS_URL}/css/fmn.css" rel="stylesheet">
|
||||
</head>
|
||||
<body class="main-bg min-h-full">
|
||||
<div class="flex flex-row min-h-screen">
|
||||
<div class="lg:basis-1/12"></div>
|
||||
<div class="lg:basis-10/12 lg:flex lg:flex-col lg:max-w-[1600px]">
|
||||
<header class="p-4">
|
||||
<div class="lg:flex lg:flex-row">
|
||||
<div class="lg:hidden home-link">
|
||||
<a href="/" title="Click to go home" class="text-3xl text-indigo-300"><img src="${ASSETS_URL}/img/fmn_logo_125x117.png" alt="Forget-Me-Not logo." class="inline" width="125" height="117" />Forget-Me-Not</a>
|
||||
</div>
|
||||
<div class="hidden lg:block lg:basis-2/4 home-link">
|
||||
<div class="mt-4 lg:mt-0">
|
||||
<a href="/" title="Click to go home" class="text-3xl text-indigo-300"><img src="${ASSETS_URL}/img/fmn_logo_125x117.png" alt="Forget-Me-Not logo." class="inline" width="125" height="117" />Forget-Me-Not</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<main class="flex-1 py-8 px-12 pjax-me">
|
||||
#end proc
|
||||
351
templates/reminder_create.nimf
Normal file
351
templates/reminder_create.nimf
Normal file
@@ -0,0 +1,351 @@
|
||||
#? stdtmpl(subsChar = '$', metaChar = '#')
|
||||
#import "../helpers/global", "../helpers/form", "../helpers/auth", "../models/reminder"
|
||||
#import "main_template_top.nimf", "main_template_bottom.nimf"
|
||||
#proc reminderCreateTemplate*(csrfToken: string, fr: FormResult): string =
|
||||
#let pageTitle = "Create a Reminder"
|
||||
# result = ""
|
||||
${mainTemplateTop(pageTitle, csrfToken)}
|
||||
<h1 class="text-xl">${pageTitle}</h1>
|
||||
#if fr.message.len > 0:
|
||||
<h2 id="form_message" class="${fr.messageClass}">${fr.message}</h2>
|
||||
#end if
|
||||
<form id="reminder-create" method="POST" action="${APP_URL}/reminder/create" accept-charset="utf-8">
|
||||
<input type="hidden" name="csrf_token" value="${csrfToken}" form="reminder-create"/>
|
||||
<label>${fErrorMsg(fr, "title")}
|
||||
<span class="text-2xl text-red-500">*</span><span class="help-text" title="This will be used to generate your reminder's url and meta-title and is very important for SEO, so it should ideally start with your main search target phrase for this reminder, and not have more than one search target phrase, nor be any longer than necessary.">Title</span>:
|
||||
<input type="text" id="title" name="title" value="${fOldInput(fr, "title")}" form="reminder-create" class="w-2/5" required>
|
||||
</label>
|
||||
<div class="mt-4">
|
||||
<label>${fErrorMsg(fr, "message")}
|
||||
<span class="text-2xl text-red-500">*</span><span class="help-text" title="This will be the body of the notification email, or the XMPP message.">Message</span>:<br>
|
||||
<textarea name="message" form="reminder-create" rows="2" class="w-3/4" required>${fOldInput(fr, "message")}</textarea>
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<span class="text-2xl text-red-500">*</span><label for="notify_via">Notify Via:</label>
|
||||
${fErrorMsg(fr, "notify_via")}
|
||||
<label class="ml-1">
|
||||
<input type="radio" name="notify_via" value="email" ${checked(fr, "notify_via", "email")}>
|
||||
Email Only</label>
|
||||
<label class="ml-1">
|
||||
<input type="radio" name="notify_via" value="xmpp" ${checked(fr, "notify_via", "xmpp")}>
|
||||
XMPP Only</label>
|
||||
<label class="ml-1">
|
||||
<input type="radio" name="notify_via" value="both" ${checked(fr, "notify_via", "both")}>
|
||||
Both</label>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<label>${fErrorMsg(fr, "send_date")}
|
||||
<span class="text-2xl text-red-500">*</span>Send Date:
|
||||
<input type="date" id="send_date" name="send_date" value="${fOldInput(fr, "send_date")}">
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
${fErrorMsg(fr, "send_time_hr")}
|
||||
${fErrorMsg(fr, "send_time_min")}
|
||||
${fErrorMsg(fr, "send_time_am_pm")}
|
||||
<span class="text-2xl text-red-500">*</span>Send Time:
|
||||
<select name="send_time_hr">
|
||||
<option value="" ${selected(fr, "send_time_hr", "")}>hr</option>
|
||||
<option value="1" ${selected(fr, "send_time_hr", "1")}>1</option>
|
||||
<option value="2" ${selected(fr, "send_time_hr", "2")}>2</option>
|
||||
<option value="3" ${selected(fr, "send_time_hr", "3")}>3</option>
|
||||
<option value="4" ${selected(fr, "send_time_hr", "4")}>4</option>
|
||||
<option value="5" ${selected(fr, "send_time_hr", "5")}>5</option>
|
||||
<option value="6" ${selected(fr, "send_time_hr", "6")}>6</option>
|
||||
<option value="7" ${selected(fr, "send_time_hr", "7")}>7</option>
|
||||
<option value="8" ${selected(fr, "send_time_hr", "8")}>8</option>
|
||||
<option value="9" ${selected(fr, "send_time_hr", "9")}>9</option>
|
||||
<option value="10" ${selected(fr, "send_time_hr", "10")}>10</option>
|
||||
<option value="11" ${selected(fr, "send_time_hr", "11")}>11</option>
|
||||
<option value="12" ${selected(fr, "send_time_hr", "12")}>12</option>
|
||||
</select>
|
||||
<select name="send_time_min">
|
||||
<option value="" ${selected(fr, "send_time_min", "")}>min</option>
|
||||
<option value="00" ${selected(fr, "send_time_min", "00")}>00</option>
|
||||
<option value="15" ${selected(fr, "send_time_min", "15")}>15</option>
|
||||
<option value="30" ${selected(fr, "send_time_min", "30")}>30</option>
|
||||
<option value="45" ${selected(fr, "send_time_min", "45")}>45</option>
|
||||
</select>
|
||||
<select name="send_time_am_pm">
|
||||
<option value="" ${selected(fr, "send_time_am_pm", "")}>AM/PM</option>
|
||||
<option value="am" ${selected(fr, "send_time_am_pm", "am")}>am</option>
|
||||
<option value="pm" ${selected(fr, "send_time_am_pm", "pm")}>pm</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<label>${fErrorMsg(fr, "repeats")}
|
||||
<span class="text-2xl text-red-500">*</span><span class="help-text" title="Reminders set to repeat will do so at their first opportunity, based on your Repeat settings. If the day of the Repeat hasn't occurred yet for any given (relevant) Repeat increment (week, month, year), you will get a notification on the Send Date and the Repeat Date. If you don't want two notifications during that first increment, you will want to set your Send Date to be what the first Repeat Date would be. For instance, if repeating 'weekly on Thursday' set your Send Date to the upcoming Thursday instead of 'Wednesday', as 'Wednesday' will result in a notification being sent on Wednesday and Thursday'.">Repeats?</span>
|
||||
<input type="checkbox" id="repeats" name="repeats" value="1" ${checked(fr, "repeats", "1")} onclick="showDivIfChecked('repeat_freq', 'repeats')">
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4 hidden" id="repeat_freq">
|
||||
${fErrorMsg(fr, "repeat_freq")}
|
||||
Every
|
||||
<label><input type="radio" id="repeat_freq_day" name="repeat_freq" value="day" ${checked(fr, "repeat_freq", "day")} onclick="hideAllInClassGroup('conditional_divs')"> Day</label>
|
||||
<label><input type="radio" id="repeat_freq_week" name="repeat_freq" value="week" ${checked(fr, "repeat_freq", "week")} onclick="showDivFromClassGroupIfChecked('weekly_on', 'repeat_freq_week', 'conditional_divs')"> Week</label>
|
||||
<label><input type="radio" id="repeat_freq_month" name="repeat_freq" value="month" ${checked(fr, "repeat_freq", "month")} onclick="showDivFromClassGroupIfChecked('monthly_on', 'repeat_freq_month', 'conditional_divs')"> Month</label>
|
||||
<label><input type="radio" id="repeat_freq_year" name="repeat_freq" value="year" ${checked(fr, "repeat_freq", "year")} onclick="showDivFromClassGroupIfChecked('yearly_on', 'repeat_freq_year', 'conditional_divs')"> Year</label>
|
||||
</div>
|
||||
<div class="mt-4 hidden conditional_divs" id="weekly_on">
|
||||
${fErrorMsg(fr, "weekly_on")}
|
||||
<label>On:
|
||||
<select name="weekly_on">
|
||||
<option value="" ${selected(fr, "weekly_on", "")}>? Weekday</option>
|
||||
<option value="Monday" ${selected(fr, "weekly_on", "Monday")}>Monday</option>
|
||||
<option value="Tuesday" ${selected(fr, "weekly_on", "Tuesday")}>Tuesday</option>
|
||||
<option value="Wednesday" ${selected(fr, "weekly_on", "Wednesday")}>Wednesday</option>
|
||||
<option value="Thursday" ${selected(fr, "weekly_on", "Thursday")}>Thursday</option>
|
||||
<option value="Friday" ${selected(fr, "weekly_on", "Friday")}>Friday</option>
|
||||
<option value="Saturday" ${selected(fr, "weekly_on", "Saturday")}>Saturday</option>
|
||||
<option value="Sunday" ${selected(fr, "weekly_on", "Sunday")}>Sunday</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4 hidden conditional_divs" id="monthly_on">
|
||||
${fErrorMsg(fr, "monthly_on_day")}
|
||||
<label>On the:
|
||||
<select id="monthly_on_day" name="monthly_on_day" onchange="clear2ndMonthlyInputs()">
|
||||
<option value="" ${selected(fr, "monthly_on_day", "")}>? Day of Month</option>
|
||||
<option value="1" ${selected(fr, "monthly_on_day", "1")}>1rst</option>
|
||||
<option value="2" ${selected(fr, "monthly_on_day", "2")}>2nd</option>
|
||||
<option value="3" ${selected(fr, "monthly_on_day", "3")}>3rd</option>
|
||||
<option value="4" ${selected(fr, "monthly_on_day", "4")}>4th</option>
|
||||
<option value="5" ${selected(fr, "monthly_on_day", "5")}>5th</option>
|
||||
<option value="6" ${selected(fr, "monthly_on_day", "6")}>6th</option>
|
||||
<option value="7" ${selected(fr, "monthly_on_day", "7")}>7th</option>
|
||||
<option value="8" ${selected(fr, "monthly_on_day", "8")}>8th</option>
|
||||
<option value="9" ${selected(fr, "monthly_on_day", "9")}>9th</option>
|
||||
<option value="10" ${selected(fr, "monthly_on_day", "10")}>10th</option>
|
||||
<option value="11" ${selected(fr, "monthly_on_day", "11")}>11th</option>
|
||||
<option value="12" ${selected(fr, "monthly_on_day", "12")}>12th</option>
|
||||
<option value="13" ${selected(fr, "monthly_on_day", "13")}>13th</option>
|
||||
<option value="14" ${selected(fr, "monthly_on_day", "14")}>14th</option>
|
||||
<option value="15" ${selected(fr, "monthly_on_day", "15")}>15th</option>
|
||||
<option value="16" ${selected(fr, "monthly_on_day", "16")}>16th</option>
|
||||
<option value="17" ${selected(fr, "monthly_on_day", "17")}>17th</option>
|
||||
<option value="18" ${selected(fr, "monthly_on_day", "18")}>18th</option>
|
||||
<option value="19" ${selected(fr, "monthly_on_day", "19")}>19th</option>
|
||||
<option value="20" ${selected(fr, "monthly_on_day", "20")}>20th</option>
|
||||
<option value="21" ${selected(fr, "monthly_on_day", "21")}>21rst</option>
|
||||
<option value="22" ${selected(fr, "monthly_on_day", "22")}>22nd</option>
|
||||
<option value="23" ${selected(fr, "monthly_on_day", "23")}>23rd</option>
|
||||
<option value="24" ${selected(fr, "monthly_on_day", "24")}>24th</option>
|
||||
<option value="25" ${selected(fr, "monthly_on_day", "25")}>25th</option>
|
||||
<option value="26" ${selected(fr, "monthly_on_day", "26")}>26th</option>
|
||||
<option value="27" ${selected(fr, "monthly_on_day", "27")}>27th</option>
|
||||
<option value="28" ${selected(fr, "monthly_on_day", "28")}>28th</option>
|
||||
<option value="29" ${selected(fr, "monthly_on_day", "29")}>29th</option>
|
||||
<option value="30" ${selected(fr, "monthly_on_day", "30")}>30th</option>
|
||||
<option value="31" ${selected(fr, "monthly_on_day", "31")}>31rst</option>
|
||||
</select> day
|
||||
</label>
|
||||
<div class="mt-3.5">Or...</div>
|
||||
${fErrorMsg(fr, "monthly_on_week")}
|
||||
${fErrorMsg(fr, "monthly_on_weekday")}
|
||||
<label>On the:
|
||||
<select id="monthly_on_week" name="monthly_on_week" onchange="clear1rstMonthlyInputs()">
|
||||
<option value="" ${selected(fr, "monthly_on_week", "")}>? Week</option>
|
||||
<option value="1" ${selected(fr, "monthly_on_week", "1")}>1rst</option>
|
||||
<option value="2" ${selected(fr, "monthly_on_week", "2")}>2nd</option>
|
||||
<option value="3" ${selected(fr, "monthly_on_week", "3")}>3rd</option>
|
||||
<option value="last" ${selected(fr, "monthly_on_week", "last")}>Last</option>
|
||||
</select>
|
||||
<select id="monthly_on_weekday" name="monthly_on_weekday" onchange="clear1rstMonthlyInputs()">
|
||||
<option value="" ${selected(fr, "monthly_on_weekday", "")}>? Weekday</option>
|
||||
<option value="Monday" ${selected(fr, "monthly_on_weekday", "Monday")}>Monday</option>
|
||||
<option value="Tuesday" ${selected(fr, "monthly_on_weekday", "Tuesday")}>Tuesday</option>
|
||||
<option value="Wednesday" ${selected(fr, "monthly_on_weekday", "Wednesday")}>Wednesday</option>
|
||||
<option value="Thursday" ${selected(fr, "monthly_on_weekday", "Thursday")}>Thursday</option>
|
||||
<option value="Friday" ${selected(fr, "monthly_on_weekday", "Friday")}>Friday</option>
|
||||
<option value="Saturday" ${selected(fr, "monthly_on_weekday", "Saturday")}>Saturday</option>
|
||||
<option value="Sunday" ${selected(fr, "monthly_on_weekday", "Sunday")}>Sunday</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4 hidden conditional_divs" id="yearly_on">
|
||||
${fErrorMsg(fr, "yearly_on_month")}
|
||||
${fErrorMsg(fr, "yearly_on_day")}
|
||||
<label>On:
|
||||
<select id="yearly_on_month" name="yearly_on_month" onchange="clear2ndYearlyInputs()">
|
||||
<option value="" ${selected(fr, "yearly_on_month", "")}>? Month</option>
|
||||
<option value="January" ${selected(fr, "yearly_on_month", "January")}>January</option>
|
||||
<option value="Febuary" ${selected(fr, "yearly_on_month", "Febuary")}>Febuary</option>
|
||||
<option value="March" ${selected(fr, "yearly_on_month", "March")}>March</option>
|
||||
<option value="April" ${selected(fr, "yearly_on_month", "April")}>April</option>
|
||||
<option value="May" ${selected(fr, "yearly_on_month", "May")}>May</option>
|
||||
<option value="June" ${selected(fr, "yearly_on_month", "June")}>June</option>
|
||||
<option value="July" ${selected(fr, "yearly_on_month", "July")}>July</option>
|
||||
<option value="August" ${selected(fr, "yearly_on_month", "August")}>August</option>
|
||||
<option value="September" ${selected(fr, "yearly_on_month", "September")}>September</option>
|
||||
<option value="October" ${selected(fr, "yearly_on_month", "October")}>October</option>
|
||||
<option value="November" ${selected(fr, "yearly_on_month", "November")}>November</option>
|
||||
<option value="December" ${selected(fr, "yearly_on_month", "December")}>December</option>
|
||||
</select>
|
||||
<select id="yearly_on_day" name="yearly_on_day" onchange="clear2ndYearlyInputs()">
|
||||
<option value="" ${selected(fr, "yearly_on_day", "")}>? Day</option>
|
||||
<option value="1" ${selected(fr, "yearly_on_day", "1")}>1rst</option>
|
||||
<option value="2" ${selected(fr, "yearly_on_day", "2")}>2nd</option>
|
||||
<option value="3" ${selected(fr, "yearly_on_day", "3")}>3rd</option>
|
||||
<option value="4" ${selected(fr, "yearly_on_day", "4")}>4th</option>
|
||||
<option value="5" ${selected(fr, "yearly_on_day", "5")}>5th</option>
|
||||
<option value="6" ${selected(fr, "yearly_on_day", "6")}>6th</option>
|
||||
<option value="7" ${selected(fr, "yearly_on_day", "7")}>7th</option>
|
||||
<option value="8" ${selected(fr, "yearly_on_day", "8")}>8th</option>
|
||||
<option value="9" ${selected(fr, "yearly_on_day", "9")}>9th</option>
|
||||
<option value="10" ${selected(fr, "yearly_on_day", "10")}>10th</option>
|
||||
<option value="11" ${selected(fr, "yearly_on_day", "11")}>11th</option>
|
||||
<option value="12" ${selected(fr, "yearly_on_day", "12")}>12th</option>
|
||||
<option value="13" ${selected(fr, "yearly_on_day", "13")}>13th</option>
|
||||
<option value="14" ${selected(fr, "yearly_on_day", "14")}>14th</option>
|
||||
<option value="15" ${selected(fr, "yearly_on_day", "15")}>15th</option>
|
||||
<option value="16" ${selected(fr, "yearly_on_day", "16")}>16th</option>
|
||||
<option value="17" ${selected(fr, "yearly_on_day", "17")}>17th</option>
|
||||
<option value="18" ${selected(fr, "yearly_on_day", "18")}>18th</option>
|
||||
<option value="19" ${selected(fr, "yearly_on_day", "19")}>19th</option>
|
||||
<option value="20" ${selected(fr, "yearly_on_day", "20")}>20th</option>
|
||||
<option value="21" ${selected(fr, "yearly_on_day", "21")}>21rst</option>
|
||||
<option value="22" ${selected(fr, "yearly_on_day", "22")}>22nd</option>
|
||||
<option value="23" ${selected(fr, "yearly_on_day", "23")}>23rd</option>
|
||||
<option value="24" ${selected(fr, "yearly_on_day", "24")}>24th</option>
|
||||
<option value="25" ${selected(fr, "yearly_on_day", "25")}>25th</option>
|
||||
<option value="26" ${selected(fr, "yearly_on_day", "26")}>26th</option>
|
||||
<option value="27" ${selected(fr, "yearly_on_day", "27")}>27th</option>
|
||||
<option value="28" ${selected(fr, "yearly_on_day", "28")}>28th</option>
|
||||
<option value="29" ${selected(fr, "yearly_on_day", "29")}>29th</option>
|
||||
<option value="30" ${selected(fr, "yearly_on_day", "30")}>30th</option>
|
||||
<option value="31" ${selected(fr, "yearly_on_day", "31")}>31rst</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="mt-3.5">or...</div>
|
||||
${fErrorMsg(fr, "yearly_on_week")}
|
||||
${fErrorMsg(fr, "yearly_on_weekday")}
|
||||
${fErrorMsg(fr, "yearly_on_month2")}
|
||||
<label>On the:
|
||||
<select id="yearly_on_week" name="yearly_on_week" onchange="clear1rstYearlyInputs()">
|
||||
<option value="" ${selected(fr, "yearly_on_week", "")}>? Week</option>
|
||||
<option value="1" ${selected(fr, "yearly_on_week", "1")}>1rst</option>
|
||||
<option value="2" ${selected(fr, "yearly_on_week", "2")}>2nd</option>
|
||||
<option value="3" ${selected(fr, "yearly_on_week", "3")}>3rd</option>
|
||||
<option value="last" ${selected(fr, "yearly_on_week", "last")}>Last</option>
|
||||
</select>
|
||||
<select id="yearly_on_weekday" name="yearly_on_weekday" onchange="clear1rstYearlyInputs()">
|
||||
<option value="" ${selected(fr, "yearly_on_weekday", "")}>? Weekday</option>
|
||||
<option value="Monday" ${selected(fr, "yearly_on_weekday", "Monday")}>Monday</option>
|
||||
<option value="Tuesday" ${selected(fr, "yearly_on_weekday", "Tuesday")}>Tuesday</option>
|
||||
<option value="Wednesday" ${selected(fr, "yearly_on_weekday", "Wednesday")}>Wednesday</option>
|
||||
<option value="Thursday" ${selected(fr, "yearly_on_weekday", "Thursday")}>Thursday</option>
|
||||
<option value="Friday" ${selected(fr, "yearly_on_weekday", "Friday")}>Friday</option>
|
||||
<option value="Saturday" ${selected(fr, "yearly_on_weekday", "Saturday")}>Saturday</option>
|
||||
<option value="Sunday" ${selected(fr, "yearly_on_weekday", "Sunday")}>Sunday</option>
|
||||
</select>
|
||||
<span> of </span>
|
||||
<select id="yearly_on_month2" name="yearly_on_month2" onchange="clear1rstYearlyInputs()">
|
||||
<option value="" ${selected(fr, "yearly_on_month2", "")}>? Month</option>
|
||||
<option value="January" ${selected(fr, "yearly_on_month2", "January")}>January</option>
|
||||
<option value="Febuary" ${selected(fr, "yearly_on_month2", "Febuary")}>Febuary</option>
|
||||
<option value="March" ${selected(fr, "yearly_on_month2", "March")}>March</option>
|
||||
<option value="April" ${selected(fr, "yearly_on_month2", "April")}>April</option>
|
||||
<option value="May" ${selected(fr, "yearly_on_month2", "May")}>May</option>
|
||||
<option value="June" ${selected(fr, "yearly_on_month2", "June")}>June</option>
|
||||
<option value="July" ${selected(fr, "yearly_on_month2", "July")}>July</option>
|
||||
<option value="August" ${selected(fr, "yearly_on_month2", "August")}>August</option>
|
||||
<option value="September" ${selected(fr, "yearly_on_month2", "September")}>September</option>
|
||||
<option value="October" ${selected(fr, "yearly_on_month2", "October")}>October</option>
|
||||
<option value="November" ${selected(fr, "yearly_on_month2", "November")}>November</option>
|
||||
<option value="December" ${selected(fr, "yearly_on_month2", "December")}>December</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<br>
|
||||
<div class="text-end">
|
||||
<button class="btn-grn mt-3 mr-4" type="submit" form="reminder-create">Save</button>
|
||||
</div>
|
||||
</form><br>
|
||||
<br>
|
||||
${mainTemplateBottom()}
|
||||
<div class="page-js">
|
||||
<script>
|
||||
|
||||
var monthlyOnDay = document.getElementById("monthly_on_day")
|
||||
var monthlyOnWeek = document.getElementById("monthly_on_week")
|
||||
var monthlyOnWeekday = document.getElementById("monthly_on_weekday")
|
||||
|
||||
function clear2ndMonthlyInputs() {
|
||||
if (monthlyOnDay.value != "") {
|
||||
monthlyOnWeek.value = ""
|
||||
monthlyOnWeekday.value = ""
|
||||
}
|
||||
}
|
||||
|
||||
function clear1rstMonthlyInputs() {
|
||||
if ((monthlyOnWeek.value != "") || (monthlyOnWeekday.value != "")) {
|
||||
monthlyOnDay.value = ""
|
||||
}
|
||||
}
|
||||
|
||||
var yearlyOnMonth = document.getElementById("yearly_on_month")
|
||||
var yearlyOnDay = document.getElementById("yearly_on_day")
|
||||
var yearlyOnWeek = document.getElementById("yearly_on_week")
|
||||
var yearlyOnWeekday = document.getElementById("yearly_on_weekday")
|
||||
var yearlyOnMonth2 = document.getElementById("yearly_on_month2")
|
||||
|
||||
function clear2ndYearlyInputs() {
|
||||
if ((yearlyOnMonth.value != "") || (yearlyOnDay.value != "")) {
|
||||
yearlyOnWeek.value = ""
|
||||
yearlyOnWeekday.value = ""
|
||||
yearlyOnMonth2.value = ""
|
||||
}
|
||||
}
|
||||
|
||||
function clear1rstYearlyInputs() {
|
||||
if ((yearlyOnWeek.value != "") || (yearlyOnWeekday.value != "") || (yearlyOnMonth2.value != "")) {
|
||||
yearlyOnMonth.value = ""
|
||||
yearlyOnDay.value = ""
|
||||
}
|
||||
}
|
||||
|
||||
function useTitleForSubject() {
|
||||
let title = document.getElementById("title")
|
||||
let subject = document.getElementById("subject")
|
||||
subject.value = title.value
|
||||
}
|
||||
function showDivIfChecked(divId, elId) {
|
||||
let div = document.getElementById(divId);
|
||||
let el = document.getElementById(elId);
|
||||
if (el.checked == true) {
|
||||
div.classList.remove("hidden");
|
||||
} else {
|
||||
div.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
function hideAllInClassGroup(classGroup) {
|
||||
let allDivs = document.getElementsByClassName(classGroup)
|
||||
Array.from(allDivs).forEach(allDiv => {
|
||||
allDiv.classList.add("hidden");
|
||||
});
|
||||
}
|
||||
function showDivFromClassGroupIfChecked(divId, elId, classGroup) {
|
||||
let div = document.getElementById(divId);
|
||||
let el = document.getElementById(elId);
|
||||
let allDivs = document.getElementsByClassName(classGroup)
|
||||
if (el.checked == true) {
|
||||
div.classList.remove("hidden");
|
||||
Array.from(allDivs).forEach(allDiv => {
|
||||
if (allDiv.id != divId) {
|
||||
allDiv.classList.add("hidden");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
showDivIfChecked('repeat_freq', 'repeats')
|
||||
let dayRadio = document.getElementById("repeat_freq_day")
|
||||
if (dayRadio.checked == true) {
|
||||
hideAllInClassGroup("conditional_divs")
|
||||
}
|
||||
showDivFromClassGroupIfChecked('weekly_on', 'repeat_freq_week', 'conditional_divs')
|
||||
showDivFromClassGroupIfChecked('monthly_on', 'repeat_freq_month', 'conditional_divs')
|
||||
showDivFromClassGroupIfChecked('yearly_on', 'repeat_freq_year', 'conditional_divs')
|
||||
</script>
|
||||
</div>
|
||||
#end proc
|
||||
361
templates/reminder_update.nimf
Normal file
361
templates/reminder_update.nimf
Normal file
@@ -0,0 +1,361 @@
|
||||
#? stdtmpl(subsChar = '$', metaChar = '#')
|
||||
#import "../helpers/global", "../helpers/form", "../helpers/auth", "../models/reminder"
|
||||
#import "main_template_top.nimf", "main_template_bottom.nimf"
|
||||
#proc reminderUpdateTemplate*(reminderId:int, csrfToken: string, fr: FormResult): string =
|
||||
#let reminder = getReminderById(reminderId)
|
||||
#let pageTitle = "Update Reminder: " & reminder.title
|
||||
# result = ""
|
||||
${mainTemplateTop(pageTitle, csrfToken)}
|
||||
<h1>${pageTitle}</h1>
|
||||
<div class="text-end">
|
||||
<form method="POST" action="${APP_URL}/reminder/delete" accept-charset="utf-8">
|
||||
<input type="hidden" name="csrf_token" value="${csrfToken}">
|
||||
<input type="hidden" name="reminder_id" value="${reminderId}" />
|
||||
<button class="btn-red" type="submit"><span class="help-text" title="Delete the Reminder. Warning! This will not ask for confirmation.">X Reminder</span></button>
|
||||
</form>
|
||||
</div>
|
||||
#if fr.message.len > 0:
|
||||
<h2 id="form_message" class="${fr.messageClass}">${fr.message}</h2>
|
||||
#end if
|
||||
<form id="reminder-update" method="POST" action="${APP_URL}/reminder/update" accept-charset="utf-8">
|
||||
<input type="hidden" name="csrf_token" value="${csrfToken}" form="reminder-update"/>
|
||||
<input type="hidden" name="reminder_id" value="${reminder.id}">
|
||||
<label>${fErrorMsg(fr, "title")}
|
||||
<span class="text-2xl text-red-500">*</span><span class="help-text" title="This will be used to generate your section's url and meta-title and is very important for SEO, so it should ideally start with your main search target phrase for this section, and not have more than one search target phrase, nor be any longer than necessary.">Title</span>:
|
||||
<input type="text" name="title" value="${fOldInput(fr, "title", reminder.title)}" form="reminder-update" class="w-2/5" required>
|
||||
</label>
|
||||
<div class="mt-4">
|
||||
<label>${fErrorMsg(fr, "message")}
|
||||
<span class="text-2xl text-red-500">*</span><span class="help-text" title="A shorter and possibly different version of your page's markup, used to entice the visitor to click on the link(s) to visit this Section (child) Page from it's parent Section page.">Message</span>:<br>
|
||||
<textarea name="message" form="reminder-update" rows="2" class="w-3/4" required>${fOldInput(fr, "message", reminder.message)}</textarea>
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<span class="text-2xl text-red-500">*</span><label for="notify_via">Notify Via:</label>
|
||||
${fErrorMsg(fr, "notify_via")}
|
||||
<label class="ml-1">
|
||||
<input type="radio" name="notify_via" value="email" ${checked(fr, "notify_via", "email", reminder.notifyVia)} form="reminder-update">
|
||||
Email Only</label>
|
||||
<label class="ml-1">
|
||||
<input type="radio" name="notify_via" value="xmpp" ${checked(fr, "notify_via", "xmpp", reminder.notifyVia)} form="reminder-update">
|
||||
XMPP Only</label>
|
||||
<label class="ml-1">
|
||||
<input type="radio" name="notify_via" value="both" ${checked(fr, "notify_via", "both", reminder.notifyVia)} form="reminder-update">
|
||||
Both</label>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<label>${fErrorMsg(fr, "send_date")}
|
||||
<span class="text-2xl text-red-500">*</span>Send Date:
|
||||
<input type="date" id="send_date" name="send_date" form="reminder-update" value="${fOldInput(fr, "send_date", reminder.send_date)}">
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
${fErrorMsg(fr, "send_time_hr")}
|
||||
${fErrorMsg(fr, "send_time_min")}
|
||||
${fErrorMsg(fr, "send_time_am_pm")}
|
||||
<span class="text-2xl text-red-500">*</span>Send Time:
|
||||
<select name="send_time_hr" form="reminder-update" >
|
||||
<option value="" ${selected(fr, "send_time_hr", "", $reminder.sendTimeHr)} >hr</option>
|
||||
<option value="1" ${selected(fr, "send_time_hr", "1", $reminder.sendTimeHr)}>1</option>
|
||||
<option value="2" ${selected(fr, "send_time_hr", "2", $reminder.sendTimeHr)}>2</option>
|
||||
<option value="3" ${selected(fr, "send_time_hr", "3", $reminder.sendTimeHr)}>3</option>
|
||||
<option value="4" ${selected(fr, "send_time_hr", "4", $reminder.sendTimeHr)}>4</option>
|
||||
<option value="5" ${selected(fr, "send_time_hr", "5", $reminder.sendTimeHr)}>5</option>
|
||||
<option value="6" ${selected(fr, "send_time_hr", "6", $reminder.sendTimeHr)}>6</option>
|
||||
<option value="7" ${selected(fr, "send_time_hr", "7", $reminder.sendTimeHr)}>7</option>
|
||||
<option value="8" ${selected(fr, "send_time_hr", "8", $reminder.sendTimeHr)}>8</option>
|
||||
<option value="9" ${selected(fr, "send_time_hr", "9", $reminder.sendTimeHr)}>9</option>
|
||||
<option value="10" ${selected(fr, "send_time_hr", "10", $reminder.sendTimeHr)}>10</option>
|
||||
<option value="11" ${selected(fr, "send_time_hr", "11", $reminder.sendTimeHr)}>11</option>
|
||||
<option value="12" ${selected(fr, "send_time_hr", "12", $reminder.sendTimeHr)}>12</option>
|
||||
</select>
|
||||
<select name="send_time_min" form="reminder-update">
|
||||
<option value="" ${selected(fr, "send_time_min", "", $reminder.sendTimeMin)}>min</option>
|
||||
<option value="00" ${selected(fr, "send_time_min", "00", $reminder.sendTimeMin)}>00</option>
|
||||
<option value="15" ${selected(fr, "send_time_min", "15", $reminder.sendTimeMin)}>15</option>
|
||||
<option value="30" ${selected(fr, "send_time_min", "30", $reminder.sendTimeMin)}>30</option>
|
||||
<option value="45" ${selected(fr, "send_time_min", "45", $reminder.sendTimeMin)}>45</option>
|
||||
</select>
|
||||
<select name="send_time_am_pm" form="reminder-update">
|
||||
<option value="" ${selected(fr, "send_time_am_pm", "", $reminder.sendTimeAmPm)}>AM/PM</option>
|
||||
<option value="am" ${selected(fr, "send_time_am_pm", "am", $reminder.sendTimeAmPm)}>am</option>
|
||||
<option value="pm" ${selected(fr, "send_time_am_pm", "pm", $reminder.sendTimeAmPm)}>pm</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<label>${fErrorMsg(fr, "repeats")}
|
||||
<span class="text-2xl text-red-500">*</span><span class="help-text" title="Reminders set to repeat will do so at their first opportunity, based on your Repeat settings. If the day of the Repeat hasn't occurred yet for any given (relevant) Repeat increment (week, month, year), you will get a notification on the Send Date and the Repeat Date. If you don't want two notifications during that first increment, you will want to set your Send Date to be what the first Repeat Date would be. For instance, if repeating 'weekly on Thursday' set your Send Date to the upcoming Thursday instead of 'Wednesday', as 'Wednesday' will result in a notification being sent on Wednesday and Thursday'.">Repeats?</span>
|
||||
<input type="checkbox" id="repeats" name="repeats" value="1" ${checked(fr, "repeats", "1", $reminder.repeats)} onclick="showDivIfChecked('repeat_freq', 'repeats')" form="reminder-update">
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4 hidden" id="repeat_freq">
|
||||
${fErrorMsg(fr, "repeat_freq")}
|
||||
Every
|
||||
<label><input type="radio" id="repeat_freq_day" name="repeat_freq" value="day" ${checked(fr, "repeat_freq", "day", reminder.repeat_freq)} onclick="hideAllInClassGroup('conditional_divs')" form="reminder-update"> Day</label>
|
||||
<label><input type="radio" id="repeat_freq_week" name="repeat_freq" value="week" ${checked(fr, "repeat_freq", "week", reminder.repeat_freq)} onclick="showDivFromClassGroupIfChecked('weekly_on', 'repeat_freq_week', 'conditional_divs')" form="reminder-update"> Week</label>
|
||||
<label><input type="radio" id="repeat_freq_month" name="repeat_freq" value="month" ${checked(fr, "repeat_freq", "month", reminder.repeat_freq)} onclick="showDivFromClassGroupIfChecked('monthly_on', 'repeat_freq_month', 'conditional_divs')" form="reminder-update"> Month</label>
|
||||
<label><input type="radio" id="repeat_freq_year" name="repeat_freq" value="year" ${checked(fr, "repeat_freq", "year", reminder.repeat_freq)} onclick="showDivFromClassGroupIfChecked('yearly_on', 'repeat_freq_year', 'conditional_divs')" form="reminder-update"> Year</label>
|
||||
</div>
|
||||
<div class="mt-4 hidden conditional_divs" id="weekly_on">
|
||||
${fErrorMsg(fr, "weekly_on")}
|
||||
<label>On:
|
||||
<select name="weekly_on" form="reminder-update">
|
||||
<option value="" ${selected(fr, "weekly_on", "", $reminder.weeklyOn)}>? Weekday</option>
|
||||
<option value="Monday" ${selected(fr, "weekly_on", "Monday", $reminder.weeklyOn)}>Monday</option>
|
||||
<option value="Tuesday" ${selected(fr, "weekly_on", "Tuesday", $reminder.weeklyOn)}>Tuesday</option>
|
||||
<option value="Wednesday" ${selected(fr, "weekly_on", "Wednesday", $reminder.weeklyOn)}>Wednesday</option>
|
||||
<option value="Thursday" ${selected(fr, "weekly_on", "Thursday", $reminder.weeklyOn)}>Thursday</option>
|
||||
<option value="Friday" ${selected(fr, "weekly_on", "Friday", $reminder.weeklyOn)}>Friday</option>
|
||||
<option value="Saturday" ${selected(fr, "weekly_on", "Saturday", $reminder.weeklyOn)}>Saturday</option>
|
||||
<option value="Sunday" ${selected(fr, "weekly_on", "Sunday", $reminder.weeklyOn)}>Sunday</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4 hidden conditional_divs" id="monthly_on">
|
||||
${fErrorMsg(fr, "monthly_on_day")}
|
||||
<label>On the:
|
||||
<select name="monthly_on_day" form="reminder-update" id="monthly_on_day" onchange="clear2ndMonthlyInputs()">
|
||||
<option value="" ${selected(fr, "monthly_on_day", "", $reminder.monthlyOnDay)}>? Day of Month</option>
|
||||
<option value="1" ${selected(fr, "monthly_on_day", "1", $reminder.monthlyOnDay)}>1rst</option>
|
||||
<option value="2" ${selected(fr, "monthly_on_day", "2", $reminder.monthlyOnDay)}>2nd</option>
|
||||
<option value="3" ${selected(fr, "monthly_on_day", "3", $reminder.monthlyOnDay)}>3rd</option>
|
||||
<option value="4" ${selected(fr, "monthly_on_day", "4", $reminder.monthlyOnDay)}>4th</option>
|
||||
<option value="5" ${selected(fr, "monthly_on_day", "5", $reminder.monthlyOnDay)}>5th</option>
|
||||
<option value="6" ${selected(fr, "monthly_on_day", "6", $reminder.monthlyOnDay)}>6th</option>
|
||||
<option value="7" ${selected(fr, "monthly_on_day", "7", $reminder.monthlyOnDay)}>7th</option>
|
||||
<option value="8" ${selected(fr, "monthly_on_day", "8", $reminder.monthlyOnDay)}>8th</option>
|
||||
<option value="9" ${selected(fr, "monthly_on_day", "9", $reminder.monthlyOnDay)}>9th</option>
|
||||
<option value="10" ${selected(fr, "monthly_on_day", "10", $reminder.monthlyOnDay)}>10th</option>
|
||||
<option value="11" ${selected(fr, "monthly_on_day", "11", $reminder.monthlyOnDay)}>11th</option>
|
||||
<option value="12" ${selected(fr, "monthly_on_day", "12", $reminder.monthlyOnDay)}>12th</option>
|
||||
<option value="13" ${selected(fr, "monthly_on_day", "13", $reminder.monthlyOnDay)}>13th</option>
|
||||
<option value="14" ${selected(fr, "monthly_on_day", "14", $reminder.monthlyOnDay)}>14th</option>
|
||||
<option value="15" ${selected(fr, "monthly_on_day", "15", $reminder.monthlyOnDay)}>15th</option>
|
||||
<option value="16" ${selected(fr, "monthly_on_day", "16", $reminder.monthlyOnDay)}>16th</option>
|
||||
<option value="17" ${selected(fr, "monthly_on_day", "17", $reminder.monthlyOnDay)}>17th</option>
|
||||
<option value="18" ${selected(fr, "monthly_on_day", "18", $reminder.monthlyOnDay)}>18th</option>
|
||||
<option value="19" ${selected(fr, "monthly_on_day", "19", $reminder.monthlyOnDay)}>19th</option>
|
||||
<option value="20" ${selected(fr, "monthly_on_day", "20", $reminder.monthlyOnDay)}>20th</option>
|
||||
<option value="21" ${selected(fr, "monthly_on_day", "21", $reminder.monthlyOnDay)}>21rst</option>
|
||||
<option value="22" ${selected(fr, "monthly_on_day", "22", $reminder.monthlyOnDay)}>22nd</option>
|
||||
<option value="23" ${selected(fr, "monthly_on_day", "23", $reminder.monthlyOnDay)}>23rd</option>
|
||||
<option value="24" ${selected(fr, "monthly_on_day", "24", $reminder.monthlyOnDay)}>24th</option>
|
||||
<option value="25" ${selected(fr, "monthly_on_day", "25", $reminder.monthlyOnDay)}>25th</option>
|
||||
<option value="26" ${selected(fr, "monthly_on_day", "26", $reminder.monthlyOnDay)}>26th</option>
|
||||
<option value="27" ${selected(fr, "monthly_on_day", "27", $reminder.monthlyOnDay)}>27th</option>
|
||||
<option value="28" ${selected(fr, "monthly_on_day", "28", $reminder.monthlyOnDay)}>28th</option>
|
||||
<option value="29" ${selected(fr, "monthly_on_day", "29", $reminder.monthlyOnDay)}>29th</option>
|
||||
<option value="30" ${selected(fr, "monthly_on_day", "30", $reminder.monthlyOnDay)}>30th</option>
|
||||
<option value="31" ${selected(fr, "monthly_on_day", "31", $reminder.monthlyOnDay)}>31rst</option>
|
||||
</select> day
|
||||
</label>
|
||||
<div class="mt-3.5">Or...</div>
|
||||
${fErrorMsg(fr, "monthly_on_week")}
|
||||
${fErrorMsg(fr, "monthly_on_weekday")}
|
||||
<label>On the:
|
||||
<select name="monthly_on_week" form="reminder-update" id="monthly_on_week" onchange="clear1rstMonthlyInputs()">
|
||||
<option value="" ${selected(fr, "monthly_on_week", "", $reminder.monthlyOnWeek)}>? Week</option>
|
||||
<option value="1" ${selected(fr, "monthly_on_week", "1", $reminder.monthlyOnWeek)}>1rst</option>
|
||||
<option value="2" ${selected(fr, "monthly_on_week", "2", $reminder.monthlyOnWeek)}>2nd</option>
|
||||
<option value="3" ${selected(fr, "monthly_on_week", "3", $reminder.monthlyOnWeek)}>3rd</option>
|
||||
<option value="last" ${selected(fr, "monthly_on_week", "last", $reminder.monthlyOnWeek)}>Last</option>
|
||||
</select>
|
||||
<select name="monthly_on_weekday" form="reminder-update" id="monthly_on_weekday" onchange="clear1rstMonthlyInputs()">
|
||||
<option value="" ${selected(fr, "monthly_on_weekday", "", $reminder.monthlyOnWeekday)}>? Weekday</option>
|
||||
<option value="Monday" ${selected(fr, "monthly_on_weekday", "Monday", $reminder.monthlyOnWeekday)}>Monday</option>
|
||||
<option value="Tuesday" ${selected(fr, "monthly_on_weekday", "Tuesday", $reminder.monthlyOnWeekday)}>Tuesday</option>
|
||||
<option value="Wednesday" ${selected(fr, "monthly_on_weekday", "Wednesday", $reminder.monthlyOnWeekday)}>Wednesday</option>
|
||||
<option value="Thursday" ${selected(fr, "monthly_on_weekday", "Thursday", $reminder.monthlyOnWeekday)}>Thursday</option>
|
||||
<option value="Friday" ${selected(fr, "monthly_on_weekday", "Friday", $reminder.monthlyOnWeekday)}>Friday</option>
|
||||
<option value="Saturday" ${selected(fr, "monthly_on_weekday", "Saturday", $reminder.monthlyOnWeekday)}>Saturday</option>
|
||||
<option value="Sunday" ${selected(fr, "monthly_on_weekday", "Sunday", $reminder.monthlyOnWeekday)}>Sunday</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4 hidden conditional_divs" id="yearly_on">
|
||||
${fErrorMsg(fr, "yearly_on_month")}
|
||||
${fErrorMsg(fr, "yearly_on_day")}
|
||||
<label>On:
|
||||
<select name="yearly_on_month" form="reminder-update" id="yearly_on_month" onchange="clear2ndYearlyInputs()">
|
||||
<option value="" ${selected(fr, "yearly_on_month", "", $reminder.yearlyOnMonth)}>? Month</option>
|
||||
<option value="January" ${selected(fr, "yearly_on_month", "January", $reminder.yearlyOnMonth)}>January</option>
|
||||
<option value="Febuary" ${selected(fr, "yearly_on_month", "Febuary", $reminder.yearlyOnMonth)}>Febuary</option>
|
||||
<option value="March" ${selected(fr, "yearly_on_month", "March", $reminder.yearlyOnMonth)}>March</option>
|
||||
<option value="April" ${selected(fr, "yearly_on_month", "April", $reminder.yearlyOnMonth)}>April</option>
|
||||
<option value="May" ${selected(fr, "yearly_on_month", "May", $reminder.yearlyOnMonth)}>May</option>
|
||||
<option value="June" ${selected(fr, "yearly_on_month", "June", $reminder.yearlyOnMonth)}>June</option>
|
||||
<option value="July" ${selected(fr, "yearly_on_month", "July", $reminder.yearlyOnMonth)}>July</option>
|
||||
<option value="August" ${selected(fr, "yearly_on_month", "August", $reminder.yearlyOnMonth)}>August</option>
|
||||
<option value="September" ${selected(fr, "yearly_on_month", "September", $reminder.yearlyOnMonth)}>September</option>
|
||||
<option value="October" ${selected(fr, "yearly_on_month", "October", $reminder.yearlyOnMonth)}>October</option>
|
||||
<option value="November" ${selected(fr, "yearly_on_month", "November", $reminder.yearlyOnMonth)}>November</option>
|
||||
<option value="December" ${selected(fr, "yearly_on_month", "December", $reminder.yearlyOnMonth)}>December</option>
|
||||
</select>
|
||||
<select name="yearly_on_day" form="reminder-update" id="yearly_on_day" onchange="clear2ndYearlyInputs()">
|
||||
<option value="" ${selected(fr, "yearly_on_day", "", $reminder.yearlyOnDay)}>? Day</option>
|
||||
<option value="1" ${selected(fr, "yearly_on_day", "1", $reminder.yearlyOnDay)}>1rst</option>
|
||||
<option value="2" ${selected(fr, "yearly_on_day", "2", $reminder.yearlyOnDay)}>2nd</option>
|
||||
<option value="3" ${selected(fr, "yearly_on_day", "3", $reminder.yearlyOnDay)}>3rd</option>
|
||||
<option value="4" ${selected(fr, "yearly_on_day", "4", $reminder.yearlyOnDay)}>4th</option>
|
||||
<option value="5" ${selected(fr, "yearly_on_day", "5", $reminder.yearlyOnDay)}>5th</option>
|
||||
<option value="6" ${selected(fr, "yearly_on_day", "6", $reminder.yearlyOnDay)}>6th</option>
|
||||
<option value="7" ${selected(fr, "yearly_on_day", "7", $reminder.yearlyOnDay)}>7th</option>
|
||||
<option value="8" ${selected(fr, "yearly_on_day", "8", $reminder.yearlyOnDay)}>8th</option>
|
||||
<option value="9" ${selected(fr, "yearly_on_day", "9", $reminder.yearlyOnDay)}>9th</option>
|
||||
<option value="10" ${selected(fr, "yearly_on_day", "10", $reminder.yearlyOnDay)}>10th</option>
|
||||
<option value="11" ${selected(fr, "yearly_on_day", "11", $reminder.yearlyOnDay)}>11th</option>
|
||||
<option value="12" ${selected(fr, "yearly_on_day", "12", $reminder.yearlyOnDay)}>12th</option>
|
||||
<option value="13" ${selected(fr, "yearly_on_day", "13", $reminder.yearlyOnDay)}>13th</option>
|
||||
<option value="14" ${selected(fr, "yearly_on_day", "14", $reminder.yearlyOnDay)}>14th</option>
|
||||
<option value="15" ${selected(fr, "yearly_on_day", "15", $reminder.yearlyOnDay)}>15th</option>
|
||||
<option value="16" ${selected(fr, "yearly_on_day", "16", $reminder.yearlyOnDay)}>16th</option>
|
||||
<option value="17" ${selected(fr, "yearly_on_day", "17", $reminder.yearlyOnDay)}>17th</option>
|
||||
<option value="18" ${selected(fr, "yearly_on_day", "18", $reminder.yearlyOnDay)}>18th</option>
|
||||
<option value="19" ${selected(fr, "yearly_on_day", "19", $reminder.yearlyOnDay)}>19th</option>
|
||||
<option value="20" ${selected(fr, "yearly_on_day", "20", $reminder.yearlyOnDay)}>20th</option>
|
||||
<option value="21" ${selected(fr, "yearly_on_day", "21", $reminder.yearlyOnDay)}>21rst</option>
|
||||
<option value="22" ${selected(fr, "yearly_on_day", "22", $reminder.yearlyOnDay)}>22nd</option>
|
||||
<option value="23" ${selected(fr, "yearly_on_day", "23", $reminder.yearlyOnDay)}>23rd</option>
|
||||
<option value="24" ${selected(fr, "yearly_on_day", "24", $reminder.yearlyOnDay)}>24th</option>
|
||||
<option value="25" ${selected(fr, "yearly_on_day", "25", $reminder.yearlyOnDay)}>25th</option>
|
||||
<option value="26" ${selected(fr, "yearly_on_day", "26", $reminder.yearlyOnDay)}>26th</option>
|
||||
<option value="27" ${selected(fr, "yearly_on_day", "27", $reminder.yearlyOnDay)}>27th</option>
|
||||
<option value="28" ${selected(fr, "yearly_on_day", "28", $reminder.yearlyOnDay)}>28th</option>
|
||||
<option value="29" ${selected(fr, "yearly_on_day", "29", $reminder.yearlyOnDay)}>29th</option>
|
||||
<option value="30" ${selected(fr, "yearly_on_day", "30", $reminder.yearlyOnDay)}>30th</option>
|
||||
<option value="31" ${selected(fr, "yearly_on_day", "31", $reminder.yearlyOnDay)}>31rst</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="mt-3.5">or...</div>
|
||||
${fErrorMsg(fr, "yearly_on_week")}
|
||||
${fErrorMsg(fr, "yearly_on_weekday")}
|
||||
${fErrorMsg(fr, "yearly_on_month2")}
|
||||
<label>On the:
|
||||
<select name="yearly_on_week" form="reminder-update" id="yearly_on_week" onchange="clear1rstYearlyInputs()">
|
||||
<option value="" ${selected(fr, "yearly_on_week", "", $reminder.yearlyOnWeek)}>? Week</option>
|
||||
<option value="1" ${selected(fr, "yearly_on_week", "1", $reminder.yearlyOnWeek)}>1rst</option>
|
||||
<option value="2" ${selected(fr, "yearly_on_week", "2", $reminder.yearlyOnWeek)}>2nd</option>
|
||||
<option value="3" ${selected(fr, "yearly_on_week", "3", $reminder.yearlyOnWeek)}>3rd</option>
|
||||
<option value="last" ${selected(fr, "yearly_on_week", "last", $reminder.yearlyOnWeek)}>Last</option>
|
||||
</select>
|
||||
<select name="yearly_on_weekday" form="reminder-update" id="yearly_on_weekday" onchange="clear1rstYearlyInputs()">
|
||||
<option value="" ${selected(fr, "yearly_on_weekday", "", $reminder.yearlyOnWeekday)}>? Weekday</option>
|
||||
<option value="Monday" ${selected(fr, "yearly_on_weekday", "Monday", $reminder.yearlyOnWeekday)}>Monday</option>
|
||||
<option value="Tuesday" ${selected(fr, "yearly_on_weekday", "Tuesday", $reminder.yearlyOnWeekday)}>Tuesday</option>
|
||||
<option value="Wednesday" ${selected(fr, "yearly_on_weekday", "Wednesday", $reminder.yearlyOnWeekday)}>Wednesday</option>
|
||||
<option value="Thursday" ${selected(fr, "yearly_on_weekday", "Thursday", $reminder.yearlyOnWeekday)}>Thursday</option>
|
||||
<option value="Friday" ${selected(fr, "yearly_on_weekday", "Friday", $reminder.yearlyOnWeekday)}>Friday</option>
|
||||
<option value="Saturday" ${selected(fr, "yearly_on_weekday", "Saturday", $reminder.yearlyOnWeekday)}>Saturday</option>
|
||||
<option value="Sunday" ${selected(fr, "yearly_on_weekday", "Sunday", $reminder.yearlyOnWeekday)}>Sunday</option>
|
||||
</select>
|
||||
<span> of </span>
|
||||
<select name="yearly_on_month2" form="reminder-update" id="yearly_on_month2" onchange="clear1rstYearlyInputs()">
|
||||
<option value="" ${selected(fr, "yearly_on_month2", "", $reminder.yearlyOnMonth2)}>? Month</option>
|
||||
<option value="January" ${selected(fr, "yearly_on_month2", "January", $reminder.yearlyOnMonth2)}>January</option>
|
||||
<option value="Febuary" ${selected(fr, "yearly_on_month2", "Febuary", $reminder.yearlyOnMonth2)}>Febuary</option>
|
||||
<option value="March" ${selected(fr, "yearly_on_month2", "March", $reminder.yearlyOnMonth2)}>March</option>
|
||||
<option value="April" ${selected(fr, "yearly_on_month2", "April", $reminder.yearlyOnMonth2)}>April</option>
|
||||
<option value="May" ${selected(fr, "yearly_on_month2", "May", $reminder.yearlyOnMonth2)}>May</option>
|
||||
<option value="June" ${selected(fr, "yearly_on_month2", "June", $reminder.yearlyOnMonth2)}>June</option>
|
||||
<option value="July" ${selected(fr, "yearly_on_month2", "July", $reminder.yearlyOnMonth2)}>July</option>
|
||||
<option value="August" ${selected(fr, "yearly_on_month2", "August", $reminder.yearlyOnMonth2)}>August</option>
|
||||
<option value="September" ${selected(fr, "yearly_on_month2", "September", $reminder.yearlyOnMonth2)}>September</option>
|
||||
<option value="October" ${selected(fr, "yearly_on_month2", "October", $reminder.yearlyOnMonth2)}>October</option>
|
||||
<option value="November" ${selected(fr, "yearly_on_month2", "November", $reminder.yearlyOnMonth2)}>November</option>
|
||||
<option value="December" ${selected(fr, "yearly_on_month2", "December", $reminder.yearlyOnMonth2)}>December</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<br>
|
||||
<div class="text-end">
|
||||
<button class="btn-grn mt-3 mr-4" type="submit" form="reminder-update">Save</button>
|
||||
</div>
|
||||
</form><br><br>
|
||||
|
||||
<div class="page-js">
|
||||
<script>
|
||||
|
||||
var monthlyOnDay = document.getElementById("monthly_on_day")
|
||||
var monthlyOnWeek = document.getElementById("monthly_on_week")
|
||||
var monthlyOnWeekday = document.getElementById("monthly_on_weekday")
|
||||
|
||||
function clear2ndMonthlyInputs() {
|
||||
if (monthlyOnDay.value != "") {
|
||||
monthlyOnWeek.value = ""
|
||||
monthlyOnWeekday.value = ""
|
||||
}
|
||||
}
|
||||
|
||||
function clear1rstMonthlyInputs() {
|
||||
if ((monthlyOnWeek.value != "") || (monthlyOnWeekday.value != "")) {
|
||||
monthlyOnDay.value = ""
|
||||
}
|
||||
}
|
||||
|
||||
var yearlyOnMonth = document.getElementById("yearly_on_month")
|
||||
var yearlyOnDay = document.getElementById("yearly_on_day")
|
||||
var yearlyOnWeek = document.getElementById("yearly_on_week")
|
||||
var yearlyOnWeekday = document.getElementById("yearly_on_weekday")
|
||||
var yearlyOnMonth2 = document.getElementById("yearly_on_month2")
|
||||
|
||||
function clear2ndYearlyInputs() {
|
||||
if ((yearlyOnMonth.value != "") || (yearlyOnDay.value != "")) {
|
||||
yearlyOnWeek.value = ""
|
||||
yearlyOnWeekday.value = ""
|
||||
yearlyOnMonth2.value = ""
|
||||
}
|
||||
}
|
||||
|
||||
function clear1rstYearlyInputs() {
|
||||
if ((yearlyOnWeek.value != "") || (yearlyOnWeekday.value != "") || (yearlyOnMonth2.value != "")) {
|
||||
yearlyOnMonth.value = ""
|
||||
yearlyOnDay.value = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function useTitleForSubject() {
|
||||
let title = document.getElementById("title")
|
||||
let subject = document.getElementById("subject")
|
||||
subject.value = title.value
|
||||
}
|
||||
function showDivIfChecked(divId, elId) {
|
||||
let div = document.getElementById(divId);
|
||||
let el = document.getElementById(elId);
|
||||
if (el.checked == true) {
|
||||
div.classList.remove("hidden");
|
||||
} else {
|
||||
div.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
function hideAllInClassGroup(classGroup) {
|
||||
let allDivs = document.getElementsByClassName(classGroup)
|
||||
Array.from(allDivs).forEach(allDiv => {
|
||||
allDiv.classList.add("hidden");
|
||||
});
|
||||
}
|
||||
function showDivFromClassGroupIfChecked(divId, elId, classGroup) {
|
||||
let div = document.getElementById(divId);
|
||||
let el = document.getElementById(elId);
|
||||
let allDivs = document.getElementsByClassName(classGroup)
|
||||
if (el.checked == true) {
|
||||
div.classList.remove("hidden");
|
||||
Array.from(allDivs).forEach(allDiv => {
|
||||
if (allDiv.id != divId) {
|
||||
allDiv.classList.add("hidden");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
showDivIfChecked('repeat_freq', 'repeats')
|
||||
let dayRadio = document.getElementById("repeat_freq_day")
|
||||
if (dayRadio.checked == true) {
|
||||
hideAllInClassGroup("conditional_divs")
|
||||
}
|
||||
showDivFromClassGroupIfChecked('weekly_on', 'repeat_freq_week', 'conditional_divs')
|
||||
showDivFromClassGroupIfChecked('monthly_on', 'repeat_freq_month', 'conditional_divs')
|
||||
showDivFromClassGroupIfChecked('yearly_on', 'repeat_freq_year', 'conditional_divs')
|
||||
</script>
|
||||
</div>
|
||||
${mainTemplateBottom()}
|
||||
#end proc
|
||||
44
templates/reminders.nimf
Normal file
44
templates/reminders.nimf
Normal file
@@ -0,0 +1,44 @@
|
||||
#? stdtmpl(subsChar = '$', metaChar = '#')
|
||||
#import "../helpers/global", "../helpers/form", "../helpers/auth", "../models/reminder"
|
||||
#import "main_template_top.nimf", "main_template_bottom.nimf"
|
||||
#proc remindersTemplate*(allReminders: seq[Reminder], csrfToken: string, fr: FormResult): string =
|
||||
# result = ""
|
||||
${mainTemplateTop("Upcoming Reminders",csrfToken)}
|
||||
<div class="text-center">
|
||||
<span class="text-2xl">Upcoming Reminders</span><a href="/create-reminder" class="a-btn-grn ml-8">+ New Reminder</a>
|
||||
</div>
|
||||
#if allReminders.len > 0:
|
||||
<div class="mt-8 flex flex-row p-2 border-b border-indigo-400">
|
||||
<div class="basis-2/4"><span class="text-xl">Title</span></div>
|
||||
<div class="basis-1/12"><span class="text-xl">Repeats?</span></div>
|
||||
<div class="basis-1/4"><span class="text-xl">Next Send Date</span></div>
|
||||
<div class="basis-1/4"><span class="text-xl">Actions</span></div>
|
||||
</div>
|
||||
#else:
|
||||
<br><br><h2 class="text-lg text-orange-400">You don't have any Reminders yet.</h2>
|
||||
#end if
|
||||
#for reminder in allReminders:
|
||||
<div class="flex flex-row p-2">
|
||||
<div class="basis-2/4"><span class="text-lg">${reminder.title}</span></div>
|
||||
<div class="basis-1/12"><span class="text-lg">
|
||||
#if reminder.repeats == 0:
|
||||
No
|
||||
#else:
|
||||
Yes
|
||||
#end if
|
||||
</span></div>
|
||||
<div class="basis-1/4"><span class="text-lg">${reminder.sendDate}</span></div>
|
||||
<div class="basis-1/4">
|
||||
<span><a href="/reminder/${reminder.id}/update" class="a-btn-grn">View/Edit</a></span>
|
||||
<form method="POST" action="/reminder/delete" accept-charset="utf-8" class="inline">
|
||||
<input type="hidden" name="csrf_token" value="${csrfToken}">
|
||||
<input type="hidden" name="reminder_id" value="${reminder.id}" />
|
||||
<button class="btn-red" type="submit"><span class="help-text" title="Delete the Reminder. Warning! Will not ask for confirmation.">Delete</span></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
#end for
|
||||
|
||||
<div class="page-js"></div>
|
||||
${mainTemplateBottom()}
|
||||
#end proc
|
||||
Reference in New Issue
Block a user