Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion evap/staff/templates/staff_course_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
{{ block.super }}
<h3>
{% if course_form.instance.id %}
{{ course.name }} ({{ course.semester.name }})
<span data-bs-toggle="tooltip" data-bs-placement="right" title="{% translate 'Click to copy name' %}" data-copy-on-click="{{ course.name }}">
{{ course.name }} ({{ course.semester.name }})
</span>
{% else %}
{% translate 'Create course' %}
{% endif %}
Expand Down
12 changes: 7 additions & 5 deletions evap/staff/templates/staff_evaluation_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
</div>
{% endif %}
<h3 class="pt-2">
{% if evaluation_form.instance.id %}
{{ evaluation.full_name }} ({{ evaluation.course.semester.name }})
{% else %}
{% translate 'Create evaluation' %}
{% endif %}
<span class="btn-clipboard" data-bs-toggle="tooltip" data-bs-placement="right" title="{% translate 'Click to copy name' %}" data-copy-on-click="{{ evaluation.full_name }}">
{% if evaluation_form.instance.id %}
{{ evaluation.full_name }} ({{ evaluation.course.semester.name }})
{% else %}
{% translate 'Create evaluation' %}
{% endif %}
</span>
</h3>
{% if evaluation_form.instance.id %}
<div class="mb-2">
Expand Down
5 changes: 5 additions & 0 deletions evap/staff/templates/staff_semester_view_evaluation.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@
<span class="fas fa-fw fa-copy"></span> {% translate 'Copy evaluation' %}
</a>
</li>
<li>
<a class="dropdown-item" data-copy-on-click="{{ evaluation.full_name }}">
<span class="fas fa-fw fa-clipboard"></span> {% translate 'Copy name to clipboard' %}
</a>
</li>
<li>
<a class="dropdown-item" href="{% url 'cms:evaluation_merge_selection' evaluation.id %}">
<span class="fas fa-fw fa-object-group"></span> {% translate 'Merge with other evaluation' %}
Expand Down
21 changes: 21 additions & 0 deletions evap/static/ts/src/base-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,24 @@ document.addEventListener("shown.bs.modal", e => {
autofocusEl.focus();
}
});

document.addEventListener("click", e => {
if (!e.target) {
return;
}
const modalEl = e.target as HTMLElement;
if (!modalEl.hasAttribute("data-copy-on-click")) {
return;
}
const copy_string = modalEl.getAttribute("data-copy-on-click")?.toString();
if (copy_string) {
navigator.clipboard.writeText(copy_string);
// console.log("copied");
// console.log(modalEl.getAttributeNames());
// console.log(modalEl.getAttribute("data-bs-original-title"))
// if (modalEl.hasAttribute("data-bs-original-title")) {
// modalEl.setAttribute("data-bs-original-title", "Copied to clipboard");
// console.log("data-bs-original-title");
// }
}
});
Loading