Skip to content

Commit

Permalink
#23 Server side render the Maizey URL (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
pushyamig authored Jul 11, 2024
1 parent 108f8a6 commit 2f72256
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ python manage.py shell -c "from django.core.management.utils import get_random_s
## Make a user superuser
1. go to the `auth_user` table and set `is_superuser` and `is_staff` to `1` or `true` this will give the logged user access to admin interface
2. In order to access the admin interface for to https://<tool-hostname>/admin
19 changes: 0 additions & 19 deletions lti_redirect/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,17 @@
<title>{% block title %}{% endblock %}</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'home.css' %}" />
<script type=""text/javascript">
window.onload = function() {
let currentYear = new Date().getFullYear();
document.getElementById('year').textContent = currentYear;
let maizey_url = "{{ maizey_url }}"
if(maizey_url) {
window.open(maizey_url, '_blank')
}
}
</script>
</head>

<body>
<div class="navbar">
<a href="{% url 'home' %}" class="navbar-brand">LTI Redirect TOOL</a>
{% if user.is_authenticated and user.is_superuser %}
<a class="navbar-item" href="{% url 'admin:index' %}" target="_blank">Admin</a>
{% endif %}
{% if user.is_authenticated %}
<span class="navbar-user">{{ user.username }}</span>
{% endif %}
</div>

<div class="body-content">
{% block content %}
{% endblock %}
<hr/>
<footer>
<p>&copy; <span id="year"></span> The Regents of the University of Michigan</p>
</footer>
</div>
</body>
</html>
5 changes: 1 addition & 4 deletions lti_redirect/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ def handle_resource_launch(self, request, lti_launch):
maizey_url = SendToMaizey(launch_data).send_to_maizey()
if not maizey_url:
return redirect("error")
context = {
"maizey_url": maizey_url,
}
return render(request, "home.html", context)
return HttpResponseRedirect(maizey_url)

def handle_deep_linking_launch(self, request, lti_launch):
... # Optional.
Expand Down
3 changes: 2 additions & 1 deletion setup/lti-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"title": "Canvas LTI Redirect Tool",
"title": "Canvas LTI Redirect Tool 🔗 ",
"scopes": [],
"extensions": [
{
Expand All @@ -10,6 +10,7 @@
"placements": [
{
"default": "disabled",
"windowTarget": "_blank",
"placement": "course_navigation",
"message_type": "LtiResourceLinkRequest",
"target_link_uri": "https://{app-hostname}/ltilaunch"
Expand Down

0 comments on commit 2f72256

Please sign in to comment.