Add first day of the week feature to user settings and calendar functionality
This commit is contained in:
parent
39f5b968b4
commit
fdbf2e4f27
15 changed files with 191 additions and 42 deletions
|
|
@ -1,5 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ context.tr.current_lang_and_territory_code() }}" data-user-logged="{{ context.user.is_some() }}" >
|
||||
<html lang="{{ context.tr.current_lang_and_territory_code() }}"
|
||||
data-user-logged="{{ context.user.is_some() }}"
|
||||
data-user-first-day-of-the-week="{{ context.first_day_of_the_week().to_string() }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
</div>
|
||||
|
||||
<ul class="weekdays">
|
||||
{% for day in [
|
||||
{% let day_names = [
|
||||
Sentence::CalendarMondayAbbreviation,
|
||||
Sentence::CalendarTuesdayAbbreviation,
|
||||
Sentence::CalendarWednesdayAbbreviation,
|
||||
|
|
@ -34,9 +34,16 @@
|
|||
Sentence::CalendarFridayAbbreviation,
|
||||
Sentence::CalendarSaturdayAbbreviation,
|
||||
Sentence::CalendarSundayAbbreviation,
|
||||
] %}
|
||||
<li class="weekday">{{ context.tr.t(*day) }}</li>
|
||||
] %}
|
||||
|
||||
{% for i in 0..7 %}
|
||||
<li class="weekday">
|
||||
{{ context.tr.t(*day_names[
|
||||
(i + context.first_day_of_the_week().num_days_from_monday() as usize) % 7
|
||||
]) }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
|
||||
<ul class="days">
|
||||
|
|
|
|||
|
|
@ -26,6 +26,14 @@
|
|||
autocapitalize="none" autocomplete="email" autofocus="autofocus">
|
||||
<span class="user-message">{{ message_email }}</span>
|
||||
|
||||
<label for="input-password-1">{{ context.tr.tp(Sentence::ProfileNewPassword, [Box::new(common::consts::MIN_PASSWORD_SIZE)]) }}</label>
|
||||
<input id="input-password-1" type="password" name="password_1" autocomplete="new-password">
|
||||
<span></span>
|
||||
|
||||
<label for="input-password-2">{{ context.tr.t(Sentence::ReEnterPassword) }}</label>
|
||||
<input id="input-password-2" type="password" name="password_2" autocomplete="new-password">
|
||||
<span class="user-message">{{ message_password }}</span>
|
||||
|
||||
<label for="input-servings">{{ context.tr.t(Sentence::ProfileDefaultServings) }}</label>
|
||||
<input
|
||||
id="input-servings"
|
||||
|
|
@ -35,13 +43,30 @@
|
|||
value="{{ default_servings }}">
|
||||
<span></span>
|
||||
|
||||
<label for="input-password-1">{{ context.tr.tp(Sentence::ProfileNewPassword, [Box::new(common::consts::MIN_PASSWORD_SIZE)]) }}</label>
|
||||
<input id="input-password-1" type="password" name="password_1" autocomplete="new-password">
|
||||
<span></span>
|
||||
|
||||
<label for="input-password-2">{{ context.tr.t(Sentence::ReEnterPassword) }}</label>
|
||||
<input id="input-password-2" type="password" name="password_2" autocomplete="new-password">
|
||||
<span class="user-message">{{ message_password }}</span>
|
||||
<label for="input-first-day-of-week">{{ context.tr.t(Sentence::ProfileFirstDayOfWeek) }}</label>
|
||||
<select id="input-first-day-of-week" name="first_day_of_the_week">
|
||||
<option value="Mon"
|
||||
{%~ if user.first_day_of_the_week == chrono::Weekday::Mon %}
|
||||
selected
|
||||
{% endif %}
|
||||
>
|
||||
{{ context.tr.t(Sentence::CalendarMonday) }}
|
||||
</option>
|
||||
<option value="Sat"
|
||||
{%~ if user.first_day_of_the_week == chrono::Weekday::Sat %}
|
||||
selected
|
||||
{% endif %}
|
||||
>
|
||||
{{ context.tr.t(Sentence::CalendarSaturday) }}
|
||||
</option>
|
||||
<option value="Sun"
|
||||
{%~ if user.first_day_of_the_week == chrono::Weekday::Sun %}
|
||||
selected
|
||||
{% endif %}
|
||||
>
|
||||
{{ context.tr.t(Sentence::CalendarSunday) }}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<input type="submit" name="commit" value="{{ context.tr.t(Sentence::Save) }}">
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue