mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-23 00:12:15 +00:00
Improvements to profile detail page
This commit is contained in:
7
RIGS/static/js/clipboard.min.js
vendored
Normal file
7
RIGS/static/js/clipboard.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -48,6 +48,7 @@ function scripts() {
|
|||||||
'node_modules/bootstrap/js/dist/modal.js',
|
'node_modules/bootstrap/js/dist/modal.js',
|
||||||
'node_modules/bootstrap/js/dist/alert.js',
|
'node_modules/bootstrap/js/dist/alert.js',
|
||||||
|
|
||||||
|
'node_modules/clipboard/dist/clipboard.min.js',
|
||||||
'node_modules/flatpickr/dist/flatpickr.min.js',
|
'node_modules/flatpickr/dist/flatpickr.min.js',
|
||||||
'node_modules/@fortawesome/fontawesome-free/js/all.js',
|
'node_modules/@fortawesome/fontawesome-free/js/all.js',
|
||||||
'node_modules/moment/moment.js',
|
'node_modules/moment/moment.js',
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"autoprefixer": "^9.8.0",
|
"autoprefixer": "^9.8.0",
|
||||||
"bootstrap": "^4.5.2",
|
"bootstrap": "^4.5.2",
|
||||||
"bootstrap-select": "^1.13.17",
|
"bootstrap-select": "^1.13.17",
|
||||||
|
"clipboard": "^2.0.6",
|
||||||
"dark-mode-switch": "^1.0.0",
|
"dark-mode-switch": "^1.0.0",
|
||||||
"flatpickr": "^4.6.6",
|
"flatpickr": "^4.6.6",
|
||||||
"fullcalendar": "^5.3.2",
|
"fullcalendar": "^5.3.2",
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||||
|
|
||||||
{% block title %}RIGS Profile {{object.pk}}{% endblock %}
|
{% load static %}
|
||||||
|
{% load linkornone from filters %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
|
<script src="{% static 'js/tooltip.js' %}"></script>
|
||||||
|
<script src="{% static 'js/popover.js' %}"></script>
|
||||||
|
<script src="{% static 'js/clipboard.min.js' %}"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#urlParamForm').change(function(){
|
$('#urlParamForm').change(function(){
|
||||||
@@ -25,18 +29,23 @@
|
|||||||
|
|
||||||
$('#urlParamForm').change(); //Do the initial setting
|
$('#urlParamForm').change(); //Do the initial setting
|
||||||
});
|
});
|
||||||
</script>
|
|
||||||
|
|
||||||
|
var clipboard = new ClipboardJS('.btn');
|
||||||
|
|
||||||
|
clipboard.on('success', function(e) {
|
||||||
|
$(e.trigger).popover('show');
|
||||||
|
window.setTimeout(function () {$(e.trigger).popover('hide')}, 3000);
|
||||||
|
e.clearSelection();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>Profile: {{object.name}}</h3>
|
{% if not request.is_ajax and object.pk == user.pk %}
|
||||||
{% if not request.is_ajax %}
|
|
||||||
<div class="row py-3">
|
<div class="row py-3">
|
||||||
{% if object.pk == user.pk %}
|
<div class="col text-right">
|
||||||
<div>
|
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a href="{% url 'profile_update_self' %}" class="btn btn-light">
|
<a href="{% url 'profile_update_self' %}" class="btn btn-warning">
|
||||||
Edit Profile <i class="fas fa-edit"></i>
|
Edit Profile <i class="fas fa-edit"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="{% url 'password_change' %}" class="btn btn-light">
|
<a href="{% url 'password_change' %}" class="btn btn-light">
|
||||||
@@ -44,11 +53,10 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="row no-gutters">
|
<div class="row no-gutters">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
@@ -76,7 +84,7 @@
|
|||||||
<dd class="col-7">{{object.initials}}</dd>
|
<dd class="col-7">{{object.initials}}</dd>
|
||||||
|
|
||||||
<dt class="col-5">Phone</dt>
|
<dt class="col-5">Phone</dt>
|
||||||
<dd class="col-7">{% if object.phone %}}<a href="tel:{{ object.phone }}">{% endif %}{{object.phone}}{% if object.phone %}}</a>{% endif %}</dd>
|
<dd class="col-7">{{object.phone|linkornone:'tel'}}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -84,44 +92,44 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if not request.is_ajax and object.pk == user.pk %}
|
{% if not request.is_ajax and object.pk == user.pk %}
|
||||||
<div class="col">
|
<div class="col-12 my-2">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
<div class="card-header">Personal iCal Details</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4>Personal iCal Details</h4>
|
|
||||||
<dl class="row">
|
<dl class="row">
|
||||||
<dt class="col-4">API Key</dt>
|
<dt class="col-4">API Key</dt>
|
||||||
<dd class="col-5">
|
<dd class="col-8">
|
||||||
{% if user.api_key %}
|
{% if user.api_key %}
|
||||||
{{user.api_key}}
|
<code id="api-key">{{user.api_key}}</code>
|
||||||
|
<button class="btn btn-secondary align-middle" data-clipboard-target="#api-key" data-content="Copied to clipboard!"><span class="fas fa-clipboard"></span></button>
|
||||||
{% else %}
|
{% else %}
|
||||||
No API Key Generated
|
No API Key Generated
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</dd>
|
<a href="{% url 'reset_api_key' %}" class="btn btn-secondary align-middle">
|
||||||
<a href="{% url 'reset_api_key' %}" class="btn btn-secondary col-3">
|
|
||||||
{% if user.api_key %}Reset API Key{% else %}Generate API Key{% endif %}
|
{% if user.api_key %}Reset API Key{% else %}Generate API Key{% endif %}
|
||||||
<span class="fas fa-redo"></span>
|
<span class="fas fa-redo"></span>
|
||||||
</a>
|
</a>
|
||||||
|
</dd>
|
||||||
<dt class="col-4">Calendar Options</dt>
|
<dt class="col-4">Calendar Options</dt>
|
||||||
<dd class="col-8">
|
<dd class="col-8">
|
||||||
<form id="urlParamForm">
|
<form id="urlParamForm">
|
||||||
<div class="form-group d-flex flex-wrap">
|
<div class="form-group d-flex flex-column flex-lg-row">
|
||||||
<label class="checkbox-inline mr-3">
|
<label class="checkbox-inline mr-lg-2">
|
||||||
<input type="checkbox" value="rig" data-default="true" checked> Rigs
|
<input type="checkbox" value="rig" data-default="true" checked> Rigs
|
||||||
</label>
|
</label>
|
||||||
<label class="checkbox-inline mx-3">
|
<label class="checkbox-inline mx-lg-2">
|
||||||
<input type="checkbox" value="non-rig" data-default="true" checked> Non-Rigs
|
<input type="checkbox" value="non-rig" data-default="true" checked> Non-Rigs
|
||||||
</label>
|
</label>
|
||||||
<label class="checkbox-inline mx-3">
|
<label class="checkbox-inline mx-lg-2">
|
||||||
<input type="checkbox" value="dry-hire" data-default="true" checked> Dry-Hires
|
<input type="checkbox" value="dry-hire" data-default="true" checked> Dry-Hires
|
||||||
</label>
|
</label>
|
||||||
<label class="checkbox-inline mx-3">
|
<label class="checkbox-inline mx-lg-2">
|
||||||
<input type="checkbox" value="cancelled" data-default="false" > Cancelled
|
<input type="checkbox" value="cancelled" data-default="false" > Cancelled
|
||||||
</label>
|
</label>
|
||||||
<label class="checkbox-inline mx-3">
|
<label class="checkbox-inline mx-lg-2">
|
||||||
<input type="checkbox" value="provisional" data-default="true" checked> Provisional
|
<input type="checkbox" value="provisional" data-default="true" checked> Provisional
|
||||||
</label>
|
</label>
|
||||||
<label class="checkbox-inline mx-3">
|
<label class="checkbox-inline ml-lg-2">
|
||||||
<input type="checkbox" value="confirmed" data-default="true" checked> Confirmed/Booked
|
<input type="checkbox" value="confirmed" data-default="true" checked> Confirmed/Booked
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -130,9 +138,11 @@
|
|||||||
<dt class="col-4">Calendar URL</dt>
|
<dt class="col-4">Calendar URL</dt>
|
||||||
<dd class="col-8">
|
<dd class="col-8">
|
||||||
{% if user.api_key %}
|
{% if user.api_key %}
|
||||||
<pre id="cal-url" data-url="http{{ request.is_secure|yesno:"s,"}}://{{ request.get_host }}{% url 'ics_calendar' api_pk=user.pk api_key=user.api_key %}"></pre>
|
<code id="cal-url" data-url="http{{ request.is_secure|yesno:"s,"}}://{{ request.get_host }}{% url 'ics_calendar' api_pk=user.pk api_key=user.api_key %}"></code>
|
||||||
|
<button class="btn btn-secondary align-middle" data-clipboard-target="#cal-url" data-content="Copied to clipboard!"><span class="fas fa-clipboard"></span></button>
|
||||||
|
<br>
|
||||||
<small><a id="gcal-link" data-url="https://support.google.com/calendar/answer/37100" href="">Click here</a> for instructions on adding to google calendar.<br/>
|
<small><a id="gcal-link" data-url="https://support.google.com/calendar/answer/37100" href="">Click here</a> for instructions on adding to google calendar.<br/>
|
||||||
To sync from google calendar to mobile device, visit <a href="https://www.google.com/calendar/syncselect" target="_blank">this page</a> on your device and tick "RIGS Calendar".</small>
|
To sync from Google Calendar to mobile device, visit <a href="https://www.google.com/calendar/syncselect" target="_blank">this page</a> on your device and tick "RIGS Calendar".</small>
|
||||||
{% else %}
|
{% else %}
|
||||||
<pre>No API Key Generated</pre>
|
<pre>No API Key Generated</pre>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ class ProfileDetail(generic.DetailView):
|
|||||||
|
|
||||||
return self.model.objects.filter(pk=pk)
|
return self.model.objects.filter(pk=pk)
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super(ProfileDetail, self).get_context_data(**kwargs)
|
||||||
|
context['page_title'] = "Profile: {}".format(self.object)
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class ProfileUpdateSelf(generic.UpdateView):
|
class ProfileUpdateSelf(generic.UpdateView):
|
||||||
template_name = "profile_form.html"
|
template_name = "profile_form.html"
|
||||||
|
|||||||
Reference in New Issue
Block a user