Show tasks as read-only when user has no PUT access.

Still pretty rough. Most importantly, users are shown as hashes rather
than their names.
This commit is contained in:
2016-10-11 14:16:30 +02:00
parent 73f19ef29a
commit cc59c029b0

View File

@@ -2,14 +2,19 @@
class="status-{{ task.properties.status }}") class="status-{{ task.properties.status }}")
form#task_form(onsubmit="return task_save('{{task._id}}', '{{ url_for('attract.tasks.perproject.save', project_url=project['url'], task_id=task._id) }}')") form#task_form(onsubmit="return task_save('{{task._id}}', '{{ url_for('attract.tasks.perproject.save', project_url=project['url'], task_id=task._id) }}')")
input(type='hidden',name='_etag',value='{{ task._etag }}') input(type='hidden',name='_etag',value='{{ task._etag }}')
//- NOTE: if you add fields here, also add them read-only below.
.input-transparent-group .input-transparent-group
| {% if 'PUT' in task.allowed_methods %}
input.input-transparent.item-name( input.input-transparent.item-name(
name="name", name="name",
type="text", type="text",
placeholder='Name', placeholder='Name',
value="{{ task.name | hide_none }}") value="{{ task.name | hide_none }}")
| {% else %}
h2 {{ task.name | hide_none }}
| {% endif %}
.dropdown .dropdown(style='margin-left: auto')
button#item-dropdown.btn.btn-default.dropdown-toggle( button#item-dropdown.btn.btn-default.dropdown-toggle(
type='button', type='button',
data-toggle='dropdown', data-toggle='dropdown',
@@ -28,6 +33,7 @@
| Delete Task | Delete Task
| {% endif %} | {% endif %}
| {% if 'PUT' in task.allowed_methods %}
.input-transparent-group .input-transparent-group
textarea.input-transparent( textarea.input-transparent(
name="description", name="description",
@@ -67,17 +73,28 @@
| <option value="{{ u._id }}" {% if u._id in task.properties.assigned_to['users'] %}selected{% endif %}>{{ u.full_name }}</option> | <option value="{{ u._id }}" {% if u._id in task.properties.assigned_to['users'] %}selected{% endif %}>{{ u.full_name }}</option>
| {% endfor %} | {% endfor %}
| {% if 'PUT' in task.allowed_methods %}
.input-group-separator .input-group-separator
.input-transparent-group .input-transparent-group
button.btn.btn-default.btn-block(type='submit') button.btn.btn-default.btn-block(type='submit')
i.pi-check i.pi-check
| Save Task | Save Task
| {% else %}
//- NOTE: read-only versions of the fields above.
p {{ task.description | hide_none }}
dl.dl-horizontal.item-properties
dt Type:
dd {{ task.properties.task_type | undertitle }}
dt Status:
dd {{ task.properties.status | undertitle }}
dt Assignees:
| {% for u in task.properties.assigned_to['users'] %}
dd {{ u }}
| {% else %}
dd not assigned
| {% endfor %}
| {% endif %} | {% endif %}
#item-view-feed #item-view-feed
| Task updated {{ task._updated | pretty_date }} | Task updated {{ task._updated | pretty_date }}
| {% if config.DEBUG %} | {% if config.DEBUG %}