|
1 | 1 | {% extends "base.html" %} |
2 | 2 | {% load static %} |
3 | 3 | {% block top_includes %} |
4 | | - <link rel="stylesheet" type="text/css" href="/static/css/institutions.css" /> |
| 4 | + <link rel="stylesheet" type="text/css" href="/static/css/institutions.css" /> |
| 5 | + <style> |
| 6 | + #copy-modal { |
| 7 | + display: none; /* hidden by default */ |
| 8 | + position: fixed; |
| 9 | + z-index: 2000; |
| 10 | + inset: 0; |
| 11 | + } |
| 12 | + #copy-modal.show_modal { |
| 13 | + display: flex; |
| 14 | + align-items: center; |
| 15 | + justify-content: center; |
| 16 | + padding: 16px; |
| 17 | + } |
| 18 | + #copy-modal .modal-content { |
| 19 | + background: white; |
| 20 | + width: 100%; |
| 21 | + max-width: 600px; |
| 22 | + max-height: 80vh; |
| 23 | + padding: 20px; |
| 24 | + border-radius: 10px; |
| 25 | + display: flex; |
| 26 | + flex-direction: column; |
| 27 | + gap: 10px; |
| 28 | + overflow: hidden; |
| 29 | + } |
| 30 | + </style> |
5 | 31 | {% endblock %} |
6 | 32 | {% load comment_extras %} |
7 | 33 | {% block title %} |
|
33 | 59 | {% if perms.osf.change_institution %} |
34 | 60 | <a class="btn btn-primary" href={% url 'institutions:list_and_add_admin' institution.id %}>Manage Admins</a> |
35 | 61 | {% endif %} |
| 62 | + {% if cas_login_url %} |
| 63 | + <button class="btn btn-primary" onclick="openCopyPopup('{{ cas_login_url|escapejs }}')"> |
| 64 | + Copy SSO URL |
| 65 | + </button> |
| 66 | + <div id="copy-modal" class="modal"> |
| 67 | + <div class="modal-content"> |
| 68 | + <span class="close" onclick="closeCopyPopup()">×</span> |
| 69 | + <p>Value copied. You can also copy manually:</p> |
| 70 | + <textarea id="copy-input" readonly></textarea> |
| 71 | + </div> |
| 72 | + </div> |
| 73 | + {% endif %} |
36 | 74 | </div> |
37 | 75 | </div> |
38 | 76 |
|
@@ -168,5 +206,27 @@ <h3>Are you sure you want to run monthly report for this institution?</h3> |
168 | 206 | }); |
169 | 207 | }); |
170 | 208 | }); |
| 209 | + |
| 210 | + window.openCopyPopup = function(text) { |
| 211 | + const modal = document.getElementById("copy-modal"); |
| 212 | + const input = document.getElementById("copy-input"); |
| 213 | + input.value = text; |
| 214 | + modal.classList.add("show_modal"); |
| 215 | + navigator.clipboard.writeText(text).catch(() => {}); |
| 216 | + input.focus(); |
| 217 | + input.select(); |
| 218 | + }; |
| 219 | + |
| 220 | + window.closeCopyPopup = function() { |
| 221 | + document.getElementById("copy-modal").classList.remove("show_modal"); |
| 222 | + }; |
| 223 | + |
| 224 | + // Close on outside click |
| 225 | + window.onclick = function(event) { |
| 226 | + const modal = document.getElementById("copy-modal"); |
| 227 | + if (event.target === modal) { |
| 228 | + modal.classList.remove("show_modal"); |
| 229 | + } |
| 230 | + }; |
171 | 231 | </script> |
172 | 232 | {% endblock %} |
0 commit comments