aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/notifier
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2020-01-30 13:33:35 -0500
committerParker Berberian <pberberian@iol.unh.edu>2020-01-30 16:12:18 -0500
commit078273eb7db5a481a4131d44a943f3c9e34b6b88 (patch)
tree9e6e569e18712d77b8a65c6ebf4dda50ade1b55a /src/templates/notifier
parent899e1a4baa95d0bc6f0eef34de66f0e257174878 (diff)
Adds Template Overrides
Changes the structure of the template directories to allow a new project to define their own set of override templates that inherit from a common base. I have slightly modified landing.html here as an example. In comming changes we will try to move all the "laas" specific content into the laas directory Change-Id: I46151be182de901f870debb247b305ea34ae77ba Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/templates/notifier')
-rw-r--r--src/templates/notifier/email_ended.txt25
-rw-r--r--src/templates/notifier/email_expiring.txt25
-rw-r--r--src/templates/notifier/email_fulfilled.txt21
-rw-r--r--src/templates/notifier/end_booking.html36
-rw-r--r--src/templates/notifier/expiring_booking.html35
-rw-r--r--src/templates/notifier/inbox.html87
-rw-r--r--src/templates/notifier/new_booking.html34
-rw-r--r--src/templates/notifier/notification.html50
8 files changed, 0 insertions, 313 deletions
diff --git a/src/templates/notifier/email_ended.txt b/src/templates/notifier/email_ended.txt
deleted file mode 100644
index 1788e00..0000000
--- a/src/templates/notifier/email_ended.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-{{user_name|default:"Developer"}},
-
-{% if owner %}
-The booking you requested from the OPNFV Lab as a Service has ended.
-{% else %}
-The booking you collaborated on at the OPNFV Lab as a Service has ended.
-{% endif %}
-
-booking information:
- start: {{booking.start}}
- end: {{booking.end}}
- machines:
- {% for host in hosts %}
- - {{host}}
- {% endfor %}
- purpose: {{booking.purpose}}
-
-You may visit the following link for more information:
-{{booking_url}}
-
-Feel free to create another booking with us!
-
-Thank you for contributing to the OPNFV platform!
-
- - The Lab-as-a-Service team
diff --git a/src/templates/notifier/email_expiring.txt b/src/templates/notifier/email_expiring.txt
deleted file mode 100644
index 72c9a83..0000000
--- a/src/templates/notifier/email_expiring.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-{{user_name|default:"Developer"}},
-
-{% if owner %}
-The booking you requested from the OPNFV Lab as a Service is about to expire.
-{% else %}
-The booking you collaborate on at the OPNFV Lab as a Service is about to expire.
-{% endif %}
-
-booking information:
- start: {{booking.start}}
- end: {{booking.end}}
- machines:
- {% for host in hosts %}
- - {{host}}
- {% endfor %}
- purpose: {{booking.purpose}}
-
-You may visit the following link for more information:
-{{booking_url}}
-
-Please take the time to backup all data or extend the booking if needed.
-
-Thank you for contributing to the OPNFV platform!
-
- - The Lab-as-a-Service team
diff --git a/src/templates/notifier/email_fulfilled.txt b/src/templates/notifier/email_fulfilled.txt
deleted file mode 100644
index 90d294a..0000000
--- a/src/templates/notifier/email_fulfilled.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-{{user_name|default:"Developer"}},
-
-{% if owner %}
-The booking you requested of the OPNFV Lab as a Service has finished deploying and is ready for you to use.
-{% else %}
-A booking you collaborate on is ready for you to use
-{% endif %}
-
-The lab that fulfilled your booking request has sent you the following messages:
- {% for email_message in messages %}
- {{ email_message.title }}
- {{ email_message.content }}
- --------------------
- {% endfor %}
-
-You may visit the following link for more information:
-{{booking_url}}
-
-Thank you for contributing to the OPNFV platform!
-
- - The Lab-as-a-Service team
diff --git a/src/templates/notifier/end_booking.html b/src/templates/notifier/end_booking.html
deleted file mode 100644
index a2981c1..0000000
--- a/src/templates/notifier/end_booking.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<html>
- <body>
- <div id="message_content_wrapper">
- {% if owner %}
- <h3>Your booking has expired</h3>
- <p>Your booking has ended and the machines have been cleaned up.</p>
- <p>Thank you for working on OPNFV, and feel free to book more machines if you need them.</p>
- {% else %}
- <h3>A booking that you collaborated on has expired</h3>
- <p>The booking owned by {{booking.owner.username}} that you worked on has ended</p>
- <p>Thank you for contributing to OPNFV!</p>
- {% endif %}
- <p>Booking information:</p>
- <ul>
- <li>owner: {{booking.owner.username}}</li>
- <li>id: {{booking.id}}</li>
- <li>lab: {{booking.resource.template.lab.lab_user.username}}</li>
- <li>resource: {{booking.resource.template.name}}</li>
- <li>start: {{booking.start}}</li>
- <li>end: {{booking.end}}</li>
- <li>purpose: {{booking.purpose}}</li>
- <li>collaborators:
- <ul>
- {% for user in booking.collaborators.all %}
- <li>user.username</li>
- {% empty %}
- <li>No collaborators</li>
- {% endfor %}
- </ul>
- </li>
- </ul>
-
- <p>You can find more detailed information <a href=/booking/detail/{{booking.id}}/>Here</a></p>
- </div>
- </body>
-</html>
diff --git a/src/templates/notifier/expiring_booking.html b/src/templates/notifier/expiring_booking.html
deleted file mode 100644
index 8bfa689..0000000
--- a/src/templates/notifier/expiring_booking.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<html>
- <body>
- <div id="message_content_wrapper">
- {% if owner %}
- <h3>Your booking is about to expire</h3>
- <p>Your booking will expire within 48 hours ({{booking.end}}).</p>
- {% else %}
- <h3>A booking that you collaborate on is about to expire</h3>
- <p>The booking owned by {{booking.owner.username}} that you work on is about to expire</p>
- {% endif %}
- <p>Please take the time to backup all data or extend the booking if needed.</p>
- <p>Booking information:</p>
- <ul>
- <li>owner: {{booking.owner.username}}</li>
- <li>id: {{booking.id}}</li>
- <li>lab: {{booking.resource.template.lab.lab_user.username}}</li>
- <li>resource: {{booking.resource.template.name}}</li>
- <li>start: {{booking.start}}</li>
- <li>end: {{booking.end}}</li>
- <li>purpose: {{booking.purpose}}</li>
- <li>collaborators:
- <ul>
- {% for user in booking.collaborators.all %}
- <li>user.username</li>
- {% empty %}
- <li>No collaborators</li>
- {% endfor %}
- </ul>
- </li>
- </ul>
-
- <p>You can find more detailed information <a href=/booking/detail/{{booking.id}}/>Here</a></p>
- </div>
- </body>
-</html>
diff --git a/src/templates/notifier/inbox.html b/src/templates/notifier/inbox.html
deleted file mode 100644
index 26b6d32..0000000
--- a/src/templates/notifier/inbox.html
+++ /dev/null
@@ -1,87 +0,0 @@
-{% extends "base.html" %}
-
-
-{% load staticfiles %}
-
-{% block content %}
-
-<div class="container-fluid d-flex flex-grow-1 flex-column">
- <div class="row mt-3 mb-2">
- <div class="col-2 px-0">
- <div class="btn-group w-100" id="filterGroup">
- <button class="btn btn-secondary active" data-read="-1">All</button>
- <button class="btn btn-secondary" data-read="0">Unread</button>
- <button class="btn btn-secondary" data-read="1">Read</button>
- </div>
- </div>
- </div>
- <div class="row flex-grow-1" id="fixHeight">
- <!-- Notification list && Controls -->
- <div class="mb-2 mb-lg-0 col-lg-2 px-0 mh-100">
- <span class="text-muted d-none" id="noMessages">No messages available</span>
- <div class="list-group rounded-0 rounded-left overflow-auto mh-100 notifications" id="unreadNotifications" data-read="0">
- {% for notification in unread_notifications %}
- <a
- href="#"
- onclick="showmessage({{notification.id}}); setactive(this);"
- class="list-group-item list-group-item-action notification">
- {{ notification }}
- </a>
- {% endfor %}
- </div>
- <div class="list-group rounded-0 rounded-left overflow-auto mh-100 notifications" id="readNotifications" data-read="1">
- {% for notification in read_notifications %}
- <a
- href="#"
- onclick="showmessage({{notification.id}}); setactive(this);"
- class="list-group-item list-group-item-action list-group-item-secondary notification">
- {{ notification }}
- </a>
- {% endfor %}
- </div>
- </div>
- <!-- Content -->
- <div class="col ml-lg-2 border mh-100 p-4">
- <iframe name="messageView" class="w-100 h-100" id="inbox-iframe" frameBorder="0" scrolling="yes">Please select a notification</iframe>
- </div>
- </div>
-</div>
-
-<script type="text/javascript">
- function showmessage(msg_id) {
- window.frames["messageView"].location = "notification/" + msg_id;
- }
-
- function setactive(obj) {
- $(".notification").removeClass("active");
- $(obj).addClass("active");
- }
-
- // Shows messages in the given notification list.
- // Shows/hides the 'no messages' span after checking children amount
- // given the .notification classed element
- function showMessages(notificationList) {
- $(".notifications").addClass("d-none");
- if (notificationList.children().length < 1) {
- $("#noMessages").removeClass("d-none");
- } else {
- $("#noMessages").addClass("d-none");
- notificationList.removeClass("d-none");
- }
- }
-
- $(document).ready(function(){
- // For all / unread / read
- $("#filterGroup button").click(function(){
- let read = $(this).attr("data-read");
- $(this).siblings().removeClass("active");
- $(this).addClass("active");
- if (read === "-1") {
- return showMessages($(".notifications"));
- }
- return showMessages($(`.notifications[data-read="${read}"]`));
- });
- showMessages($(".notifications"));
- });
-</script>
-{% endblock %} \ No newline at end of file
diff --git a/src/templates/notifier/new_booking.html b/src/templates/notifier/new_booking.html
deleted file mode 100644
index 64244e0..0000000
--- a/src/templates/notifier/new_booking.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<html>
- <body>
- <div id="message_content_wrapper">
- {% if owner %}
- <h3>You have created a new booking</h3>
- <p>We have recieved your booking request and will start working on it right away.</p>
- {% else %}
- <h3>You have been added as a collaborator to a booking</h3>
- <p>{{booking.owner.username}} has given you access to their booking.</p>
- {% endif %}
- <p>Booking information:</p>
- <ul>
- <li>owner: {{booking.owner.username}}</li>
- <li>id: {{booking.id}}</li>
- <li>lab: {{booking.resource.template.lab.lab_user.username}}</li>
- <li>resource: {{booking.resource.template.name}}</li>
- <li>start: {{booking.start}}</li>
- <li>end: {{booking.end}}</li>
- <li>purpose: {{booking.purpose}}</li>
- <li>collaborators:
- <ul>
- {% for user in booking.collaborators.all %}
- <li>user.username</li>
- {% empty %}
- <li>No collaborators</li>
- {% endfor %}
- </ul>
- </li>
- </ul>
-
- <p>You can find more detailed information <a href=/booking/detail/{{booking.id}}/>Here</a></p>
- </div>
- </body>
-</html>
diff --git a/src/templates/notifier/notification.html b/src/templates/notifier/notification.html
deleted file mode 100644
index 603edea..0000000
--- a/src/templates/notifier/notification.html
+++ /dev/null
@@ -1,50 +0,0 @@
-{% extends "layout.html" %}
-{% block extrahead %}
-<base target="_parent">
-{% endblock %}
-
-{% block basecontent %}
-<script>
- function send_request(post_data){
- var form = $("#notification_action_form");
- var formData = form.serialize() + '&' + post_data + '=true';
- var req = new XMLHttpRequest();
- req.open("POST", ".", false);
- req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- req.onerror = function() { alert("problem occurred while trying to cancel current workflow"); }
- req.onreadystatechange = function() { if(req.readyState === 4){
- window.top.location.href += '';
- }};
- req.send(formData);
- }
- function delete_notification()
- {
- send_request("delete");
- }
- function mark_unread()
- {
- send_request("unread");
- }
-</script>
-
-<div class="d-flex justify-content-between border-bottom">
- <span class="h3">{{notification.title}}</span>
- <div class="btn_group">
- <button class="btn btn-primary inbox-btn" onclick="mark_unread()">Mark Unread</button>
- <button class="btn btn-danger inbox-btn" onclick="delete_notification()">Delete</button>
- </div>
-</div>
-
-<p class="content-divider"></p>
-
-{% if not notification.is_html %}
-<pre>
-{% endif %}
- {{notification.content|safe}}
-{% if not notification.is_html %}
-</pre>
-{% endif %}
-<form id="notification_action_form" action="." method="post">
- {% csrf_token %}
-</form>
-{% endblock %}