Authorisation template work

This commit is contained in:
2020-03-15 23:06:54 +00:00
parent 4a71dd0d95
commit c1d277be9c
22 changed files with 202 additions and 308 deletions

View File

@@ -111,7 +111,7 @@ def nottinghamtec_address_required(function):
def wrap(request, *args, **kwargs): def wrap(request, *args, **kwargs):
# Fail if current user's email address isn't @nottinghamtec.co.uk # Fail if current user's email address isn't @nottinghamtec.co.uk
if not request.user.email.endswith('@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 error_resp
return function(request, *args, **kwargs) return function(request, *args, **kwargs)

View File

@@ -15,21 +15,21 @@ urlpatterns = [
path('', include('RIGS.urls')), path('', include('RIGS.urls')),
path('assets/', include('assets.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), path('user/register/', RegistrationView.as_view(form_class=forms.ProfileRegistrationFormUniqueEmail),
name="registration_register"), name="registration_register"),
path('user/login/', LoginView.as_view(authentication_form=forms.CheckApprovedForm), name='login'), 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'), path('user/login/embed/', xframe_options_exempt(views.LoginEmbed.as_view()), name='login_embed'),
# User editing # 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()), path('user/edit/', login_required(views.ProfileUpdateSelf.as_view()),
name='profile_update_self'), name='profile_update_self'),
path('user/reset_api_key', login_required(views.ResetApiKey.as_view(permanent=False)), path('user/reset_api_key', login_required(views.ResetApiKey.as_view(permanent=False)),
name='reset_api_key'), name='reset_api_key'),
path('user/', include('django.contrib.auth.urls')), path('user/', login_required(views.ProfileDetail.as_view()), name='profile_detail'),
path('user/', include('registration.backends.default.urls')), path('user/<pk>/',
permission_required_with_403('RIGS.view_profile')(views.ProfileDetail.as_view()),
name='profile_detail'),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
] ]

2
RIGS/static/js/raven.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -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;

View File

@@ -1,51 +1,51 @@
<div class="row"> <div class="row my-3">
<div class="col-sm-12 col-md-6 col-lg-5"> <div class="col-sm-6">
<div class="card card-default"> <div class="card mb-3">
<div class="card-header">Contact Details</div> <div class="card-header">Contact Details</div>
<div class="card-body"> <div class="card-body">
<dl class="dl-horizontal"> <dl class="row">
<dt>Person</dt> <dt class="col-sm-5">Person</dt>
<dd> <dd class="col-sm-7">
{% if event.person %} {% if event.person %}
{{ event.person.name }} {{ event.person.name }}
{% endif %} {% endif %}
</dd> </dd>
<dt>Email</dt> <dt class="col-sm-5">Email</dt>
<dd> <dd class="col-sm-7">
<span class="overflow-ellipsis">{{ event.person.email }}</span> <span class="overflow-ellipsis">{{ event.person.email }}</span>
</dd> </dd>
<dt>Phone Number</dt> <dt class="col-sm-5">Phone Number</dt>
<dd>{{ event.person.phone }}</dd> <dd class="col-sm-7">{{ event.person.phone }}</dd>
</dl> </dl>
</div> </div>
</div> </div>
{% if event.organisation %} {% if event.organisation %}
<div class="card card-default"> <div class="card mt-3">
<div class="card-header">Organisation</div> <div class="card-header">Organisation Details</div>
<div class="card-body"> <div class="card-body">
<dl class="dl-horizontal"> <dl class="row">
<dt>Organisation</dt> <dt class="col-sm-5">Organisation</dt>
<dd> <dd class="col-sm-7">
{{ event.organisation.name }} {{ event.organisation.name }}
</dd> </dd>
<dt>Phone Number</dt> <dt class="col-sm-5">Phone Number</dt>
<dd>{{ object.organisation.phone }}</dd> <dd class="col-sm-7">{{ object.organisation.phone }}</dd>
</dl> </dl>
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div class="col-sm-12 col-md-6 col-lg-7"> <div class="col-sm-6">
<div class="card card-info"> <div class="card border-info">
<div class="card-header">Event Info</div> <div class="card-header">Event Info</div>
<div class="card-body"> <div class="card-body">
<dl class="dl-horizontal"> <dl class="row">
<dt>Event Venue</dt> <dt class="col-sm-5">Event Venue</dt>
<dd> <dd class="col-sm-7">
{% if object.venue %} {% if object.venue %}
<a href="{% url 'venue_detail' object.venue.pk %}" class="modal-href"> <a href="{% url 'venue_detail' object.venue.pk %}" class="modal-href">
{{ object.venue }} {{ object.venue }}
@@ -53,24 +53,24 @@
{% endif %} {% endif %}
</dd> </dd>
<dt>Status</dt> <dt class="col-sm-5">Status</dt>
<dd>{{ event.get_status_display }}</dd> <dd class="col-sm-7">{{ event.get_status_display }}</dd>
<dd>&nbsp;</dd> <dd class="col-sm-12">&nbsp;</dd>
<dt>Access From</dt> <dt class="col-sm-5">Access From</dt>
<dd>{{ event.access_at|date:"D d M Y H:i"|default:"" }}</dd> <dd class="col-sm-7">{{ event.access_at|date:"D d M Y H:i"|default:"" }}</dd>
<dt>Event Starts</dt> <dt class="col-sm-5">Event Starts</dt>
<dd>{{ event.start_date|date:"D d M Y" }} {{ event.start_time|date:"H:i" }}</dd> <dd class="col-sm-7">{{ event.start_date|date:"D d M Y" }} {{ event.start_time|date:"H:i" }}</dd>
<dt>Event Ends</dt> <dt class="col-sm-5">Event Ends</dt>
<dd>{{ event.end_date|date:"D d M Y" }} {{ event.end_time|date:"H:i" }}</dd> <dd class="col-sm-7">{{ event.end_date|date:"D d M Y" }} {{ event.end_time|date:"H:i" }}</dd>
<dd>&nbsp;</dd> <dd class="col-sm-12">&nbsp;</dd>
<dt>Event Description</dt> <dt class="col-sm-5">Event Description</dt>
<dd>{{ event.description|linebreaksbr }}</dd> <dd class="col-sm-12">{{ event.description|linebreaksbr }}</dd>
</dl> </dl>
</div> </div>
</div> </div>

View File

@@ -154,7 +154,7 @@
</div> </div>
</div> </div>
{% if event.is_rig and event.internal and perms.RIGS.view_event %} {% 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 <div class="card card-default
{% if object.authorised %} {% if object.authorised %}
card-success card-success

View File

@@ -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 <a href="{% url 'event_update' event.pk %}" class="btn btn-secondary"><span
class="fas fa-edit"></span> <span class="fas fa-edit"></span> <span
class="hidden-xs">Edit</span></a> class="hidden-xs">Edit</span></a>
@@ -22,7 +22,7 @@
class="hidden-xs">Duplicate</span></a> class="hidden-xs">Duplicate</span></a>
{% if event.is_rig %} {% if event.is_rig %}
{% if event.internal %} {% 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 %} {% if event.authorised %}
btn-success btn-success
{% elif event.authorisation and event.authorisation.amount != event.total and event.authorisation.last_edited_at > event.auth_request_at %} {% elif event.authorisation and event.authorisation.amount != event.total and event.authorisation.last_edited_at > event.auth_request_at %}
@@ -32,7 +32,7 @@
{% endif %} {% endif %}
" "
href="{% url 'event_authorise_request' object.pk %}"> href="{% url 'event_authorise_request' object.pk %}">
<i class="fas fa-send"></i> <i class="fas fa-paper-plane"></i>
<span class="hidden-xs"> <span class="hidden-xs">
{% if event.authorised %} {% if event.authorised %}
Authorised Authorised

View File

@@ -4,7 +4,6 @@
<tr> <tr>
<td>#</td> <td>#</td>
<td>Event Date</td> <td>Event Date</td>
<td>Event Timings</td>
<td>Event Details</td> <td>Event Details</td>
<td>MIC</td> <td>MIC</td>
</tr> </tr>
@@ -26,9 +25,7 @@
{% if event.end_date and event.end_date != event.start_date %} {% if event.end_date and event.end_date != event.start_date %}
<div><strong>{{ event.end_date|date:"D d/m/Y" }}</strong></div> <div><strong>{{ event.end_date|date:"D d/m/Y" }}</strong></div>
{% endif %} {% endif %}
</td>
<!---Times--> <!---Times-->
<td>
{% if not event.cancelled %} {% if not event.cancelled %}
<dl class="dl-horizontal"> <dl class="dl-horizontal">
{% if event.meet_at %} {% if event.meet_at %}

View File

@@ -3,12 +3,11 @@
{% load static %} {% load static %}
{% block js %} {% block js %}
<script src="{% static "js/tooltip.js" %}"></script> <script src="{% static 'js/tooltip.js' %}"></script>
<script> <script>
$(function () { $(function () {
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
}); });
$('form').on('submit', function () { $('form').on('submit', function () {
$('#loading-modal').modal({ $('#loading-modal').modal({
backdrop: 'static', backdrop: 'static',
@@ -23,14 +22,12 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="row"> <div class="page-header my-3">
<div class="col-sm-12">
<h1> <h1>
{% if event.is_rig %}N{{ event.pk|stringformat:"05d" }}{% else %}{{ event.pk }}{% endif %} {% 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 %} | {{ event.name }} {% if event.dry_hire %}<span class="badge">Dry Hire</span>{% endif %}
</h1> </h1>
</div> </div>
</div>
<div class="row"> <div class="row">
{% include 'client_eventdetails.html' %} {% include 'client_eventdetails.html' %}
@@ -46,7 +43,7 @@
<div class="row"> <div class="row">
<div class="col-sm-12"> <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-header" id="eventauth">Event Authorisation</div>
<div class="card-body"> <div class="card-body">
@@ -120,7 +117,7 @@
<div class="col-sm-12 col-md-4 text-right"> <div class="col-sm-12 col-md-4 text-right">
<div class="btn-group"> <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> </div>
</div> </div>

View File

@@ -20,33 +20,24 @@
<dd>{{ object.organisation.email }}</dd> <dd>{{ object.organisation.email }}</dd>
</dl> </dl>
</div> </div>
</div> <form action="{{ form.action|default:request.path }}" method="POST" id="auth-request-form">
<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">
{% csrf_token %} {% csrf_token %}
<div class="row">
{% include 'form_errors.html' %} {% include 'form_errors.html' %}
<div class="form-group row">
<div class="form-group"> <label class="col-sm-4 col-form-label"
<label class="col-sm-3 control-label"
for="{{ form.email.id_for_label }}">{{ form.email.label }}</label> for="{{ form.email.id_for_label }}">{{ form.email.label }}</label>
<div class="col-sm-8">
<div class="col-sm-9">
{% render_field form.email type="email" class+="form-control" %} {% render_field form.email type="email" class+="form-control" %}
</div> </div>
</div> </div>
<div class="text-right col-sm-3 offset-sm-9">
<div class="text-right col-sm-3 col-sm-offset-9">
<div class="form-group"> <div class="form-group">
<button type="submit" class="form-control btn btn-primary"> <button type="submit" class="form-control btn btn-primary">
<span class="fas fa-send"></span> <i class="fas fa-paper-plane"></i>
Send Send
</button> </button>
</div> </div>
</div> </div>
</div>
</form> </form>
</div> </div>
</div> </div>

View File

@@ -1,15 +1,11 @@
{% extends request.is_ajax|yesno:'base_ajax.html,base_rigs.html' %} {% extends request.is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
{% load widget_tweaks %} {% load widget_tweaks %}
{% block title %}NottinghamTEC Email Address Required{% endblock %} {% block title %}TEC Email Address Required{% endblock %}
{% block content %} {% block content %}
<div class="row">
<div class="col-sm-12">
<div class="alert alert-warning"> <div class="alert alert-warning">
<h1>An error occured.</h1> <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> <p>Your RIGS account must have an @nottinghamtec.co.uk email address before you can send emails to clients.</p>
</div> </div>
</div>
</div>
{% endblock %} {% endblock %}

View File

@@ -40,10 +40,10 @@
{% if object.pk == user.pk %} {% if object.pk == user.pk %}
<div class="col-sm-6 text-right"> <div class="col-sm-6 text-right">
<div class="btn-group btn-page"> <div class="btn-group btn-page">
<a href="{% url 'profile_update_self' %}" class="btn btn-default"> <a href="{% url 'profile_update_self' %}" class="btn btn-secondary">
Edit Profile <span class="fas fa-pencil"></span> Edit Profile <i class="fas fa-edit"></i>
</a> </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> Change Password <span class="fas fa-lock"></span>
</a> </a>
</div> </div>

View File

@@ -147,7 +147,7 @@ urlpatterns = [
name='payment_delete'), name='payment_delete'),
# Client event authorisation # Client event authorisation
url(r'^event/(?P<pk>\d+)/auth/$', path('event/<pk>/auth/',
permission_required_with_403('RIGS.change_event')( permission_required_with_403('RIGS.change_event')(
rigboard.EventAuthorisationRequest.as_view() rigboard.EventAuthorisationRequest.as_view()
), ),

View File

@@ -164,10 +164,12 @@ class OrganisationList(generic.ListView):
class OrganisationDetail(generic.DetailView): class OrganisationDetail(generic.DetailView):
template_name = 'organisation_detail.html'
model = models.Organisation model = models.Organisation
class OrganisationCreate(generic.CreateView): class OrganisationCreate(generic.CreateView):
template_name = 'organisation_form.html'
model = models.Organisation model = models.Organisation
fields = ['name', 'phone', 'email', 'address', 'notes', 'union_account'] fields = ['name', 'phone', 'email', 'address', 'notes', 'union_account']
@@ -185,6 +187,7 @@ class OrganisationCreate(generic.CreateView):
class OrganisationUpdate(generic.UpdateView): class OrganisationUpdate(generic.UpdateView):
template_name = 'organisation_form.html'
model = models.Organisation model = models.Organisation
fields = ['name', 'phone', 'email', 'address', 'notes', 'union_account'] fields = ['name', 'phone', 'email', 'address', 'notes', 'union_account']
@@ -381,6 +384,7 @@ class SecureAPIRequest(generic.View):
class ProfileDetail(generic.DetailView): class ProfileDetail(generic.DetailView):
template_name="profile_detail.html"
model = models.Profile model = models.Profile
def get_queryset(self): def get_queryset(self):
@@ -394,6 +398,7 @@ class ProfileDetail(generic.DetailView):
class ProfileUpdateSelf(generic.UpdateView): class ProfileUpdateSelf(generic.UpdateView):
template_name="profile_form.html"
model = models.Profile model = models.Profile
fields = ['first_name', 'last_name', 'email', 'initials', 'phone'] fields = ['first_name', 'last_name', 'email', 'initials', 'phone']

View File

@@ -13,6 +13,7 @@ var postcss = require('gulp-postcss')
var sourcemaps = require('gulp-sourcemaps'); var sourcemaps = require('gulp-sourcemaps');
var browsersync = require('browser-sync').create(); var browsersync = require('browser-sync').create();
var { exec } = require("child_process"); var { exec } = require("child_process");
var spawn = require('child_process').spawn;
sass.compiler = require('node-sass'); sass.compiler = require('node-sass');
@@ -35,7 +36,7 @@ function scripts() {
return gulp.src(['RIGS/static/js/src/**/.js', return gulp.src(['RIGS/static/js/src/**/.js',
'node_modules/jquery/dist/jquery.js', 'node_modules/jquery/dist/jquery.js',
'node_modules/popper.js/dist/umd/popper.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 */ /* Bootstrap Plugins */
'node_modules/bootstrap/js/dist/util.js', 'node_modules/bootstrap/js/dist/util.js',
'node_modules/bootstrap/js/dist/tooltip.js', 'node_modules/bootstrap/js/dist/tooltip.js',
@@ -60,8 +61,7 @@ function scripts() {
} }
function browserSync(done) { function browserSync(done) {
exec('python manage.py runserver'); spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'});
// TODO Pipe errors from django to gulp output
// TODO Wait for Django server to come up before browsersync, it seems inconsistent // TODO Wait for Django server to come up before browsersync, it seems inconsistent
browsersync.init({ browsersync.init({
notify: true, notify: true,

View File

@@ -18,7 +18,7 @@
"konami": "^1.6.2", "konami": "^1.6.2",
"moment": "^2.24.0", "moment": "^2.24.0",
"popper.js": "^1.16.1", "popper.js": "^1.16.1",
"ravenjs": "^1.1.1", "raven-js": "^3.27.2",
"transform": "^1.1.2" "transform": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -23,7 +23,7 @@
<script src="{% static 'js/jquery.js' %}"></script> <script src="{% static 'js/jquery.js' %}"></script>
<script src="{% static 'js/popper.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> <script>Raven.config('{% sentry_public_dsn %}').install()</script>
{% block preload_js %} {% block preload_js %}
{% endblock %} {% endblock %}
@@ -33,7 +33,8 @@
<body> <body>
{% include "analytics.html" %} {% include "analytics.html" %}
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark justify-content-between" role="navigation"> {% block navbar %}
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark" role="navigation">
<div class="container"> <div class="container">
{% block titleheader %} {% block titleheader %}
{% endblock %} {% endblock %}
@@ -44,28 +45,11 @@
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav mr-auto">
{% block titleelements %} {% block titleelements %}
{% endblock %} {% 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> </ul>
</div> </div>
</div> </div>
</nav> </nav>
{% endblock %}
<div class="container py-4"> <div class="container py-4">
{% block content-header %} {% block content-header %}

View File

@@ -1,76 +1,11 @@
{% load static %} {% extends 'base.html' %}
{% load raven %}
{% block titleheader %}
<!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"> <div class="navbar-header">
<span class="navbar-brand">RIGS</span> <span class="navbar-brand">RIGS</span>
</div> </div>
</div>
</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">&times;</span></button>
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endblock %} {% 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>
<div class="modal fade" id="loading-modal" role="dialog"> <div class="modal fade" id="loading-modal" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
@@ -86,40 +21,3 @@
</div> </div>
</div> </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>

View File

@@ -18,7 +18,7 @@
<script src="https://code.jquery.com/jquery-1.8.3.min.js" <script src="https://code.jquery.com/jquery-1.8.3.min.js"
integrity="sha256-YcbK69I5IXQftf/mYD8WY0/KmEDCv1asggHpJk1trM8=" crossorigin="anonymous"></script> 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> <script>Raven.config('{% sentry_public_dsn %}').install()</script>
</head> </head>

View File

@@ -72,6 +72,31 @@
<a href="{% url 'search_help' %}" class="nav-link modal-href btn-sm"><span class="fas fa-question-circle"></span></a> <a href="{% url 'search_help' %}" class="nav-link modal-href btn-sm"><span class="fas fa-question-circle"></span></a>
</form> </form>
{% endif %} {% 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 %} {% endblock %}
{% block js %} {% block js %}
<script src="{% static 'js/tooltip.js' %}"></script> <script src="{% static 'js/tooltip.js' %}"></script>

View File

@@ -1,6 +1,6 @@
{% load widget_tweaks %} {% load widget_tweaks %}
{% include 'form_errors.html' %} {% 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 %} <form action="{% url 'login' %}" method="post" role="form" target="_self">{% csrf_token %}
<div class="form-group"> <div class="form-group">
<label for="id_username">{{ form.username.label }}</label> <label for="id_username">{{ form.username.label }}</label>