-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathview.html.twig
374 lines (352 loc) · 15.2 KB
/
view.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
{% extends 'sidebar.html.twig' %}
{% import 'flash/utilities.html.twig' as flashes %}
{% import 'time/partials.html.twig' as time %}
{% import 'components/autocomplete.html.twig' as autocomplete %}
{% block content_class %}w-100{% endblock %}
{% block turbo %}false{% endblock %}
{% block title %}Task: {{ task.name }}{% endblock %}
{% block content_body %}
<div
{{ stimulus_controller('task-page-bridge') }}
class="resource js-data"
data-duration-format="{{ app.user.durationFormat }}"
data-task-id="{{ task.idString }}">
{% if task.deleted %}
{{ flashes.deleted_warning('This task has been deleted') }}
{% endif %}
<div class="js-breadcrumbs">
{{ include('task/partials/_breadcrumbs.html.twig', {tasks: task.lineage}) }}
</div>
{{ form_start(form) }}
{{ form_row(form.name) }}
{{ form_row(form.parentTask, {
attr: {class: 'd-none'},
label_attr: {class: 'd-none'}
})}}
{% set taskName = '' %}
{% if task.parent %}
{% set taskName = task.parent.name %}
{% endif %}
<label class="d-block form-label">Parent Task</label>
{{ autocomplete.removable('task', { button: { class: 'bg-weak-white btn-outline-danger'}, search: { value: taskName, placeholder: 'task name' } }) }}
<label class="d-block form-label mt-3">Tags</label>
<div class="mt-2 d-flex align-items-center">
<div
{{ stimulus_controller('sync-tag-list', {
addUrl: path('json_task_tag_create', {id: task.idString}),
removeUrl: path('json_task_tag_delete', {id: task.idString, tagName: '{NAME}'})
}) }}
class="tag-list tag-list-autocomplete"
data-action="autocomplete.change@window->sync-tag-list#requestAddFromAutocomplete removable-tag:remove->sync-tag-list#removeTag">
{% for tag in task.tags %}
{{ include('tag/partials/_removable-tag.html.twig', { tag: tag}) }}
{% endfor %}
</div>
{{ autocomplete.addTag('task') }}
</div>
<div class="mt-3">
{{ form_row(form.template) }}
</div>
<div class="mt-3">
{{ form_row(form.active) }}
</div>
{{ form_row(form.priority) }}
{{ form_row(form.timeEstimate) }}
{{ form_label(form.completedAt, null, {label_attr: {class: 'd-block mt-3'}}) }}
<div {{ stimulus_controller('clear-value') }}
class="d-inline-flex">
{{ form_widget(form.completedAt, {attr: {'data-clear-value-target': 'clearable'}}) }}
<button
type="button"
class="btn btn-danger ms-2"
data-action="clear-value#clear">
<i class="fas fa-trash"></i>
</button>
</div>
{{ form_label(form.dueAt, null, {label_attr: {class: 'd-block mt-3'}}) }}
<div {{ stimulus_controller('clear-value') }}
class="d-inline-flex">
{{ form_widget(form.dueAt, {attr: {'data-clear-value-target': 'clearable'}}) }}
<button
type="button"
class="btn btn-danger ms-2"
data-action="clear-value#clear">
<i class="fas fa-trash"></i>
</button>
</div>
<div class="js-task-time-entry border rounded shadow-sm mt-3">
<div class="js-content d-flex align-items-center p-2">
<div class="d-inline-flex input-with-indicators flex-grow-1">
<div class="input-indicator input-indicator-left d-flex">
<div class="spinner-border spinner-border-sm text-primary js-loading d-none" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
<input class="form-control js-time-entry-description no-resize left" placeholder="Entry description" />
</div>
<div class="js-duration ms-1">{{ time.user_duration(zeroDuration(), app.user) }}</div>
<button type="button" class="btn btn-primary ms-2">
<span class="js-task-time-entry-loading spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
<span class="js-task-time-entry-loading visually-hidden">Loading...</span>
<span class="js-text"></span>
</button>
</div>
</div>
<ul class="nav nav-tabs mt-3" id="description-tab" role="tablist">
<li class="nav-item" role="presentation">
<button
id="activity-tab"
type="button"
class="nav-link active activity-link"
data-bs-target="#activity"
role="tab"
aria-controls="home"
aria-selected="true"
{{ stimulus_controller('bootstrap-tab') }}
{{ stimulus_action('bootstrap-tab', 'activateTab') }}
>
Activity
</button>
</li>
<li class="nav-item" role="presentation">
<button
id="activity-tab"
type="button"
class="nav-link activity-link"
data-bs-toggle="tab"
data-bs-target="#subtasks"
role="tab"
aria-controls="home"
aria-selected="true"
{{ stimulus_controller('bootstrap-tab') }}
{{ stimulus_action('bootstrap-tab', 'activateTab') }}
>
Subtasks
</button>
</li>
<li class="nav-item" role="presentation">
<button
id="home-tab"
type="button"
class="nav-link markdown-link"
data-bs-target="#markdown"
role="tab"
aria-controls="home"
aria-selected="true"
{{ stimulus_controller('bootstrap-tab') }}
{{ stimulus_action('bootstrap-tab', 'activateTab') }}
>
<span
{{ stimulus_controller('toggle-class', {
className: 'd-none',
key: task.idString
}) }}
data-action="upload-field:update:start@window->toggle-class#remove upload-field:update:finish@window->toggle-class#add"
class="me-1 d-none">
<i class="fas fa-sync-alt fa-spin"></i>
</span>
Description
</button>
</li>
<li class="nav-item" role="presentation">
<button
id="markdown-tab"
type="button"
class="nav-link"
data-bs-target="#preview"
role="tab"
aria-controls="profile"
aria-selected="false"
{{ stimulus_controller('bootstrap-tab') }}
{{ stimulus_action('bootstrap-tab', 'activateTab') }}
>
Preview
</button>
</li>
<li class="nav-item" role="presentation">
<button
id="details-tab"
type="button"
class="nav-link"
data-bs-target="#details"
role="tab"
aria-selected="false"
{{ stimulus_controller('bootstrap-tab') }}
{{ stimulus_action('bootstrap-tab', 'activateTab') }}
>
Details
</button>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active contained task-activity" id="activity" role="tabpanel" aria-labelledby="activity-tab">
<div class="total-time js-total-time">
<strong>Total Time:</strong>
<span class="js-value"></span>
<div class="js-loading spinner-border spinner-border-sm text-primary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<hr/>
</div>
<div class="js-task-time-entry-activity mt-3">
</div>
</div>
<div id="markdown" class="tab-pane fade markdown-input" role="tabpanel" aria-labelledby="markdown-tab">
{{ form_widget(form.description, {
attr: {
rows: 10,
class: 'js-description border-top-0',
'data-controller': 'upload-field',
'data-action': 'upload-field#update',
'data-upload-field-key-value': task.idString,
'data-upload-field-field-name-value': 'description',
'data-upload-field-url-value': path('json_task_update', {id: task.idString} )
}})
}}
</div>
<div id="preview" class="tab-pane fade contained markdown-preview" role="tabpanel" aria-labelledby="profile-tab">
<div
id="preview-content"
{{ stimulus_controller('markdown-updater', {
field: 'value',
key: task.idString
}) }}
data-action="upload-field:update:finish@window->markdown-updater#convert">
{{ task.description|markdown_to_html }}
</div>
</div>
<div class="tab-pane fade contained" id="subtasks" role="tabpanel" aria-labelledby="subtasks-tab">
<div class="p-2">
<div class="inline-form-header mb-2">Add subtask</div>
<div class="js-task-create row g-2">
<div class="col">
<label class="visually-hidden" for="create-task-name">New task name</label>
<input
id="create-task-name"
type="text"
class="form-control js-name"
autocomplete="off"
placeholder="What do you want to achieve?"
/>
</div>
<div class="col-auto">
<button type="button" class="btn btn-primary js-button js-loading-button">
<span class="js-loading spinner-border spinner-border-sm d-none" role="status" aria-hidden="true"></span>
<span class="js-loading visually-hidden">Loading...</span>
<span class="js-text">Create task</span>
</button>
</div>
</div>
<div class="stack-list task-list js-task-list mt-2 mb-2">
{% for subtask in subtasks %}
{{ include('task/partials/_task.html.twig', {task: subtask }) }}
{% else %}
<div class="text-center mt-2 mb-2 js-no-tasks">No subtasks</div>
{% endfor %}
</div>
</div>
</div>
<div class="tab-pane fade bg-white" id="details" role="tabpanel" aria-labelledby="details-tab">
<table class="table table-hover table-bordered">
<thead>
<tr class="border-top-0">
<th class="border-top-0">Type</th>
<th class="border-top-0">Timestamp</th>
</tr>
</thead>
<tbody>
<tr>
<td>Created</td>
<td>{{ time.user_datetime(task.createdAt, app.user) }}</td>
</tr>
<tr>
<td>Updated</td>
<td>{{ time.user_datetime(task.updatedAt, app.user) }}</td>
</tr>
</tbody>
</table>
</div>
</div>
{{ form_widget(form) }}
<div class="d-flex mt-3">
{% if not task.deleted %}
<button type="submit" class="btn btn-primary">Update</button>
{% if task.completed %}
<a href="{{ path('task_complete', {id: task.id, value: 'uncomplete'}) }}" class="btn btn-secondary ms-2">Uncomplete</a>
{% elseif task.template %}
<span
{{ stimulus_controller('bootstrap-tooltip') }}
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Can not complete template tasks">
<a
href="{{ path('task_complete', {id: task.id, value: 'complete'}) }}"
role="button"
class="btn btn-secondary ms-2 disabled"
tabindex="-1"
aria-disabled="true"
>
Complete
</a>
</span>
{% else %}
<a
href="{{ path('task_complete', {id: task.id, value: 'complete'}) }}"
role="button"
class="btn btn-secondary ms-2"
>
Complete
</a>
{% endif %}
{% if task.closed %}
<a href="{{ path('task_close', {id: task.id, value: 'open'}) }}" class="btn btn-warning ms-2">Re-open</a>
{% elseif task.template %}
<span
{{ stimulus_controller('bootstrap-tooltip') }}
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Can not close template tasks">
<a
href="{{ path('task_close', {id: task.id, value: 'close'}) }}"
class="btn btn-warning ms-2 disabled"
role="button"
tabindex="-1"
aria-disabled="true"
>
Close
</a>
</span>
{% else %}
<a href="{{ path('task_close', {id: task.id, value: 'close'}) }}" class="btn btn-warning ms-2">Close</a>
{% endif %}
<button
type="button"
class="btn btn-danger ms-2"
data-bs-toggle="modal"
data-bs-target="#delete-modal">
Delete
</button>
{% endif %}
</div>
{{ form_end(form) }}
</div>
<!-- Delete modal -->
<div class="modal fade" id="delete-modal" tabindex="-1" aria-labelledby="delete-modal-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="delete-modal-label">Are you sure you want to delete?</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
</button>
</div>
<div class="modal-body">
This will delete the task and all of it's children
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<a href="{{ path('task_delete', {id: task.id}) }}" class="btn btn-danger">Delete</a>
</div>
</div>
</div>
</div>
{% endblock %}