add social battery sorting engine
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
aria-label="Mark {{ task.title }} as {{ task.isActive ? 'completed' : 'active' }}"
|
||||
hx-post="{{ path('app_task_toggle_completion', {'id': task.id}) }}"
|
||||
hx-include="closest form"
|
||||
hx-target="closest .task-list__item"
|
||||
hx-target="closest .task-list"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
<label class="task-list__toggle" for="task-completion-{{ task.id }}" title="Mark {{ task.title }} as {{ task.isActive ? 'completed' : 'active' }}">
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<ul id="task-list" class="task-list" aria-label="Tasks">
|
||||
{% for task in tasks %}
|
||||
{{ include('task/_task_item.html.twig', {task: task}) }}
|
||||
{% else %}
|
||||
<li class="task-list__empty">No tasks yet.</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
@@ -0,0 +1,39 @@
|
||||
<div id="task-recommendations">
|
||||
{% set battery_levels = {
|
||||
1: ['Low', 'battery_0_bar'],
|
||||
2: ['Steady', 'battery_2_bar'],
|
||||
3: ['Okay', 'battery_3_bar'],
|
||||
4: ['Good', 'battery_5_bar'],
|
||||
5: ['Full', 'battery_full']
|
||||
} %}
|
||||
<section class="social-battery" aria-labelledby="social-battery-title">
|
||||
<div>
|
||||
<h2 id="social-battery-title">Social battery</h2>
|
||||
<p>Choose today’s energy. We’ll put tasks that fit your {{ battery_budget }}-minute budget first.</p>
|
||||
</div>
|
||||
<form class="social-battery__levels">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('social_battery') }}">
|
||||
{% for level, option in battery_levels %}
|
||||
<input
|
||||
id="social-battery-{{ level }}"
|
||||
class="social-battery__input"
|
||||
type="radio"
|
||||
name="social_battery"
|
||||
value="{{ level }}"
|
||||
{{ battery_level == level ? 'checked' : '' }}
|
||||
aria-label="{{ option[0] }} energy"
|
||||
hx-post="{{ path('app_task_social_battery') }}"
|
||||
hx-include="closest form"
|
||||
hx-target="#task-recommendations"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
<label for="social-battery-{{ level }}" title="{{ option[0] }} energy">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ option[1] }}</span>
|
||||
<span class="visually-hidden">{{ option[0] }} energy</span>
|
||||
</label>
|
||||
{% endfor %}
|
||||
</form>
|
||||
</section>
|
||||
|
||||
{{ include('task/_task_list.html.twig', {tasks: tasks}) }}
|
||||
</div>
|
||||
@@ -11,13 +11,11 @@ add
|
||||
</span></a>
|
||||
</div>
|
||||
|
||||
<ul class="task-list" aria-label="Tasks">
|
||||
{% for task in tasks %}
|
||||
{{ include('task/_task_item.html.twig', {task: task}) }}
|
||||
{% else %}
|
||||
<li class="task-list__empty">No tasks yet.</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{{ include('task/_task_recommendations.html.twig', {
|
||||
tasks: tasks,
|
||||
battery_level: battery_level,
|
||||
battery_budget: battery_budget
|
||||
}) }}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user