CHANGE: First pass at opening up RIGS #233

Whilst it makes it something of a misnomer, the intent is to make the 'view_event' perm a permission to view event details like client/price. I don't see the point in giving everyone 'view_event' and adding a new 'view_event_detail'...Open to arguments the other way.
This commit is contained in:
2019-11-27 21:14:02 +00:00
parent 5210afc772
commit 30b323cd7b
5 changed files with 22 additions and 13 deletions

View File

@@ -10,12 +10,14 @@
| {{ object.name }} {% if event.dry_hire %}<span class="badge">Dry Hire</span>{% endif %}
</h1>
</div>
{% if perms.RIGS.view_event %}
<div class="col-sm-12 text-right">
{% include 'RIGS/event_detail_buttons.html' %}
</div>
{% endif %}
{% endif %}
{% if object.is_rig %}
{% if object.is_rig and perms.RIGS.view_event %}
{# only need contact details for a rig #}
<div class="col-sm-12 col-md-6 col-lg-5">
<div class="panel panel-default">
@@ -147,7 +149,7 @@
<dd>{{ object.collector }}</dd>
{% endif %}
{% if event.is_rig and not event.internal %}
{% if event.is_rig and not event.internal and perms.RIGS.view_event %}
<dd>&nbsp;</dd>
<dt>PO</dt>
<dd>{{ object.purchase_order }}</dd>
@@ -156,7 +158,7 @@
</div>
</div>
</div>
{% if event.is_rig and event.internal %}
{% if event.is_rig and event.internal and perms.RIGS.view_event %}
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Client Authorisation</div>
@@ -204,7 +206,7 @@
</div>
<div>
{% endif %}
{% if not request.is_ajax %}
{% if not request.is_ajax and perms.RIGS.view_event %}
<div class="col-sm-12 text-right">
{% include 'RIGS/event_detail_buttons.html' %}
</div>
@@ -214,15 +216,17 @@
<div class="panel panel-default">
<div class="panel-heading">Event Details</div>
<div class="panel-body">
{% if perms.RIGS.view_event %}
<div class="well well-sm">
<h4>Notes</h4>
{{ event.notes|linebreaksbr }}
</div>
{% endif %}
{% include 'RIGS/item_table.html' %}
</div>
</div>
</div>
{% if not request.is_ajax %}
{% if not request.is_ajax and perms.RIGS.view_event %}
<div class="col-sm-12 text-right">
{% include 'RIGS/event_detail_buttons.html' %}
</div>

View File

@@ -33,7 +33,7 @@
</td>
<td>
<h4>
<a {% if perms.RIGS.view_event %}href="{% url 'event_detail' event.pk %}" {% endif %}>
<a href="{% url 'event_detail' event.pk %}">
{{ event.name }}
</a>
{% if event.venue %}

View File

@@ -6,17 +6,19 @@
<em class="description">{{item.description|linebreaksbr}}</em>
</div>
</td>
{% if perms.RIGS.view_event %}
<td>£&nbsp;<span class="cost">{{item.cost|floatformat:2}}</span></td>
<td class="quantity">{{item.quantity}}</td>
<td>£&nbsp;<span class="sub-total" data-subtotal="{{item.total_cost}}">{{item.total_cost|floatformat:2}}</span></td>
{% endif %}
{% if edit %}
<td class="vert-align text-right">
<button type="button" class="item-edit btn btn-xs btn-default"
<button type="button" class="item-edit btn btn-xs btn-default"
data-pk="{{item.pk}}"
data-toggle="modal" data-target="#itemModal">
<span class="glyphicon glyphicon-edit"></span>
</button>
<button type="button" class="item-delete btn btn-xs btn-danger"
<button type="button" class="item-delete btn btn-xs btn-danger"
data-pk="{{item.pk}}">
<span class="glyphicon glyphicon-remove"></span>
</button>

View File

@@ -3,9 +3,11 @@
<thead>
<tr>
<td>Item</td>
{% if perms.RIGS.view_event %}
<td>Price</td>
<td>Quantity</td>
<td>Sub-total</td>
{% endif %}
{% if edit %}
<td class="text-right">
<button type="button" class="btn btn-default btn-xs item-add"
@@ -22,6 +24,7 @@
{% include 'RIGS/item_row.html' %}
{% endfor %}
</tbody>
{% if perms.RIGS.view_event %}
<tfoot>
<tr>
<td rowspan="3" colspan="2"></td>
@@ -43,6 +46,7 @@
<td colspan="2">£ <span id="total">{{object.total|default:0|floatformat:2}}</span></td>
</tr>
</tfoot>
{% endif %}
</table>
</div>
<table class="hidden invisible">

View File

@@ -81,14 +81,13 @@ urlpatterns = [
login_required()(rigboard.WebCalendar.as_view()), name='web_calendar'),
url(r'^rigboard/archive/$', RedirectView.as_view(permanent=True, pattern_name='event_archive')),
url(r'^rigboard/activity/$',
permission_required_with_403('RIGS.view_event')(versioning.ActivityTable.as_view()),
login_required()(versioning.ActivityTable.as_view()),
name='activity_table'),
url(r'^rigboard/activity/feed/$',
permission_required_with_403('RIGS.view_event')(versioning.ActivityFeed.as_view()),
login_required()(versioning.ActivityFeed.as_view()),
name='activity_feed'),
url(r'^event/(?P<pk>\d+)/$',
permission_required_with_403('RIGS.view_event', oembed_view="event_oembed")(
url(r'^event/(?P<pk>\d+)/$',(
rigboard.EventDetail.as_view()),
name='event_detail'),
url(r'^event/(?P<pk>\d+)/embed/$',
@@ -117,7 +116,7 @@ urlpatterns = [
name='event_archive'),
url(r'^event/(?P<pk>\d+)/history/$',
permission_required_with_403('RIGS.view_event')(versioning.VersionHistory.as_view()),
login_required()(versioning.VersionHistory.as_view()),
name='event_history', kwargs={'model': models.Event}),
# Finance