mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Authorisation template work
This commit is contained in:
@@ -111,7 +111,7 @@ def nottinghamtec_address_required(function):
|
||||
def wrap(request, *args, **kwargs):
|
||||
# Fail if current user's email address isn't @nottinghamtec.co.uk
|
||||
if not request.user.email.endswith('@nottinghamtec.co.uk'):
|
||||
error_resp = render(request, 'RIGS/eventauthorisation_request_error.html')
|
||||
error_resp = render(request, 'eventauthorisation_request_error.html')
|
||||
return error_resp
|
||||
|
||||
return function(request, *args, **kwargs)
|
||||
|
||||
@@ -15,21 +15,21 @@ urlpatterns = [
|
||||
path('', include('RIGS.urls')),
|
||||
path('assets/', include('assets.urls')),
|
||||
|
||||
path('user/', include('django.contrib.auth.urls')),
|
||||
path('user/', include('registration.backends.default.urls')),
|
||||
path('user/register/', RegistrationView.as_view(form_class=forms.ProfileRegistrationFormUniqueEmail),
|
||||
name="registration_register"),
|
||||
path('user/login/', LoginView.as_view(authentication_form=forms.CheckApprovedForm), name='login'),
|
||||
path('user/login/embed/', xframe_options_exempt(views.LoginEmbed.as_view()), name='login_embed'),
|
||||
# User editing
|
||||
path('user/', login_required(views.ProfileDetail.as_view()), name='profile_detail'),
|
||||
path('user/<pk>/',
|
||||
permission_required_with_403('RIGS.view_profile')(views.ProfileDetail.as_view()),
|
||||
name='profile_detail'),
|
||||
path('user/edit/', login_required(views.ProfileUpdateSelf.as_view()),
|
||||
name='profile_update_self'),
|
||||
path('user/reset_api_key', login_required(views.ResetApiKey.as_view(permanent=False)),
|
||||
name='reset_api_key'),
|
||||
path('user/', include('django.contrib.auth.urls')),
|
||||
path('user/', include('registration.backends.default.urls')),
|
||||
path('user/', login_required(views.ProfileDetail.as_view()), name='profile_detail'),
|
||||
path('user/<pk>/',
|
||||
permission_required_with_403('RIGS.view_profile')(views.ProfileDetail.as_view()),
|
||||
name='profile_detail'),
|
||||
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
||||
2
RIGS/static/js/raven.js
Normal file
2
RIGS/static/js/raven.js
Normal file
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
var querystring=require("querystring"),RavenClient=require("./lib/RavenClient"),HiLoIdGenerator=require("./lib/HiLoIdGenerator"),filter=require("./lib/filter");errorCodes=require("./lib/errorCodes"),_=require("lodash"),inflect=require("i")();var settings={host:"http://localhost:80",idFinder:defaultIdFinder,idGenerator:defaultIdGenerator,useOptimisticConcurrency:!1};function defaultIdFinder(e){if(e)return e["@metadata"]&&e["@metadata"]["@id"]?e["@metadata"]["@id"]:e.hasOwnProperty("id")?e.id:e.hasOwnProperty("Id")?e.Id:void 0}function defaultIdGenerator(e,t,r){if(!e)throw Error("Expected a valid doc object.");if(!t)throw Error("Expected a valid setings object.");if(!t.host)throw Error("Invalid settings. Expected host property.");if(!r||!_(r).isFunction)throw Error("Exepected a valid callback function.");new HiLoIdGenerator(t).nextId((function(t,i){return t?r(t):(collectionName="",e&&e["@metadata"]&&_.isString(e["@metadata"]["Raven-Entity-Name"])&&(collectionName=inflect.camelize(inflect.underscore(e["@metadata"]["Raven-Entity-Name"]),!1)+"/"),i=collectionName+i,r(void 0,i.toString()))}))}exports.connectionString=function(e){var t=this;if(!arguments.length)return settings.host;if(!_.isString(e))throw new Error("Expected a valid raven connection string");var r=querystring.parse(e,";","=");if(!r.Url)throw new Error('Required connection string property "Url" was not specified!');t.host(r.Url),t.database(r.Database),t.username(r.UserName),t.password(r.Password),t.apiKey(r.ApiKey)},exports.host=function(e){if(!arguments.length)return settings.host;if(!_.isString(e))throw new Error("Expected a valid raven host name");if(!~e.indexOf("http://")&&!~e.indexOf("https://"))throw new Error("Expected a host address with http:// or https://");settings.host=e},exports.database=function(e){if(!arguments.length)return settings.database;if(e){if(!_.isString(e))throw new Error("Expected a string for database name");settings.database=e}else settings.database&&delete settings.database},exports.username=function(e){if(!arguments.length)return settings.username;if(e){if(!_.isString(e))throw new Error("Expected a string for username");settings.username=e}else settings.username&&delete settings.username},exports.password=function(e){if(!arguments.length)return settings.password;if(e){if(!_.isString(e))throw new Error("Expected a string for password");settings.password=e}else settings.password&&delete settings.password},exports.apiKey=function(e){if(!arguments.length)return settings.apiKey;if(e){if(!_.isString(e))throw new Error("Expected a string for apiKey");settings.apiKey=e}else settings.apiKey&&delete settings.apiKey},exports.idFinder=function(e){if(!e)return settings.idFinder=defaultidFinder;if(!_(e).isFunction())throw new Error("Expected a valid function to use as the default key finder.");settings.idFinder=e},exports.idGenerator=function(e){if(!e)return settings.idGenerator=defaultIdGenerator;if(!_(e).isFunction())throw new Error("Expected a valid function to use as the default key generator.");settings.idGenerator=e},exports.useOptimisticConcurrency=function(e){if(!e)return settings.useOptimisticConcurrency;if(!_(e).isBoolean())throw new Error("Expected a boolean value when setting useOptimisticConcurrency");settings.useOptimisticConcurrency=e},exports.proxy=function(e){if(!e)return settings.proxy;if(!_.isString(e))throw new Error("Expected a valid proxy host address.");if(!~e.indexOf("http://")&&!~e.indexOf("https://"))throw new Error("Invaid proxy address scheme. Expected http or https scheme.");settings.proxy=e},exports.configure=function(e,t){_(e).isFunction()&&(t=e,e="all");var r=process.env.NODE_ENV||"development";("all"===e||~e.indexOf(r))&&t.call(this)},exports.defaultIdFinder=defaultIdFinder,exports.defaultIdGenerator=defaultIdGenerator,exports.connect=function(e){var t=_(settings).clone();return _(e).isObject()&&(t.host=e.host||t.host,t.database=e.database||t.database,t.username=e.username||t.username,t.password=e.password||t.password,t.apiKey=e.apiKey||t.apiKey,t.idFinder=e.idFinder||t.idFinder,t.idGenerator=e.idGenerator||t.idGenerator,t.proxy=e.proxy||t.proxy,t.useOptimisticConcurrency=e.useOptimisticConcurrency||t.useOptimisticConcurrency),new RavenClient(t)},exports.create=function(e,t){var r={},i={},n=!1;if(e){if(!_(e).isString())throw new Error("Expected a valid string for typeName");i["Raven-Clr-Type"]=e}if(_(t).isBoolean()&&(n=!1===t,t=void 0),t){if(!_(t).isString())throw new Error("Expected a valid string or bool for collectionName");i["Raven-Entity-Name"]=t}else e&&(t=n?e:inflect.pluralize(e),i["Raven-Entity-Name"]=t);return _.isEmpty(i)||(r["@metadata"]=i),r},exports.errorCodes=errorCodes;
|
||||
@@ -1,51 +1,51 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-6 col-lg-5">
|
||||
<div class="card card-default">
|
||||
<div class="row my-3">
|
||||
<div class="col-sm-6">
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">Contact Details</div>
|
||||
<div class="card-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Person</dt>
|
||||
<dd>
|
||||
<dl class="row">
|
||||
<dt class="col-sm-5">Person</dt>
|
||||
<dd class="col-sm-7">
|
||||
{% if event.person %}
|
||||
{{ event.person.name }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<dt>Email</dt>
|
||||
<dd>
|
||||
<dt class="col-sm-5">Email</dt>
|
||||
<dd class="col-sm-7">
|
||||
<span class="overflow-ellipsis">{{ event.person.email }}</span>
|
||||
</dd>
|
||||
|
||||
<dt>Phone Number</dt>
|
||||
<dd>{{ event.person.phone }}</dd>
|
||||
<dt class="col-sm-5">Phone Number</dt>
|
||||
<dd class="col-sm-7">{{ event.person.phone }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
{% if event.organisation %}
|
||||
<div class="card card-default">
|
||||
<div class="card-header">Organisation</div>
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">Organisation Details</div>
|
||||
<div class="card-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Organisation</dt>
|
||||
<dd>
|
||||
<dl class="row">
|
||||
<dt class="col-sm-5">Organisation</dt>
|
||||
<dd class="col-sm-7">
|
||||
{{ event.organisation.name }}
|
||||
</dd>
|
||||
|
||||
<dt>Phone Number</dt>
|
||||
<dd>{{ object.organisation.phone }}</dd>
|
||||
<dt class="col-sm-5">Phone Number</dt>
|
||||
<dd class="col-sm-7">{{ object.organisation.phone }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-md-6 col-lg-7">
|
||||
<div class="card card-info">
|
||||
<div class="col-sm-6">
|
||||
<div class="card border-info">
|
||||
<div class="card-header">Event Info</div>
|
||||
<div class="card-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Event Venue</dt>
|
||||
<dd>
|
||||
<dl class="row">
|
||||
<dt class="col-sm-5">Event Venue</dt>
|
||||
<dd class="col-sm-7">
|
||||
{% if object.venue %}
|
||||
<a href="{% url 'venue_detail' object.venue.pk %}" class="modal-href">
|
||||
{{ object.venue }}
|
||||
@@ -53,24 +53,24 @@
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<dt>Status</dt>
|
||||
<dd>{{ event.get_status_display }}</dd>
|
||||
<dt class="col-sm-5">Status</dt>
|
||||
<dd class="col-sm-7">{{ event.get_status_display }}</dd>
|
||||
|
||||
<dd> </dd>
|
||||
<dd class="col-sm-12"> </dd>
|
||||
|
||||
<dt>Access From</dt>
|
||||
<dd>{{ event.access_at|date:"D d M Y H:i"|default:"" }}</dd>
|
||||
<dt class="col-sm-5">Access From</dt>
|
||||
<dd class="col-sm-7">{{ event.access_at|date:"D d M Y H:i"|default:"" }}</dd>
|
||||
|
||||
<dt>Event Starts</dt>
|
||||
<dd>{{ event.start_date|date:"D d M Y" }} {{ event.start_time|date:"H:i" }}</dd>
|
||||
<dt class="col-sm-5">Event Starts</dt>
|
||||
<dd class="col-sm-7">{{ event.start_date|date:"D d M Y" }} {{ event.start_time|date:"H:i" }}</dd>
|
||||
|
||||
<dt>Event Ends</dt>
|
||||
<dd>{{ event.end_date|date:"D d M Y" }} {{ event.end_time|date:"H:i" }}</dd>
|
||||
<dt class="col-sm-5">Event Ends</dt>
|
||||
<dd class="col-sm-7">{{ event.end_date|date:"D d M Y" }} {{ event.end_time|date:"H:i" }}</dd>
|
||||
|
||||
<dd> </dd>
|
||||
<dd class="col-sm-12"> </dd>
|
||||
|
||||
<dt>Event Description</dt>
|
||||
<dd>{{ event.description|linebreaksbr }}</dd>
|
||||
<dt class="col-sm-5">Event Description</dt>
|
||||
<dd class="col-sm-12">{{ event.description|linebreaksbr }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{% if event.is_rig and event.internal and perms.RIGS.view_event %}
|
||||
<div class="col-sm-12">
|
||||
<div class="col-sm-12 py-3">
|
||||
<div class="card card-default
|
||||
{% if object.authorised %}
|
||||
card-success
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="btn-group py-2">
|
||||
<div class="btn-group py-3">
|
||||
<a href="{% url 'event_update' event.pk %}" class="btn btn-secondary"><span
|
||||
class="fas fa-edit"></span> <span
|
||||
class="hidden-xs">Edit</span></a>
|
||||
@@ -22,7 +22,7 @@
|
||||
class="hidden-xs">Duplicate</span></a>
|
||||
{% if event.is_rig %}
|
||||
{% if event.internal %}
|
||||
<a class="btn btn-default item-add modal-href event-authorise-request
|
||||
<a class="btn item-add modal-href event-authorise-request
|
||||
{% if event.authorised %}
|
||||
btn-success
|
||||
{% elif event.authorisation and event.authorisation.amount != event.total and event.authorisation.last_edited_at > event.auth_request_at %}
|
||||
@@ -32,7 +32,7 @@
|
||||
{% endif %}
|
||||
"
|
||||
href="{% url 'event_authorise_request' object.pk %}">
|
||||
<i class="fas fa-send"></i>
|
||||
<i class="fas fa-paper-plane"></i>
|
||||
<span class="hidden-xs">
|
||||
{% if event.authorised %}
|
||||
Authorised
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<tr>
|
||||
<td>#</td>
|
||||
<td>Event Date</td>
|
||||
<td>Event Timings</td>
|
||||
<td>Event Details</td>
|
||||
<td>MIC</td>
|
||||
</tr>
|
||||
@@ -26,9 +25,7 @@
|
||||
{% if event.end_date and event.end_date != event.start_date %}
|
||||
<div><strong>{{ event.end_date|date:"D d/m/Y" }}</strong></div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<!---Times-->
|
||||
<td>
|
||||
<!---Times-->
|
||||
{% if not event.cancelled %}
|
||||
<dl class="dl-horizontal">
|
||||
{% if event.meet_at %}
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
{% load static %}
|
||||
|
||||
{% block js %}
|
||||
<script src="{% static "js/tooltip.js" %}"></script>
|
||||
<script src="{% static 'js/tooltip.js' %}"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
|
||||
$('form').on('submit', function () {
|
||||
$('#loading-modal').modal({
|
||||
backdrop: 'static',
|
||||
@@ -23,13 +22,11 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<h1>
|
||||
{% if event.is_rig %}N{{ event.pk|stringformat:"05d" }}{% else %}{{ event.pk }}{% endif %}
|
||||
| {{ event.name }} {% if event.dry_hire %}<span class="badge">Dry Hire</span>{% endif %}
|
||||
</h1>
|
||||
</div>
|
||||
<div class="page-header my-3">
|
||||
<h1>
|
||||
{% if event.is_rig %}N{{ event.pk|stringformat:"05d" }}{% else %}{{ event.pk }}{% endif %}
|
||||
| {{ event.name }} {% if event.dry_hire %}<span class="badge">Dry Hire</span>{% endif %}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@@ -46,7 +43,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="card card-default">
|
||||
<div class="card border-primary">
|
||||
<div class="card-header" id="eventauth">Event Authorisation</div>
|
||||
|
||||
<div class="card-body">
|
||||
@@ -120,7 +117,7 @@
|
||||
|
||||
<div class="col-sm-12 col-md-4 text-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" type="submit">Authorise</button>
|
||||
<button class="btn btn-primary btn-lg" type="submit">Authorise</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,31 +20,22 @@
|
||||
<dd>{{ object.organisation.email }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-10 col-md-offset-1">
|
||||
<form action="{{ form.action|default:request.path }}" method="post" class="form-horizontal"
|
||||
id="auth-request-form">
|
||||
<form action="{{ form.action|default:request.path }}" method="POST" id="auth-request-form">
|
||||
{% csrf_token %}
|
||||
|
||||
<div class="row">
|
||||
{% include 'form_errors.html' %}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"
|
||||
for="{{ form.email.id_for_label }}">{{ form.email.label }}</label>
|
||||
|
||||
<div class="col-sm-9">
|
||||
{% render_field form.email type="email" class+="form-control" %}
|
||||
</div>
|
||||
{% include 'form_errors.html' %}
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label"
|
||||
for="{{ form.email.id_for_label }}">{{ form.email.label }}</label>
|
||||
<div class="col-sm-8">
|
||||
{% render_field form.email type="email" class+="form-control" %}
|
||||
</div>
|
||||
|
||||
<div class="text-right col-sm-3 col-sm-offset-9">
|
||||
<div class="form-group">
|
||||
<button type="submit" class="form-control btn btn-primary">
|
||||
<span class="fas fa-send"></span>
|
||||
Send
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right col-sm-3 offset-sm-9">
|
||||
<div class="form-group">
|
||||
<button type="submit" class="form-control btn btn-primary">
|
||||
<i class="fas fa-paper-plane"></i>
|
||||
Send
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
{% extends request.is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}NottinghamTEC Email Address Required{% endblock %}
|
||||
{% block title %}TEC Email Address Required{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="alert alert-warning">
|
||||
<h1>An error occured.</h1>
|
||||
<p>Your RIGS account must have an @nottinghamtec.co.uk email address before you can send emails to clients.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-warning">
|
||||
<h1>An error occured.</h1>
|
||||
<p>Your RIGS account must have an @nottinghamtec.co.uk email address before you can send emails to clients.</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-10 col-md-offset-1">
|
||||
|
||||
|
||||
<div class="col-sm-6">
|
||||
<h3>{{object.name}}</h3>
|
||||
</div>
|
||||
@@ -40,10 +40,10 @@
|
||||
{% if object.pk == user.pk %}
|
||||
<div class="col-sm-6 text-right">
|
||||
<div class="btn-group btn-page">
|
||||
<a href="{% url 'profile_update_self' %}" class="btn btn-default">
|
||||
Edit Profile <span class="fas fa-pencil"></span>
|
||||
<a href="{% url 'profile_update_self' %}" class="btn btn-secondary">
|
||||
Edit Profile <i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a href="{% url 'password_change' %}" class="btn btn-default">
|
||||
<a href="{% url 'password_change' %}" class="btn btn-secondary">
|
||||
Change Password <span class="fas fa-lock"></span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -75,14 +75,14 @@
|
||||
</dl>
|
||||
{% if not request.is_ajax %}
|
||||
{% if object.pk == user.pk %}
|
||||
|
||||
|
||||
<div class="pull-right">
|
||||
<a href="{% url 'reset_api_key' %}" class="btn btn-default">
|
||||
{% if user.api_key %}Reset API Key{% else %}Generate API Key{% endif %}
|
||||
<span class="fas fa-repeat"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<h4>Personal iCal Details</h4>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
@@ -136,7 +136,7 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="center-block">
|
||||
<img src="{{object.profile_picture}}" class="img-responsive img-rounded" />
|
||||
@@ -154,4 +154,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -147,7 +147,7 @@ urlpatterns = [
|
||||
name='payment_delete'),
|
||||
|
||||
# Client event authorisation
|
||||
url(r'^event/(?P<pk>\d+)/auth/$',
|
||||
path('event/<pk>/auth/',
|
||||
permission_required_with_403('RIGS.change_event')(
|
||||
rigboard.EventAuthorisationRequest.as_view()
|
||||
),
|
||||
|
||||
@@ -164,10 +164,12 @@ class OrganisationList(generic.ListView):
|
||||
|
||||
|
||||
class OrganisationDetail(generic.DetailView):
|
||||
template_name = 'organisation_detail.html'
|
||||
model = models.Organisation
|
||||
|
||||
|
||||
class OrganisationCreate(generic.CreateView):
|
||||
template_name = 'organisation_form.html'
|
||||
model = models.Organisation
|
||||
fields = ['name', 'phone', 'email', 'address', 'notes', 'union_account']
|
||||
|
||||
@@ -185,6 +187,7 @@ class OrganisationCreate(generic.CreateView):
|
||||
|
||||
|
||||
class OrganisationUpdate(generic.UpdateView):
|
||||
template_name = 'organisation_form.html'
|
||||
model = models.Organisation
|
||||
fields = ['name', 'phone', 'email', 'address', 'notes', 'union_account']
|
||||
|
||||
@@ -381,6 +384,7 @@ class SecureAPIRequest(generic.View):
|
||||
|
||||
|
||||
class ProfileDetail(generic.DetailView):
|
||||
template_name="profile_detail.html"
|
||||
model = models.Profile
|
||||
|
||||
def get_queryset(self):
|
||||
@@ -394,6 +398,7 @@ class ProfileDetail(generic.DetailView):
|
||||
|
||||
|
||||
class ProfileUpdateSelf(generic.UpdateView):
|
||||
template_name="profile_form.html"
|
||||
model = models.Profile
|
||||
fields = ['first_name', 'last_name', 'email', 'initials', 'phone']
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ var postcss = require('gulp-postcss')
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
var browsersync = require('browser-sync').create();
|
||||
var { exec } = require("child_process");
|
||||
var spawn = require('child_process').spawn;
|
||||
|
||||
sass.compiler = require('node-sass');
|
||||
|
||||
@@ -35,7 +36,7 @@ function scripts() {
|
||||
return gulp.src(['RIGS/static/js/src/**/.js',
|
||||
'node_modules/jquery/dist/jquery.js',
|
||||
'node_modules/popper.js/dist/umd/popper.js',
|
||||
'node_modules/ravenjs/ravenjs.js', //TODO Upgrade to Sentry
|
||||
'node_modules/raven-js/dist/raven.js', //TODO Upgrade to Sentry
|
||||
/* Bootstrap Plugins */
|
||||
'node_modules/bootstrap/js/dist/util.js',
|
||||
'node_modules/bootstrap/js/dist/tooltip.js',
|
||||
@@ -60,8 +61,7 @@ function scripts() {
|
||||
}
|
||||
|
||||
function browserSync(done) {
|
||||
exec('python manage.py runserver');
|
||||
// TODO Pipe errors from django to gulp output
|
||||
spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'});
|
||||
// TODO Wait for Django server to come up before browsersync, it seems inconsistent
|
||||
browsersync.init({
|
||||
notify: true,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"konami": "^1.6.2",
|
||||
"moment": "^2.24.0",
|
||||
"popper.js": "^1.16.1",
|
||||
"ravenjs": "^1.1.1",
|
||||
"raven-js": "^3.27.2",
|
||||
"transform": "^1.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<script src="{% static 'js/jquery.js' %}"></script>
|
||||
<script src="{% static 'js/popper.js' %}"></script>
|
||||
<script src="{% static 'js/ravenjs.js' %}"></script>
|
||||
<script src="{% static 'js/raven.js' %}"></script>
|
||||
<script>Raven.config('{% sentry_public_dsn %}').install()</script>
|
||||
{% block preload_js %}
|
||||
{% endblock %}
|
||||
@@ -33,39 +33,23 @@
|
||||
|
||||
<body>
|
||||
{% include "analytics.html" %}
|
||||
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark justify-content-between" role="navigation">
|
||||
<div class="container">
|
||||
{% block titleheader %}
|
||||
{% endblock %}
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
{% block titleelements %}
|
||||
{% endblock %}
|
||||
<li class="nav-item dropdown align-self-end" id="user">
|
||||
{% if user.is_authenticated %}
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="fas fa-user"></span>
|
||||
Hi {{ user.first_name }}
|
||||
</a>
|
||||
<div class="dropdown-menu" id="userdropdown">
|
||||
<div class="col-sm-12 text-right">
|
||||
<a href="{% url 'logout' %}" class="dropdown-item btn btn-primary" >Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<a class="nav-link" href="{% url 'login' %}">
|
||||
<span class="icon-user"></span>
|
||||
Login
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% block navbar %}
|
||||
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark" role="navigation">
|
||||
<div class="container">
|
||||
{% block titleheader %}
|
||||
{% endblock %}
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
{% block titleelements %}
|
||||
{% endblock %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
{% endblock %}
|
||||
|
||||
<div class="container py-4">
|
||||
{% block content-header %}
|
||||
|
||||
@@ -1,75 +1,10 @@
|
||||
{% load static %}
|
||||
{% load raven %}
|
||||
{% extends 'base.html' %}
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}"
|
||||
xml:lang="{% firstof LANGUAGE_CODE 'en' %}"
|
||||
lang="{% firstof LANGUAGE_CODE 'en' %}">
|
||||
<head>
|
||||
<title>{% block title %}{% endblock %} | Rig Information Gathering System</title>
|
||||
|
||||
<meta name="viewport" content="initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/png" href="{% static "imgs/pyrigs-avatar.png" %}">
|
||||
<link rel="apple-touch-icon" href="{% static "imgs/pyrigs-avatar.png" %}">
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400italic,700,300,400' rel='stylesheet'
|
||||
type='text/css'>
|
||||
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{% static "css/screen.css" %}">
|
||||
{% block css %}
|
||||
{% endblock %}
|
||||
|
||||
<script src="https://code.jquery.com/jquery-1.8.3.min.js"
|
||||
integrity="sha256-YcbK69I5IXQftf/mYD8WY0/KmEDCv1asggHpJk1trM8=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.ravenjs.com/1.3.0/jquery,native/raven.min.js"></script>
|
||||
<script>Raven.config('{% sentry_public_dsn %}').install()</script>
|
||||
{% block preload_js %}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra-head %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% include "analytics.html" %}
|
||||
<div class="navbar navbar-fixed-top navbar-inverse hidden-print" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<span class="navbar-brand">RIGS</span>
|
||||
</div>
|
||||
</div>
|
||||
{% block titleheader %}
|
||||
<div class="navbar-header">
|
||||
<span class="navbar-brand">RIGS</span>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div id="content" class="row">
|
||||
{% block content-header %}
|
||||
{% if error %}
|
||||
<div class="error">{{ error }}</div>{% endif %}
|
||||
{% if info %}
|
||||
<div class="info">{{ info }}</div>{% endif %}
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div class="alert alert-{{ message.level_tag }} alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<div id="sidebar" class="column">
|
||||
{% block sidebar %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal" role="dialog" tabindex=-1></div>
|
||||
{% endblock %}
|
||||
|
||||
<div class="modal fade" id="loading-modal" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
@@ -86,40 +21,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
Date.prototype.getISOString = function () {
|
||||
var yyyy = this.getFullYear().toString();
|
||||
var mm = (this.getMonth() + 1).toString(); // getMonth() is zero-based
|
||||
var dd = this.getDate().toString();
|
||||
return yyyy + '-' + (mm[1] ? mm : "0" + mm[0]) + '-' + (dd[1] ? dd : "0" + dd[0]); // padding
|
||||
};
|
||||
</script>
|
||||
<script src="{% static "js/jquery.cookie.js" %}"></script>
|
||||
<script src="{% static "js/alert.js" %}"></script>
|
||||
<script src="{% static "js/collapse.js" %}"></script>
|
||||
<script>
|
||||
$('.navbar-collapse').addClass('collapse')
|
||||
</script>
|
||||
<script src="{% static "js/dropdown.js" %}"></script>
|
||||
<script src="{% static "js/modal.js" %}"></script>
|
||||
<script>
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(document).on('click', '.modal-href', function (e) {
|
||||
$link = jQuery(this);
|
||||
// Anti modal inception
|
||||
if ($link.parents('#modal').length == 0) {
|
||||
e.preventDefault();
|
||||
modaltarget = $link.data('target');
|
||||
modalobject = "";
|
||||
jQuery('#modal').load($link.attr('href'), function (e) {
|
||||
jQuery('#modal').modal();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% block js %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<script src="https://code.jquery.com/jquery-1.8.3.min.js"
|
||||
integrity="sha256-YcbK69I5IXQftf/mYD8WY0/KmEDCv1asggHpJk1trM8=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.ravenjs.com/1.3.0/jquery,native/raven.min.js"></script>
|
||||
<script src="{% static 'js/raven.js' %}"></script>
|
||||
<script>Raven.config('{% sentry_public_dsn %}').install()</script>
|
||||
|
||||
</head>
|
||||
|
||||
@@ -8,70 +8,95 @@
|
||||
|
||||
{% block titleelements %}
|
||||
{% if user.is_authenticated %}
|
||||
<li class="nav-item"><a class="nav-link" href="/">Home</a></li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownRigboard" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Rigboard
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownRigboard">
|
||||
<a class="dropdown-item" href="{% url 'rigboard' %}"><span class="fas fa-list"></span>
|
||||
Rigboard</a>
|
||||
<a class="dropdown-item" href="{% url 'event_archive' %}"><span class="fas fa-book"></span>
|
||||
Archive</a>
|
||||
<a class="dropdown-item" href="{% url 'web_calendar' %}"><span class="fas fa-calendar"></span>
|
||||
Calendar</a>
|
||||
{% if perms.RIGS.view_event %}
|
||||
<a class="dropdown-item" href="{% url 'activity_table' %}"><span
|
||||
class="fas fa-random"></span> Recent Changes</a>
|
||||
<li class="nav-item"><a class="nav-link" href="/">Home</a></li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownRigboard" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Rigboard
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownRigboard">
|
||||
<a class="dropdown-item" href="{% url 'rigboard' %}"><span class="fas fa-list"></span>
|
||||
Rigboard</a>
|
||||
<a class="dropdown-item" href="{% url 'event_archive' %}"><span class="fas fa-book"></span>
|
||||
Archive</a>
|
||||
<a class="dropdown-item" href="{% url 'web_calendar' %}"><span class="fas fa-calendar"></span>
|
||||
Calendar</a>
|
||||
{% if perms.RIGS.view_event %}
|
||||
<a class="dropdown-item" href="{% url 'activity_table' %}"><span
|
||||
class="fas fa-random"></span> Recent Changes</a>
|
||||
{% endif %}
|
||||
{% if perms.RIGS.add_event %}
|
||||
<a class="dropdown-item" href="{% url 'event_create' %}"><span class="fas fa-plus"></span>
|
||||
New Event</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% if perms.RIGS.view_invoice %}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownInvoices" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Invoices
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownInvoices">
|
||||
{% if perms.RIGS.add_invoice %}
|
||||
<a class="dropdown-item" href="{% url 'invoice_waiting' %}"><span class="fas fa-briefcase text-danger"></span> Waiting</a>
|
||||
{% endif %}
|
||||
<a class="dropdown-item" href="{% url 'invoice_list' %}"><span class="fas fa-pound-sign text-warning"></span> Outstanding</a>
|
||||
<a class="dropdown-item" href="{% url 'invoice_archive' %}"><span class="fas fa-book"></span> Archive</a>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if perms.RIGS.add_event %}
|
||||
<a class="dropdown-item" href="{% url 'event_create' %}"><span class="fas fa-plus"></span>
|
||||
New Event</a>
|
||||
{% if perms.RIGS.view_person %}
|
||||
<li class="nav-item"><a class="nav-link" href="{% url 'person_list' %}">People</a></li>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% if perms.RIGS.view_invoice %}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownInvoices" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Invoices
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownInvoices">
|
||||
{% if perms.RIGS.add_invoice %}
|
||||
<a class="dropdown-item" href="{% url 'invoice_waiting' %}"><span class="fas fa-briefcase text-danger"></span> Waiting</a>
|
||||
{% if perms.RIGS.view_organisation %}
|
||||
<li class="nav-item"><a class="nav-link" href="{% url 'organisation_list' %}">Organisations</a></li>
|
||||
{% endif %}
|
||||
<a class="dropdown-item" href="{% url 'invoice_list' %}"><span class="fas fa-pound-sign text-warning"></span> Outstanding</a>
|
||||
<a class="dropdown-item" href="{% url 'invoice_archive' %}"><span class="fas fa-book"></span> Archive</a>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if perms.RIGS.view_person %}
|
||||
<li class="nav-item"><a class="nav-link" href="{% url 'person_list' %}">People</a></li>
|
||||
{% endif %}
|
||||
{% if perms.RIGS.view_organisation %}
|
||||
<li class="nav-item"><a class="nav-link" href="{% url 'organisation_list' %}">Organisations</a></li>
|
||||
{% endif %}
|
||||
{% if perms.RIGS.view_venue %}
|
||||
<li class="nav-item"><a class="nav-link" href="{% url 'venue_list' %}">Venues</a></li>
|
||||
{% endif %}
|
||||
<form id="searchForm" class="form-inline flex-nowrap mx-3" role="form" method="GET">
|
||||
<div class="input-group input-group-sm flex-nowrap">
|
||||
<div class="input-group-prepend">
|
||||
<input id="id_search_input" type="search" name="q" class="form-control form-control-sm" placeholder="Search..." />
|
||||
{% if perms.RIGS.view_venue %}
|
||||
<li class="nav-item"><a class="nav-link" href="{% url 'venue_list' %}">Venues</a></li>
|
||||
{% endif %}
|
||||
<form id="searchForm" class="form-inline flex-nowrap mx-3" role="form" method="GET">
|
||||
<div class="input-group input-group-sm flex-nowrap">
|
||||
<div class="input-group-prepend">
|
||||
<input id="id_search_input" type="search" name="q" class="form-control form-control-sm" placeholder="Search..." />
|
||||
</div>
|
||||
<select id="search-options" class="custom-select form-control">
|
||||
<option selected data-action="{% url 'event_archive' %}" href="#">Events</option>
|
||||
<option data-action="{% url 'person_list' %}" href="#">People</option>
|
||||
<option data-action="{% url 'organisation_list' %}" href="#">Organisations</option>
|
||||
<option data-action="{% url 'venue_list' %}" href="#">Venues</option>
|
||||
{% if perms.RIGS.view_invoice %}
|
||||
<option data-action="{% url 'invoice_archive' %}" href="#">Invoices</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
<select id="search-options" class="custom-select form-control">
|
||||
<option selected data-action="{% url 'event_archive' %}" href="#">Events</option>
|
||||
<option data-action="{% url 'person_list' %}" href="#">People</option>
|
||||
<option data-action="{% url 'organisation_list' %}" href="#">Organisations</option>
|
||||
<option data-action="{% url 'venue_list' %}" href="#">Venues</option>
|
||||
{% if perms.RIGS.view_invoice %}
|
||||
<option data-action="{% url 'invoice_archive' %}" href="#">Invoices</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
<button class="btn btn-primary form-control form-control-sm btn-sm">Search</button>
|
||||
<a href="{% url 'search_help' %}" class="nav-link modal-href btn-sm"><span class="fas fa-question-circle"></span></a>
|
||||
</form>
|
||||
<button class="btn btn-primary form-control form-control-sm btn-sm">Search</button>
|
||||
<a href="{% url 'search_help' %}" class="nav-link modal-href btn-sm"><span class="fas fa-question-circle"></span></a>
|
||||
</form>
|
||||
{% endif %}
|
||||
<li class="nav-item dropdown" id="user">
|
||||
{% if user.is_authenticated %}
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Hi {{ user.first_name }}
|
||||
</a>
|
||||
<ul class="dropdown-menu p-3" id="userdropdown">
|
||||
<li class="media">
|
||||
<a href="{% url 'profile_detail' %}">
|
||||
<img src="{{ request.user.profile_picture }}" class="media-object"/>
|
||||
<div class="media-body">
|
||||
<b>{{ request.user.first_name }} {{ request.user.last_name }}</b>
|
||||
<p class="muted">{{ request.user.email }}</p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'logout' %}" class="btn btn-primary align"><i class="fas fa-sign-out-alt"></i> Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% else %}
|
||||
<a class="nav-link" href="{% url 'login' %}">
|
||||
Login
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endblock %}
|
||||
{% block js %}
|
||||
<script src="{% static 'js/tooltip.js' %}"></script>
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
<h1>R<small>ig</small> I<small>nformation</small> G<small>athering</small> S<small>ystem</small></h1>
|
||||
</div>
|
||||
{% include 'registration/loginform.html' %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% load widget_tweaks %}
|
||||
{% include 'form_errors.html' %}
|
||||
<div class="col-sm-6 col-sm-offset-3 col-lg-4 col-lg-offset-4">
|
||||
<div class="col-sm-6 offset-sm-3 col-lg-4 offset-lg-4">
|
||||
<form action="{% url 'login' %}" method="post" role="form" target="_self">{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<label for="id_username">{{ form.username.label }}</label>
|
||||
|
||||
Reference in New Issue
Block a user