mirror of https://github.com/snachodog/mybuddy.git
Add permissions checks to frontend.
This commit is contained in:
parent
3bbfd012f4
commit
d89fa9df11
|
@ -31,26 +31,58 @@
|
||||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
<li class="nav-item{% if request.path == '/' %} active{% endif %}">
|
<li class="nav-item{% if request.path == '/' %} active{% endif %}">
|
||||||
<a class="nav-link" href="{% url 'index' %}"><i class="fa fa-dashboard" aria-hidden="true"></i> Dashboard</a>
|
<a class="nav-link" href="{% url 'index' %}">
|
||||||
</li>
|
<i class="fa fa-dashboard" aria-hidden="true"></i> Dashboard
|
||||||
<li class="nav-item{% if request.path == '/children/' %} active{% endif %}">
|
</a>
|
||||||
<a class="nav-link" href="{% url 'child-list' %}"><i class="fa fa-child" aria-hidden="true"></i> Children</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item{% if request.path == '/changes/' %} active{% endif %}">
|
|
||||||
<a class="nav-link" href="{% url 'diaperchange-list' %}"><i class="fa fa-trash" aria-hidden="true"></i> Changes</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item{% if request.path == '/feedings/' %} active{% endif %}">
|
|
||||||
<a class="nav-link" href="{% url 'feeding-list' %}"><i class="fa fa-spoon" aria-hidden="true"></i> Feedings</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item{% if request.path == '/sleep/' %} active{% endif %}">
|
|
||||||
<a class="nav-link" href="{% url 'sleep-list' %}"><i class="fa fa-bed" aria-hidden="true"></i> Sleep</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item{% if request.path == '/tummy-time/' %} active{% endif %}">
|
|
||||||
<a class="nav-link" href="{% url 'tummytime-list' %}"><i class="fa fa-smile-o" aria-hidden="true"></i> Tummy Time</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item{% if request.path == '/notes/' %} active{% endif %}">
|
|
||||||
<a class="nav-link" href="{% url 'note-list' %}"><i class="fa fa-sticky-note" aria-hidden="true"></i> Notes</a>
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
{% if perms.core.view_child %}
|
||||||
|
<li class="nav-item{% if request.path == '/children/' %} active{% endif %}">
|
||||||
|
<a class="nav-link" href="{% url 'child-list' %}">
|
||||||
|
<i class="fa fa-child" aria-hidden="true"></i> Children
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.view_diaperchange %}
|
||||||
|
<li class="nav-item{% if request.path == '/changes/' %} active{% endif %}">
|
||||||
|
<a class="nav-link" href="{% url 'diaperchange-list' %}">
|
||||||
|
<i class="fa fa-trash" aria-hidden="true"></i> Changes
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.view_feeding %}
|
||||||
|
<li class="nav-item{% if request.path == '/feedings/' %} active{% endif %}">
|
||||||
|
<a class="nav-link" href="{% url 'feeding-list' %}">
|
||||||
|
<i class="fa fa-spoon" aria-hidden="true"></i> Feedings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.view_sleep %}
|
||||||
|
<li class="nav-item{% if request.path == '/sleep/' %} active{% endif %}">
|
||||||
|
<a class="nav-link" href="{% url 'sleep-list' %}">
|
||||||
|
<i class="fa fa-bed" aria-hidden="true"></i> Sleep
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.view_tummytime %}
|
||||||
|
<li class="nav-item{% if request.path == '/tummy-time/' %} active{% endif %}">
|
||||||
|
<a class="nav-link" href="{% url 'tummytime-list' %}">
|
||||||
|
<i class="fa fa-smile-o" aria-hidden="true"></i> Tummy Time
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.view_note %}
|
||||||
|
<li class="nav-item{% if request.path == '/notes/' %} active{% endif %}">
|
||||||
|
<a class="nav-link" href="{% url 'note-list' %}">
|
||||||
|
<i class="fa fa-sticky-note" aria-hidden="true"></i> Notes
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -60,11 +92,15 @@
|
||||||
<div class="col-lg-8 mb-4">
|
<div class="col-lg-8 mb-4">
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-2">
|
{% if perms.core.view_timer %}
|
||||||
<h1>Timers</h1>
|
<div class="col-lg-2">
|
||||||
{% add_timer request.path %}
|
<h1>Timers</h1>
|
||||||
{% list_timers %}
|
{% if perms.core.add_timer %}
|
||||||
</div>
|
{% add_timer request.path %}
|
||||||
|
{% endif %}
|
||||||
|
{% list_timers %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,24 @@
|
||||||
{% for child in object_list %}
|
{% for child in object_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ child.id }}</th>
|
<th scope="row">{{ child.id }}</th>
|
||||||
<td><a href="{% url 'child-update' child.id %}">{{ child.first_name }}</a></td>
|
<td>{{ child.first_name }}</td>
|
||||||
<td>{{ child.last_name }}</td>
|
<td>{{ child.last_name }}</td>
|
||||||
<td>{{ child.birth_date }}</td>
|
<td>{{ child.birth_date }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||||
<a href="{% url 'child-update' child.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
|
||||||
<a href="{% url 'child-delete' child.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
{% if perms.core.change_child %}
|
||||||
|
<a href="{% url 'child-update' child.id %}" class="btn btn-primary">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.delete_child %}
|
||||||
|
<a href="{% url 'child-delete' child.id %}" class="btn btn-danger">
|
||||||
|
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -38,5 +49,11 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<a href="{% url 'child-add' %}" class="btn btn-sm btn-success"><i class="fa fa-child" aria-hidden="true"></i> Add a Child</a>
|
|
||||||
|
{% if perms.core.add_child %}
|
||||||
|
<a href="{% url 'child-add' %}" class="btn btn-sm btn-success">
|
||||||
|
<i class="fa fa-child" aria-hidden="true"></i> Add a Child
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -29,8 +29,19 @@
|
||||||
<td>{{ change.color }}</td>
|
<td>{{ change.color }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||||
<a href="{% url 'diaperchange-update' change.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
|
||||||
<a href="{% url 'diaperchange-delete' change.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
{% if perms.core.change_diaperchange %}
|
||||||
|
<a href="{% url 'diaperchange-update' change.id %}" class="btn btn-primary">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.delete_diaperchange %}
|
||||||
|
<a href="{% url 'diaperchange-delete' change.id %}" class="btn btn-danger">
|
||||||
|
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -42,5 +53,11 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<a href="{% url 'diaperchange-add' %}" class="btn btn-sm btn-success"><i class="fa fa-trash" aria-hidden="true"></i> Add a Change</a>
|
|
||||||
|
{% if perms.core.add_diaperchange %}
|
||||||
|
<a href="{% url 'diaperchange-add' %}" class="btn btn-sm btn-success">
|
||||||
|
<i class="fa fa-trash" aria-hidden="true"></i> Add a Change
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -31,8 +31,19 @@
|
||||||
<td>{{ feeding.amount }}</td>
|
<td>{{ feeding.amount }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||||
<a href="{% url 'feeding-update' feeding.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
|
||||||
<a href="{% url 'feeding-delete' feeding.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
{% if perms.core.change_feeding %}
|
||||||
|
<a href="{% url 'feeding-update' feeding.id %}" class="btn btn-primary">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.delete_feeding %}
|
||||||
|
<a href="{% url 'feeding-delete' feeding.id %}" class="btn btn-danger">
|
||||||
|
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -44,5 +55,11 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<a href="{% url 'feeding-add' %}" class="btn btn-sm btn-success"><i class="fa fa-spoon" aria-hidden="true"></i> Add a Feeding</a>
|
|
||||||
|
{% if perms.core.add_feeding %}
|
||||||
|
<a href="{% url 'feeding-add' %}" class="btn btn-sm btn-success">
|
||||||
|
<i class="fa fa-spoon" aria-hidden="true"></i> Add a Feeding
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -25,8 +25,19 @@
|
||||||
<td>{{ note.time }}</td>
|
<td>{{ note.time }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||||
<a href="{% url 'note-update' note.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
|
||||||
<a href="{% url 'note-delete' note.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
{% if perms.core.change_note %}
|
||||||
|
<a href="{% url 'note-update' note.id %}" class="btn btn-primary">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.delete_note %}
|
||||||
|
<a href="{% url 'note-delete' note.id %}" class="btn btn-danger">
|
||||||
|
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -38,5 +49,11 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<a href="{% url 'note-add' %}" class="btn btn-sm btn-success"><i class="fa fa-sticky-note" aria-hidden="true"></i> Add a Note</a>
|
|
||||||
|
{% if perms.core.add_note %}
|
||||||
|
<a href="{% url 'note-add' %}" class="btn btn-sm btn-success">
|
||||||
|
<i class="fa fa-sticky-note" aria-hidden="true"></i> Add a Note
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -27,8 +27,19 @@
|
||||||
<td>{{ sleep.duration }}</td>
|
<td>{{ sleep.duration }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||||
<a href="{% url 'sleep-update' sleep.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
|
||||||
<a href="{% url 'sleep-delete' sleep.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
{% if perms.core.change_sleep %}
|
||||||
|
<a href="{% url 'sleep-update' sleep.id %}" class="btn btn-primary">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.delete_sleep %}
|
||||||
|
<a href="{% url 'sleep-delete' sleep.id %}" class="btn btn-danger">
|
||||||
|
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -40,5 +51,11 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<a href="{% url 'sleep-add' %}" class="btn btn-sm btn-success"><i class="fa fa-bed" aria-hidden="true"></i> Add a Sleep Entry</a>
|
|
||||||
|
{% if perms.core.add_sleep %}
|
||||||
|
<a href="{% url 'sleep-add' %}" class="btn btn-sm btn-success">
|
||||||
|
<i class="fa fa-bed" aria-hidden="true"></i> Add a Sleep Entry
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -29,8 +29,19 @@
|
||||||
<td>{{ tummytime.milestone }}</td>
|
<td>{{ tummytime.milestone }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||||
<a href="{% url 'tummytime-update' tummytime.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
|
||||||
<a href="{% url 'tummytime-delete' tummytime.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
{% if perms.core.change_tummytime %}
|
||||||
|
<a href="{% url 'tummytime-update' tummytime.id %}" class="btn btn-primary">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if perms.core.delete_tummytime %}
|
||||||
|
<a href="{% url 'tummytime-delete' tummytime.id %}" class="btn btn-danger">
|
||||||
|
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -42,5 +53,9 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<a href="{% url 'tummytime-add' %}" class="btn btn-sm btn-success"><i class="fa fa-smile-o" aria-hidden="true"></i> Add a Tummy Time Entry</a>
|
|
||||||
|
{% if perms.core.add_tummytime %}
|
||||||
|
<a href="{% url 'tummytime-add' %}" class="btn btn-sm btn-success"><i class="fa fa-smile-o" aria-hidden="true"></i> Add a Tummy Time Entry</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -5,7 +5,7 @@
|
||||||
<h4 class="card-text">{{ timer.duration }}</h4>
|
<h4 class="card-text">{{ timer.duration }}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer text-muted small">
|
<div class="card-footer text-muted small">
|
||||||
Started {{ timer.start }}
|
{{ timer.start }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
Loading…
Reference in New Issue