mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 13:32:15 +00:00
Added embedded login, and all iframe links open in new tab
This commit is contained in:
@@ -1,44 +1,12 @@
|
||||
{% extends 'base_embed.html' %}
|
||||
{% load static from staticfiles %}
|
||||
{% load raven %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}"
|
||||
xml:lang="{% firstof LANGUAGE_CODE 'en' %}"
|
||||
lang="{% firstof LANGUAGE_CODE 'en' %}">
|
||||
<head>
|
||||
<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" %}">
|
||||
|
||||
<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>
|
||||
|
||||
<style>
|
||||
body, html{
|
||||
padding:0;
|
||||
height:100%;
|
||||
}
|
||||
.embed_container{
|
||||
border:5px solid #e9e9e9;
|
||||
height:100%;
|
||||
width:100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% include "analytics.html" %}
|
||||
|
||||
<div class="embed_container" style="border: 5px solid #e9e9e9;">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-6">
|
||||
|
||||
<div class="col-sm-12">
|
||||
<img src="{% static "imgs/pyrigs-avatar.png" %}" style="position:relative; height:50px; float:left; left:-15px; "> </img>
|
||||
<h2>
|
||||
<small>
|
||||
<span class="pull-right">
|
||||
@@ -54,7 +22,7 @@
|
||||
{% endif %}
|
||||
</span>
|
||||
</small>
|
||||
<img src="{% static "imgs/pyrigs-avatar.png" %}" style="height:30px; float:left; padding-right:10px;"> </img>
|
||||
|
||||
<a {% if perms.RIGS.view_event %}href="{% url 'event_detail' object.pk %}" target="_top"{% endif %}>
|
||||
{% if object.is_rig %}N{{ object.pk|stringformat:"05d" }}{% else %}{{ object.pk }}{% endif %}
|
||||
| {{ object.name }} </a>
|
||||
@@ -79,7 +47,7 @@
|
||||
<p>
|
||||
<strong>{{ object.start_date|date:"D d/m/Y" }}</strong>
|
||||
{% if object.end_date and object.end_date != object.start_date %}
|
||||
<strong>{{ object.end_date|date:"D d/m/Y" }}</strong>
|
||||
– <strong>{{ object.end_date|date:"D d/m/Y" }}</strong>
|
||||
{% endif %}
|
||||
<span class="text-muted">({{ object.get_status_display }})</span>
|
||||
</p>
|
||||
@@ -88,8 +56,7 @@
|
||||
{{ object.description|linebreaksbr }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6" style="margin-top:30px;">
|
||||
|
||||
{% if not object.cancelled %}
|
||||
<dl class="dl-horizontal">
|
||||
{% if object.meet_at %}
|
||||
@@ -115,10 +82,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block js %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
@@ -15,6 +15,7 @@ urlpatterns = patterns('',
|
||||
url(r'^closemodal/$', views.CloseModal.as_view(), name='closemodal'),
|
||||
|
||||
url('^user/login/$', 'RIGS.views.login', name='login'),
|
||||
url('^user/login/embed/$', 'RIGS.views.login_embed', name='login_embed'),
|
||||
url(r'^user/password_reset/$', 'django.contrib.auth.views.password_reset', {'password_reset_form':forms.PasswordReset}),
|
||||
|
||||
# People
|
||||
@@ -84,7 +85,7 @@ urlpatterns = patterns('',
|
||||
permission_required_with_403('RIGS.view_event', oembed_view="event_oembed")(rigboard.EventDetail.as_view()),
|
||||
name='event_detail'),
|
||||
url(r'^event/(?P<pk>\d+)/embed/$',
|
||||
xframe_options_exempt(permission_required_with_403('RIGS.view_event')(rigboard.EventEmbed.as_view())),
|
||||
xframe_options_exempt(permission_required_with_403('RIGS.view_event', login_url='/user/login/embed/')(rigboard.EventEmbed.as_view())),
|
||||
name='event_embed'),
|
||||
url(r'^event/(?P<pk>\d+)/oembed_json/$',
|
||||
rigboard.EventOembed.as_view(),
|
||||
|
||||
@@ -35,6 +35,15 @@ def login(request, **kwargs):
|
||||
|
||||
return login(request)
|
||||
|
||||
def login_embed(request, **kwargs):
|
||||
if request.user.is_authenticated():
|
||||
next = request.REQUEST.get('next', '/')
|
||||
return HttpResponseRedirect(request.REQUEST.get('next', '/'))
|
||||
else:
|
||||
from django.contrib.auth.views import login
|
||||
|
||||
return login(request, template_name="registration/login_embed.html")
|
||||
|
||||
"""
|
||||
Called from a modal window (e.g. when an item is submitted to an event/invoice).
|
||||
May optionally also include some javascript in a success message to cause a load of
|
||||
|
||||
51
templates/base_embed.html
Normal file
51
templates/base_embed.html
Normal file
@@ -0,0 +1,51 @@
|
||||
{% load static from staticfiles %}
|
||||
{% load raven %}
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}"
|
||||
xml:lang="{% firstof LANGUAGE_CODE 'en' %}"
|
||||
lang="{% firstof LANGUAGE_CODE 'en' %}">
|
||||
<head>
|
||||
<base target="_blank" />
|
||||
<!-- Open all links in a new tab, not in the iframe -->
|
||||
|
||||
<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" %}">
|
||||
|
||||
<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>
|
||||
|
||||
<style>
|
||||
body, html{
|
||||
padding:0;
|
||||
height:100%;
|
||||
}
|
||||
.embed_container{
|
||||
border:5px solid #e9e9e9;
|
||||
height:100%;
|
||||
width:100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% include "analytics.html" %}
|
||||
|
||||
<div class="embed_container" style="border: 5px solid #e9e9e9;">
|
||||
<div class="container-fluid">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block js %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
11
templates/registration/login_embed.html
Normal file
11
templates/registration/login_embed.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% extends 'base_embed.html' %}
|
||||
|
||||
{% block title %}Login{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div style="text-align:center;">
|
||||
<h1>R<small>ig</small> I<small>nformation</small> G<small>athering</small> S<small>ystem</small></h1>
|
||||
</div>
|
||||
{% include 'registration/loginform.html' %}
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user